Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761453AbYBYWWx (ORCPT ); Mon, 25 Feb 2008 17:22:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757447AbYBYWWn (ORCPT ); Mon, 25 Feb 2008 17:22:43 -0500 Received: from smtp1.linux-foundation.org ([207.189.120.13]:35499 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756926AbYBYWWm (ORCPT ); Mon, 25 Feb 2008 17:22:42 -0500 Date: Mon, 25 Feb 2008 14:17:26 -0800 From: Andrew Morton To: Thomas Gleixner Cc: Jeff Garzik , =?ISO-8859-1?Q?Bj=F6rn?= Steinbrink , LKML , Ingo Molnar Subject: Re: 2.6.24-git: kmap_atomic() WARN_ON() Message-Id: <20080225141726.be60a0af.akpm@linux-foundation.org> In-Reply-To: References: <20080225195924.GA23176@atjola.homenet> <47C32043.6090809@pobox.com> <20080225124054.9b69e9f0.akpm@linux-foundation.org> X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2023 Lines: 50 On Mon, 25 Feb 2008 23:01:59 +0100 (CET) Thomas Gleixner wrote: > On Mon, 25 Feb 2008, Andrew Morton wrote: > > On Mon, 25 Feb 2008 15:08:35 -0500 Jeff Garzik 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/