Date: Mon, 10 Mar 2003 12:11:20 -0800 (PST) From: Nate Lawson <nate@root.org> To: Poul-Henning Kamp <phk@phk.freebsd.dk> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: cvs commit: src/sys/sys devicestat.h Message-ID: <Pine.BSF.4.21.0303101159120.93916-100000@root.org> In-Reply-To: <2986.1047320558@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 10 Mar 2003, Poul-Henning Kamp wrote: > In message <Pine.BSF.4.21.0303101009420.93727-100000@root.org>, 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: <Pine.BSF.4.21.0303100924470.93706-100000@root.org> > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0303101159120.93916-100000>