This message generated a parse failure. Raw output follows here. Please use 'back' to navigate. From devnull@lkml.org Thu Jun 13 07:39:44 2024 Delivery-date: Thu, 06 Jul 2006 12:30:30 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1030230AbWGFM35 (ORCPT ); Thu, 6 Jul 2006 08:29:57 -0400 Received: from odyssey.analogic.com ([204.178.40.5]:65298 "EHLO odyssey.analogic.com") by vger.kernel.org with ESMTP id S1030229AbWGFM34 convert rfc822-to-8bit (ORCPT ); Thu, 6 Jul 2006 08:29:56 -0400 Received: from chaos.analogic.com ([10.112.50.11]) by phoenix.analogic.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 6 Jul 2006 08:29:55 -0400 Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Received: from chaos.analogic.com (localhost [127.0.0.1]) by chaos.analogic.com (8.12.11/8.12.11) with ESMTP id k66CTtab008384; Thu, 6 Jul 2006 08:29:55 -0400 Received: (from linux-os@localhost) by chaos.analogic.com (8.12.11/8.12.11/Submit) id k66CTtqu008383; Thu, 6 Jul 2006 08:29:55 -0400 X-OriginalArrivalTime: 06 Jul 2006 12:29:55.0221 (UTC) FILETIME=[E2FC9C50:01C6A0F7] content-class: urn:content-classes:message Subject: Re: [patch] spinlocks: remove 'volatile' Date: Thu, 6 Jul 2006 08:29:55 -0400 Message-Id: In-Reply-To: <1152187268.3084.29.camel@laptopd505.fenrus.org> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [patch] spinlocks: remove 'volatile' Thread-Index: Acag9+MG6p41tfWPT5aj2a7d6bU04Q== References: <20060705114630.GA3134@elte.hu> <20060705101059.66a762bf.akpm@osdl.org> <20060705193551.GA13070@elte.hu> <20060705131824.52fa20ec.akpm@osdl.org> <20060705204727.GA16615@elte.hu> To: "Arjan van de Ven" Cc: "Ingo Molnar" , "Linus Torvalds" , "Andrew Morton" , Reply-To: "linux-os \(Dick Johnson\)" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Jul 2006, Arjan van de Ven wrote: > On Thu, 2006-07-06 at 07:59 -0400, linux-os (Dick Johnson) wrote: >> On Thu, 6 Jul 2006, Ingo Molnar wrote: >> >>> >>> * Linus Torvalds wrote: >>> >>>> I wonder if we should remove the "volatile". There really isn't >>>> anything _good_ that gcc can do with it, but we've seen gcc code >>>> generation do stupid things before just because "volatile" seems to >>>> just disable even proper normal working. >> >> Then GCC must be fixed. The keyword volatile is correct. It should >> force the compiler to read the variable every time it's used. > > this is not really what the C standard says. > > > >> This is not pointless. If GCC generates bad code, tell the >> GCC people. The volatile keyword is essential. > > no the "volatile" semantics are vague, trecherous and evil. It's a LOT > better to insert the well defined "barrier()" in the right places. Look at: http://en.wikipedia.org/wiki/Volatile_variable This is just what is needed to prevent the compiler from making non working code during optimization. Also look at: http://en.wikipedia.org/wiki/Memory_barrier This is used to prevent out-of-order execution, not at all what is necessary. Also, just because it 'works' means nothing. When SMP processors came about, we had many drivers with no spin-locks at all. Sometimes some files had a byte or two changed. That was the only obvious problem. If this had continued, the entire file system would be trashed, but fortunately we learned about spin-locks and the volatile keyword. You must not destroy the spin locks by removing the volatile keyword. Cheers, Dick Johnson Penguin : Linux version 2.6.16.4 on an i686 machine (5592.88 BogoMips). New book: http://www.AbominableFirebug.com/ _  **************************************************************** The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them. Thank you. - 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/