Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751206AbWCaDhO (ORCPT ); Thu, 30 Mar 2006 22:37:14 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751195AbWCaDhO (ORCPT ); Thu, 30 Mar 2006 22:37:14 -0500 Received: from mga02.intel.com ([134.134.136.20]:53533 "EHLO orsmga101-1.jf.intel.com") by vger.kernel.org with ESMTP id S1750807AbWCaDhM (ORCPT ); Thu, 30 Mar 2006 22:37:12 -0500 X-IronPort-AV: i="4.03,148,1141632000"; d="scan'208"; a="17481936:sNHT16373931" Message-Id: <200603310337.k2V3bBg28685@unix-os.sc.intel.com> From: "Chen, Kenneth W" To: "'Christoph Lameter'" Cc: "Nick Piggin" , "Zoltan Menyhart" , "Boehm, Hans" , "Grundler, Grant G" , , , Subject: RE: Synchronizing Bit operations V2 Date: Thu, 30 Mar 2006 19:37:55 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Thread-Index: AcZUchpVFVS0eYazRlSJziSZx+yhowAAc5qg In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2091 Lines: 54 Christoph Lameter wrote on Thursday, March 30, 2006 7:21 PM > > > What of it? Release semantics are not a full fence or memory barrier. > > > > The API did not require a full fence. It is defined as a one way fence. > > Well that explains our misunderstanding. > > The issue with all these hacky macros is that they all have their own > semantics and do not work in a consistent way. More reason to make that > explicit. > > Where may I find that definition? > > Documentation/atomic_ops.txt implies a complete barrier and gives > an example of the use of these macros in order to obtain release > semantics. AFAIK that does not mean that this is the intended complete > behavior of a "memory barrier": > > > > > If a caller requires memory barrier semantics around an atomic_t > operation which does not return a value, a set of interfaces are > defined which accomplish this: > > void smp_mb__before_atomic_dec(void); > void smp_mb__after_atomic_dec(void); > void smp_mb__before_atomic_inc(void); > void smp_mb__after_atomic_dec(void); > > For example, smp_mb__before_atomic_dec() can be used like so: > > obj->dead = 1; > smp_mb__before_atomic_dec(); > atomic_dec(&obj->ref_count); > > It makes sure that all memory operations preceeding the atomic_dec() > call are strongly ordered with respect to the atomic counter > operation. In the above example, it guarentees that the assignment of > "1" to obj->dead will be globally visible to other cpus before the > atomic counter decrement. It means we need an complete overhaul of smp_mb__before/after_*. The name and its implied memory order semantics is not consistent and it leads to all kinds of confusion and probably improper usage. I'm all for making atomic bit op to have explicit ordering mode in them. - Ken - 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/