public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	sfr@canb.auug.org.au
Subject: Re: [PATCH] lockdep: annotate i386 apm
Date: Thu, 12 Oct 2006 10:26:45 +0200	[thread overview]
Message-ID: <1160641605.2006.113.camel@taijtu> (raw)
In-Reply-To: <20061012080212.GA14307@elte.hu>

On Thu, 2006-10-12 at 10:02 +0200, Ingo Molnar wrote:
> * Andrew Morton <akpm@osdl.org> wrote:
> 
> > > So, say interrupts were enabled when entering apm_bios_call*(); you now
> > > save that in flags, disable interrupts, and enable them again.
> > > Upon reaching local_irq_restore(), we'll hit the else branch with irq's
> > > enabled and call trace_hardirqs_on(), which goes EEEK!
> > 
> > I'd assumed lockdep was less stupid than that ;) This?  Seems a bit 
> > overdone..
> 
> the problem is not lockdep but that the BIOS enables IRQs behind the 
> back of the kernel. Lockdep needs to be taught about that - if this 
> happens unconditionally then i'd suggest to insert an unconditional 
> trace_hardirqs_on() call to after the local_irq_save() that we do prior 
> calling the BIOS. (that will be a NOP if lockdep is not enabled)

Well, its not quite like that, the irq mess in apm does an explicit
unbalanced irq action, and lockdep rightly triggers on that.
And adding to that comes the fact that we do indeed call a BIOS routine
which can do god knows what.

So we want to save irq state and force it into a known state; normally
it will only be disable - however in this case (when
apm_info.allow_ints) we force enable it. All end scope routines expect
irqs disabled.

logically it looks something like this

local_irq_save(flags)
local_irq_enable()
...
local_irq_disable() <--- missing
local_irq_restore(flags)

except that the first two statements are blended together to avoid the
unneeded disable.

The logic is sound because local_irq_restore will just set whatever was
saved, except lockdep gets confused by the unbalanced operations - a
good thing IMHO.


      reply	other threads:[~2006-10-12  8:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-11 13:40 [PATCH] lockdep: annotate i386 apm Peter Zijlstra
2006-10-11 21:18 ` Andrew Morton
2006-10-12  6:06   ` Peter Zijlstra
2006-10-12  6:39     ` Andrew Morton
2006-10-12  6:50       ` Peter Zijlstra
2006-10-12  7:29         ` Andrew Morton
2006-10-12  8:13           ` Peter Zijlstra
2006-10-12  8:02       ` Ingo Molnar
2006-10-12  8:26         ` 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=1160641605.2006.113.camel@taijtu \
    --to=a.p.zijlstra@chello.nl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sfr@canb.auug.org.au \
    /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