LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: "Jeff Garzik" <jgarzik@pobox.com>,
	"Björn Steinbrink" <B.Steinbrink@gmx.de>,
	LKML <linux-kernel@vger.kernel.org>,
	"Ingo Molnar" <mingo@elte.hu>
Subject: Re: 2.6.24-git: kmap_atomic() WARN_ON()
Date: Mon, 25 Feb 2008 14:17:26 -0800	[thread overview]
Message-ID: <20080225141726.be60a0af.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.LFD.1.00.0802252242290.7583@apollo.tec.linutronix.de>

On Mon, 25 Feb 2008 23:01:59 +0100 (CET) Thomas Gleixner <tglx@linutronix.de> wrote:

> On Mon, 25 Feb 2008, Andrew Morton wrote:
> > On Mon, 25 Feb 2008 15:08:35 -0500 Jeff Garzik <jgarzik@pobox.com> wrote:
> > > There are plenty of drivers that do the same thing that ahci does, in 
> > > terms of interrupt handler locking...  and I will definitely push back 
> > > on efforts to convert otherwise-100%-safe spin_lock() into 
> > > spin_lock_irqsave() just to quiet lockdep.
> > > 
> > > Very interesting email, thanks...
> > > 
> > 
> > I suspect this is a bug in my old kmap_atomic debugging patch.  It doesn't
> > know about the implicit irq-disablememnt which interrupt handlers enjoy.  I
> > don't think...
> 
> I suspect here is confusion. The implicit irq-disablement of lockdep
> is actually hiding the warning.
> 
> The code which emits the warning is:
> 
>         if (type == KM_IRQ0 || type == KM_IRQ1 || type == KM_BOUNCE_READ ||
>                         type == KM_BIO_SRC_IRQ || type == KM_BIO_DST_IRQ) {
>                 if (!irqs_disabled()) {
>                         WARN_ON(1);
>                         warn_count--;
>                 }
> 
> It checks for _NOT_ irqs_disabled. The calling code is
> ata_scsi_rbuf_get() which calls with:
> 
>      buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset;
> 
> This happens with interrupts enabled. So the warning is according to
> the well documented km_type enum and the equally well documented
> highmem debug code correct.
> 
> Bjoern decoded it very well, just Jeff jumped to very interesting
> conclusions.
> 

Ah, OK, yes.  ata is wrong.  It must disable interrupts here.  Otherwise
this CPU could get interrupted by some other device whose handler also uses
KM_IRQ0, resulting in data corruption.


  reply	other threads:[~2008-02-25 22:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-06 23:58 Thomas Gleixner
2008-02-13 22:39 ` Rafael J. Wysocki
2008-02-14  1:13   ` Thomas Gleixner
2008-02-25 19:59 ` Björn Steinbrink
2008-02-25 20:08   ` Jeff Garzik
2008-02-25 20:35     ` Björn Steinbrink
2008-02-25 20:40     ` Andrew Morton
2008-02-25 22:01       ` Thomas Gleixner
2008-02-25 22:17         ` Andrew Morton [this message]
2008-02-25 23:19         ` Jeff Garzik
2008-02-26  8:39           ` Ingo Molnar
2008-02-26 16:32             ` Jeff Garzik
2008-02-26 18:19               ` Andrew Morton
2008-02-26 20:49                 ` Ingo Molnar
2008-02-26 21:37                   ` Andrew Morton
2008-02-26 22:59                     ` Jeff Garzik
2008-02-27  0:02                       ` Alan Cox
2008-02-26 23:49                   ` Nick Piggin
2008-02-26  8:50           ` Thomas Gleixner

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=20080225141726.be60a0af.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=B.Steinbrink@gmx.de \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --subject='Re: 2.6.24-git: kmap_atomic() WARN_ON()' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).