From owner-cvs-src Mon Mar 10 10:26: 4 2003 Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CD4E437B404 for ; Mon, 10 Mar 2003 10:26:02 -0800 (PST) Received: from mail.speakeasy.net (mail12.speakeasy.net [216.254.0.212]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A41D43FCB for ; Mon, 10 Mar 2003 10:26:01 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 26233 invoked from network); 10 Mar 2003 18:26:06 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail12.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 10 Mar 2003 18:26:06 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.6/8.12.6) with ESMTP id h2AIMQhT065609; Mon, 10 Mar 2003 13:22:26 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <2986.1047320558@critter.freebsd.dk> Date: Mon, 10 Mar 2003 13:26:17 -0500 (EST) From: John Baldwin To: Poul-Henning Kamp Subject: Re: cvs commit: src/sys/sys devicestat.h Cc: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, Nate Lawson Sender: owner-cvs-src@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 10-Mar-2003 Poul-Henning Kamp wrote: > In message , Nate Lawson wri > tes: > > Doesn't work: > > CPU0 (kernel) CPU1 (userland) > > increment seq > start copy > fiddle data > end copy > (copy is inconsistent) > > You need two sequence fields: > > CPU0 (kernel) CPU1 (userland) > > increment seq0 > start copy > fiddle data > end copy > increment seq1 > (seq0 != seq1 indicates inconcistent data) > > Notice that to make it absolutely water-tight, the seq fields must > be updated with appropriate write barriers and the order of the > fields must be the opposite as the direction the copy is performed in. Correct. If you use: atomic_add_acq_int(&seq0, 1); ... all the updates ... atomic_add_rel_int(&seq1, 1); then you should have sufficient membars. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-src" in the body of the message