All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Qi Hou <qi.hou@windriver.com>
Cc: mingo@redhat.com, rostedt@goodmis.org, tglx@linutronix.de,
	linux-kernel@vger.kernel.org, C.Emde@osadl.org,
	paul.gortmaker@windriver.com, bruce.ashfield@windriver.com
Subject: Re: [PATCH] lockdep: call trace_hardirqs_off after clearing hardirqs_enabled
Date: Mon, 13 Mar 2017 15:37:56 +0100	[thread overview]
Message-ID: <20170313143756.GA3373@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1489399728-60265-1-git-send-email-qi.hou@windriver.com>


Thanks for Cc'ing me.

On Mon, Mar 13, 2017 at 06:08:48PM +0800, Qi Hou wrote:
> The current order of calls within trace_hardirqs_off() would provoke an
> "unannotated irqs-off" WARNING.
> 
> This warning was reported by check_flags() when it found that the hardirqs has
> been disabled but the irq-flags state, hardirqs_enabled, has not been cleared.
> 
> Check_flags() is called via trace_hardirqs_off(), and trace_hardirqs_off() will
> be called by functions kind of local_irq_disable() if CONFIG_TRACE_IRQFLAGS has
> been enabled.
> 
> The calltrace from functions kind of local_irq_diasble() to check_flags()
> simplied as below:
> 
> local_irq_disable()
>  |- trace_hardirqs_off()
>      |- trace_hardirqs_off_caller()
>          |- preemptirqsoff_hist()
>             |- __DO_TRACE()
>                |- rcu_dereference_sched()
>                    |- rcu_read_lock_sched_held()
>                        |- lock_is_held()
>                            |- check_flags()
> 
> The order of calls within trace_hardirqs_off() can be simplified as below:
> 
> local_irq_disable()
>  |- raw_local_irq_disable()
>  |- trace_hardirqs_off()
>      |- trace_hardirqs_off() --> check_flags()
>      |- hardirqs_enabled = 0
> 
> We could find that the call to check_flags() has been made between disabling
> hardirqs and clearing hardirqs_enabled. That will definitely cause an
> "unannotated irqs-off" warning.
> 
> To fix this "unannotated irqs-off" warning, we must call trace_hardirqs_off()
> after that we clear hardirqs_enabled.

Here you say: "trace_hardirqs_off()"

> Signed-off-by: Qi Hou <qi.hou@windriver.com>
> ---
>  kernel/locking/lockdep.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 577f026..e8b35e4 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -2627,8 +2627,6 @@ __visible void trace_hardirqs_off_caller(unsigned long ip)
>  {
>  	struct task_struct *curr = current;
>  
> -	time_hardirqs_off(CALLER_ADDR0, ip);

This is: "TIME_hardirqs_off()", notice the difference?

Care to try to write a changelog that makes sense?

      parent reply	other threads:[~2017-03-13 14:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 10:08 [PATCH] lockdep: call trace_hardirqs_off after clearing hardirqs_enabled Qi Hou
2017-03-13 14:05 ` Steven Rostedt
2017-03-14  1:24   ` qhou
2017-03-13 14:37 ` Peter Zijlstra [this message]

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=20170313143756.GA3373@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=C.Emde@osadl.org \
    --cc=bruce.ashfield@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=qi.hou@windriver.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.