From owner-cvs-src Mon Mar 10 10:13:37 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 C337837B404 for ; Mon, 10 Mar 2003 10:13:36 -0800 (PST) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id A19CD43FDD for ; Mon, 10 Mar 2003 10:13:35 -0800 (PST) (envelope-from nate@rootlabs.com) Received: (qmail 93788 invoked by uid 1000); 10 Mar 2003 18:13:36 -0000 Date: Mon, 10 Mar 2003 10:13:36 -0800 (PST) From: Nate Lawson To: Poul-Henning Kamp Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: cvs commit: src/sys/sys devicestat.h In-Reply-To: <2856.1047319447@critter.freebsd.dk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Mon, 10 Mar 2003, Poul-Henning Kamp wrote: > In message , Nate Lawson wri > tes: > >I'm unsure why two counters are required. One counter at the start of the > >structure is sufficient if you 1. memcpy the structure and then 2. re-read > >the counter int to make sure it is the same as the one covered by the > >memcpy. (This assumes memcpy can read an int atomically which should be > >true). Hmm, a volatile keyword may be necessary for the user-visible > >struct. > > Think two cpu system. > > One cpu doing the memcpy in userland while the other is updating the > data structure in the kernel. This changes nothing about my suggestion as long as you always update the sequence before changing the structure in the kernel. -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-src" in the body of the message