From owner-cvs-src Mon Mar 10 12:11:22 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 31D1C37B401 for ; Mon, 10 Mar 2003 12:11:21 -0800 (PST) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id C429243F75 for ; Mon, 10 Mar 2003 12:11:19 -0800 (PST) (envelope-from nate@rootlabs.com) Received: (qmail 94003 invoked by uid 1000); 10 Mar 2003 20:11:20 -0000 Date: Mon, 10 Mar 2003 12:11:20 -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: <2986.1047320558@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: > > Doesn't work: > > CPU0 (kernel) CPU1 (userland) > > increment seq > start copy > fiddle data > end copy > (copy is inconsistent) Please see my original message, including the code fragment. You neglected the final step which was: (userland) check localbuf->seq == kernbuf->seq Of course leaving out steps of my approach breaks it. :) Msg: > 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. Agree but with one sequence checked twice (pulled in as first part of memcpy, explicitly checked again after the copy is complete) you get this for free without worrying about the order of updating two sequences. The only downside to my approach is that it could mark data as invalid if the seq is updated between the memcpy and the seq check. But it will never mark invalid data as valid. > I may not think it worth going to that effort for io stats. ken@ should probably have the final say with what goes for devicestat. It doesn't seem like you are interested in considering alternate approaches and it is such a small area that I don't feel like debating it endlessly. -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-src" in the body of the message