From owner-freebsd-hackers@FreeBSD.ORG Fri Sep 25 14:40:29 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E0DE1065696; Fri, 25 Sep 2009 14:40:29 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id 4BA6D8FC12; Fri, 25 Sep 2009 14:40:29 +0000 (UTC) Received: from [192.168.1.4] (adsl-241-169-177.bna.bellsouth.net [74.241.169.177]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n8PEePK9026290 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 25 Sep 2009 10:40:26 -0400 (EDT) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: Ryan Stone In-Reply-To: References: <20090924224935.GW473@gandalf.sssup.it> <1253877997.2031.2627.camel@balrog.2hip.net> Content-Type: text/plain Organization: FreeBSD Date: Fri, 25 Sep 2009 09:40:20 -0500 Message-Id: <1253889620.2065.12.camel@balrog.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL, RDNS_DYNAMIC,SPF_SOFTFAIL autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: attilio@freebsd.org, hackers@freebsd.org, Fabio Checconi Subject: Re: sx locks and memory barriers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Sep 2009 14:40:29 -0000 On Fri, 2009-09-25 at 09:30 -0400, Ryan Stone wrote: > The code that Fabio proposes looks like this: > > sx_slock(&data->lock); > if (data->buffer) > a = *data->buffer; > sx_sunlock(&data->lock); > > > This point is that without a memory barrier on the unlock, the CPU is > free to reorder the instructions into the order is his message. Ok, then I will sit back and wait for someone with more clue to respond... robert. -- Robert Noland FreeBSD