From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTP id 327DBDDF06 for ; Fri, 19 Oct 2007 14:29:42 +1000 (EST) Subject: Re: [PATCH] synchronize_irq needs a barrier From: Benjamin Herrenschmidt To: Herbert Xu In-Reply-To: <20071019042025.GA9617@gondor.apana.org.au> References: <1192745137.7367.40.camel@pasglop> <1192749449.7367.51.camel@pasglop> <20071019023219.GB8453@gondor.apana.org.au> <20071019042025.GA9617@gondor.apana.org.au> Content-Type: text/plain Date: Fri, 19 Oct 2007 14:29:03 +1000 Message-Id: <1192768143.7367.98.camel@pasglop> Mime-Version: 1.0 Cc: Linux Kernel Mailing List , linuxppc-dev@ozlabs.org, Thomas Gleixner , akpm@linux-foundation.org, Linus Torvalds , Ingo Molnar Reply-To: benh@kernel.crashing.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, 2007-10-19 at 12:20 +0800, Herbert Xu wrote: > > That's why I think this patch is in fact the only one that > solves all the races in this thread. The case that it solves > which the lock/unlock patch does not is the one where action > flows downwards past the clearing of IRQ_INPROGRESS. I missed > this case earlier. > > In fact this bug exists elsewhere too. For example, the network > stack does this in net/sched/sch_generic.c: > > /* Wait for outstanding qdisc_run calls. */ > while (test_bit(__LINK_STATE_QDISC_RUNNING, &dev->state)) > yield(); > > This has the same problem as the current synchronize_irq code. The network stack always made be nervous with it's bitops use as locks. Any loop of test_bit() alone as a synchronisation method, without locks or barriers is, imho, inherently buggy. Ben.