From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932312AbWGIK5X (ORCPT ); Sun, 9 Jul 2006 06:57:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932440AbWGIK5W (ORCPT ); Sun, 9 Jul 2006 06:57:22 -0400 Received: from khc.piap.pl ([195.187.100.11]:56448 "EHLO khc.piap.pl") by vger.kernel.org with ESMTP id S932312AbWGIK5W (ORCPT ); Sun, 9 Jul 2006 06:57:22 -0400 To: Chase Venters Cc: "linux-os \\\\(Dick Johnson\\\\)" , Linus Torvalds , Ingo Molnar , Andrew Morton , Linux kernel , arjan@infradead.org Subject: Re: [patch] spinlocks: remove 'volatile' References: <20060705114630.GA3134@elte.hu> <200607080841.38235.chase.venters@clientec.com> <200607081541.07449.chase.venters@clientec.com> From: Krzysztof Halasa Date: Sun, 09 Jul 2006 12:57:19 +0200 In-Reply-To: <200607081541.07449.chase.venters@clientec.com> (Chase Venters's message of "Sat, 8 Jul 2006 15:40:44 -0500") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Chase Venters writes: >> Sure, but a barrier alone isn't enough. You have to use assembler and >> it's beyond scope of C volatile. > > Right, which is why volatile is wrong. In this case (and not only this). Of course. But not always. > You need the barrier for both the CPU and the compiler. For spinlocks, yes. For other things... Sometimes you need a barrier for the compiler only. Sometimes you don't need any general barrier, you only need to make sure a single variable isn't being cached (by the compiler). That's what volatile is for. Saying that volatile is always wrong looks to me like saying that goto is always wrong :-) And yes, there are people who say that every single goto in the universe is wrong. -- Krzysztof Halasa