Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757074AbXEIKZ4 (ORCPT ); Wed, 9 May 2007 06:25:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755121AbXEIKZr (ORCPT ); Wed, 9 May 2007 06:25:47 -0400 Received: from smtp-out.google.com ([216.239.45.13]:34316 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755024AbXEIKZq (ORCPT ); Wed, 9 May 2007 06:25:46 -0400 DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=received:date:from:x-x-sender:to:cc:subject:in-reply-to: message-id:references:mime-version:content-type; b=TmYj8Q8ImiI1IhWLMOyDKwU6sasr9gEK98eXbUZ1knJFgWxg4qT7jov9jDSy1sZPz /jEqsfMUYNpQOtLME5a6A== Date: Wed, 9 May 2007 03:25:06 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Alan Cox cc: Randy Dunlap , Satyam Sharma , Andrew Morton , Paul Sokolovsky , linux-kernel@vger.kernel.org, jeremy@goop.org Subject: Re: [PATCH] doc: volatile considered evil In-Reply-To: <20070509102134.5d722386@the-village.bc.nu> Message-ID: References: <516386418.20070501080839@gmail.com> <20070430235642.e576e917.akpm@linux-foundation.org> <20070508121404.17bd97a6.randy.dunlap@oracle.com> <20070508163452.8b71f682.randy.dunlap@oracle.com> <20070508190800.1334b968.randy.dunlap@oracle.com> <20070509102134.5d722386@the-village.bc.nu> 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 Content-Length: 1531 Lines: 34 On Wed, 9 May 2007, Alan Cox wrote: > When Might You Need volatile ? > ------------------------------ > > When you are implementing the locking primitives on a new platform. When > you are implementing the I/O and atomic prmitives on a new platform. Also > in inline gcc assembler where "volatile" is used for subtly different > purposes. > What is determined to be an "access" (read or modify) to an object such as a locking primitive that is type-qualified with the keyword 'volatile' is implementation defined. You cannot guarantee that the value in such an object would agree with the evaluation thus far as specified by the semantics of the code even at sequence points because such an object can be modified without knowledge to the implementation. The only thing you _can_ guarantee at these sequence points is that their previous accesses are complete and later accesses, as specified by the semantics of the code, have not yet occurred. This does not exclude the possibility that they were modified without knowledge to the implementation. In this case, the actual and abstract semantics of the text may not agree. Thus, any reliance on type-qualifying an object that represents an atomic or locking primitive on the keyword 'volatile' is misplaced. David - 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/