mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Jules Irenge <jbi.octave@gmail.com>
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
	paulmck@kernel.org, mingo@redhat.com, boqun.feng@gmail.com,
	Borislav Petkov <bp@alien8.de>,
	x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH 4/5] x86/ftrace: Add annotations for ftrace_arch_code_modify_prepare() and ftrace_arch_code_modify_post_process()
Date: Mon, 1 Jun 2020 15:46:47 -0400	[thread overview]
Message-ID: <20200601154647.581fa345@oasis.local.home> (raw)
In-Reply-To: <20200601184552.23128-5-jbi.octave@gmail.com>

On Mon,  1 Jun 2020 19:45:51 +0100
Jules Irenge <jbi.octave@gmail.com> wrote:

> Sparse reports warnings
> 
> warning: context imbalance in ftrace_arch_code_modify_prepare()
> 	- wrong count at exit
> warning: context imbalance in ftrace_arch_code_modify_post_process()
> 	- wrong count at exit
> 
> The root cause is that even if
>  the annotations on the function are correct,
> mutex do not support annotation
> This makes Sparse to complain.
> To fix this,
> __acquire(&text_mutex) and
>  __release(&text_mutex) annotations are added
> inside ftrace_arch_code_modify_prepare()
> and ftrace_arch_code_modify_post_process()
> respectively.

Wait what? This looks like either a bug in sparse, or we just remove the
annotations. This just makes the code ugly, and looks silly.

Nack!

-- Steve


> 
> Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> ---
>  arch/x86/kernel/ftrace.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
> index 37a0aeaf89e7..737c07ab2e07 100644
> --- a/arch/x86/kernel/ftrace.c
> +++ b/arch/x86/kernel/ftrace.c
> @@ -46,6 +46,7 @@ int ftrace_arch_code_modify_prepare(void)
>  	 * ftrace has it set to "read/write".
>  	 */
>  	mutex_lock(&text_mutex);
> +	__acquire(&text_mutex);
>  	ftrace_poke_late = 1;
>  	return 0;
>  }
> @@ -61,6 +62,7 @@ int ftrace_arch_code_modify_post_process(void)
>  	text_poke_finish();
>  	ftrace_poke_late = 0;
>  	mutex_unlock(&text_mutex);
> +	__release(&text_mutex);
>  	return 0;
>  }
>  


  reply	other threads:[~2020-06-01 19:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 18:45 [PATCH 0/5] cleanups Jules Irenge
2020-06-01 18:45 ` [PATCH 1/5] rcu/rcutorture: replace 0 with false Jules Irenge
2020-06-01 18:45 ` [PATCH 2/5] rcu: replace 1 with true Jules Irenge
2020-06-01 18:45 ` [PATCH 3/5] rcu: replace + with | Jules Irenge
2020-06-01 18:45 ` [PATCH 4/5] x86/ftrace: Add annotations for ftrace_arch_code_modify_prepare() and ftrace_arch_code_modify_post_process() Jules Irenge
2020-06-01 19:46   ` Steven Rostedt [this message]
2020-06-01 22:01     ` 
2020-06-02 23:10     ` Luc Van Oostenryck
2020-06-05  7:42       ` 
2020-06-01 18:45 ` [PATCH 5/5] sfc: add missing annotation for efx_ef10_try_update_nic_stats_vf() Jules Irenge
2020-06-01 22:52   ` David Miller
2020-06-02 16:45 ` [PATCH 0/5] cleanups Paul E. McKenney
2020-06-05  7:45   ` 

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200601154647.581fa345@oasis.local.home \
    --to=rostedt@goodmis.org \
    --cc=boqun.feng@gmail.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jbi.octave@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®