From owner-freebsd-threads@FreeBSD.ORG Mon Apr 23 09:32:25 2012 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF931106566C for ; Mon, 23 Apr 2012 09:32:25 +0000 (UTC) (envelope-from yfw.bsd@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 940708FC08 for ; Mon, 23 Apr 2012 09:32:25 +0000 (UTC) Received: by obqv19 with SMTP id v19so17683500obq.13 for ; Mon, 23 Apr 2012 02:32:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=f1iNjodDdC9J9l+h0oKfo/K2Q5EB9PJfvR15auz99UI=; b=YcbcKgZ1T25m6hAFhmKeM4ZAXT+r/um7yHhVi3uXwAGHTNBTRcAukRsvh9W3ubZsDO ywaxXdsJrLQJSXDyDliworBZ238Nquz8xKUrFJgnhwBOPz5kePMGGxND82ttVY/xQmc6 137vtZSLvFgxw4U7eaWTZk7NgB5DynEpE66OZ9ZBOpWIPG1T8hq8eKe2BYld+CDNVw3x dMT2NgrI1k74znYSWegKjOr5BAXCXzam7rINBUYn+AaYKt3GLFpFN9kxjSxC4fMzTB51 zSAds8uKvSYwHEqFwSyh2bVNA/i/Rhpv6AMvve8d8NVwrXc4A3XoV+4ecYChDHQMrbW6 A53Q== MIME-Version: 1.0 Received: by 10.60.29.39 with SMTP id g7mr2407884oeh.6.1335173544900; Mon, 23 Apr 2012 02:32:24 -0700 (PDT) Received: by 10.60.125.135 with HTTP; Mon, 23 Apr 2012 02:32:24 -0700 (PDT) In-Reply-To: <20120423084120.GD76983@zxy.spb.ru> References: <20120423084120.GD76983@zxy.spb.ru> Date: Mon, 23 Apr 2012 17:32:24 +0800 Message-ID: From: Fengwei yin To: Slawa Olhovchenkov Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: jack.ren@intel.com, freebsd-threads@freebsd.org Subject: Re: About the memory barrier in BSD libc X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Apr 2012 09:32:25 -0000 On Mon, Apr 23, 2012 at 4:41 PM, Slawa Olhovchenkov wrote: > On Mon, Apr 23, 2012 at 02:56:03PM +0800, Fengwei yin wrote: > >> Hi list, >> If this is not correct question on the list, please let me know and >> sorry for noise. >> >> I have a question regarding the BSD libc for SMP arch. I didn't see >> memory barrier used in libc. >> How can we make sure it's safe on SMP arch? > > /usr/include/machine/atomic.h: > > #define mb() =A0 =A0__asm __volatile("lock; addl $0,(%%esp)" : : : "memor= y") > #define wmb() =A0 __asm __volatile("lock; addl $0,(%%esp)" : : : "memory"= ) > #define rmb() =A0 __asm __volatile("lock; addl $0,(%%esp)" : : : "memory"= ) > Thanks for the information. But it looks no body use it in libc.