public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlsta <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH 5/5] lockdep,x86: account for irqs enabled in paranoid_exit
Date: Sat, 18 Apr 2009 09:00:15 +0200	[thread overview]
Message-ID: <20090418070015.GA7678@elte.hu> (raw)
In-Reply-To: <20090417211231.649674806@goodmis.org>


* Steven Rostedt <rostedt@goodmis.org> wrote:

> From: Steven Rostedt <srostedt@redhat.com>
> 
> I hit the check_flags error of lockdep:
> 
> WARNING: at kernel/lockdep.c:2893 check_flags+0x1a7/0x1d0()
> [...]
> hardirqs last  enabled at (12567): [<ffffffff8026206a>] local_bh_enable+0xaa/0x110
> hardirqs last disabled at (12569): [<ffffffff80610c76>] int3+0x16/0x40
> softirqs last  enabled at (12566): [<ffffffff80514d2b>] lock_sock_nested+0xfb/0x110
> softirqs last disabled at (12568): [<ffffffff8058454e>] tcp_prequeue_process+0x2e/0xa0
> 
> The check_flags warning of lockdep tells me that lockdep thought interrupts
> were disabled, but they were really enabled.
> 
> The numbers in the above parenthesis show the order of events:
> 
> 12566: softirqs last enabled:  lock_sock_nested
> 12567: hardirqs last enabled:  local_bh_enable
> 12568: softirqs last disabled: tcp_prequeue_process
> 12566: hardirqs last disabled: int3
> 
> int3 is a breakpoint!
> 
> Examining this further, I have CONFIG_NET_TCPPROBE enabled which adds
> break points into the kernel.
> 
> The paranoid_exit of the return of int3 does not account for enabling
> interrupts on return to kernel. This code is a bit tricky since it
> is also used by the nmi handler (when lockdep is off), and we must be
> careful about the swapgs. We can not call kernel code after the swapgs
> has been performed.
> 
> [ Impact: fix lockdep check_flags warning ]
> 
> Acked-by: Peter Zijlsta <a.p.zijlstra@chello.nl>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  arch/x86/kernel/entry_64.S |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
> index 1ac9986..987f91f 100644
> --- a/arch/x86/kernel/entry_64.S
> +++ b/arch/x86/kernel/entry_64.S
> @@ -1397,7 +1397,10 @@ ENTRY(paranoid_exit)
>  paranoid_swapgs:
>  	TRACE_IRQS_IRETQ 0
>  	SWAPGS_UNSAFE_STACK
> +	RESTORE_ALL 8
> +	jmp irq_return
>  paranoid_restore:
> +	TRACE_IRQS_IRETQ 0
>  	RESTORE_ALL 8
>  	jmp irq_return
>  paranoid_userspace:

Nice catch! This is also for upstream really - i'll cherry-pick it 
into the lockdep urgent queue as well.

	Ingo

      reply	other threads:[~2009-04-18  7:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17 21:11 [PATCH 0/5] [GIT PULL] tracing,lockdep,x86: more updates for tip Steven Rostedt
2009-04-17 21:11 ` [PATCH 1/5] tracing/events: enable code with EVENT_TRACING not EVENT_TRACER Steven Rostedt
2009-04-18  7:13   ` Ingo Molnar
2009-04-18 14:18     ` Steven Rostedt
2009-04-17 21:11 ` [PATCH 2/5] tracing: add EXPORT_SYMBOL_GPL for trace commits Steven Rostedt
2009-04-17 21:11 ` [PATCH 3/5] tracing: add same level recursion detection Steven Rostedt
2009-04-18  7:11   ` Ingo Molnar
2009-04-18 14:12     ` Steven Rostedt
2009-04-17 21:11 ` [PATCH 4/5] tracing: protect trace_printk from recursion Steven Rostedt
2009-04-17 21:11 ` [PATCH 5/5] lockdep,x86: account for irqs enabled in paranoid_exit Steven Rostedt
2009-04-18  7:00   ` Ingo Molnar [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=20090418070015.GA7678@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox