lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 14 Jun 2009 08:39:03 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
cc:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>,
	Theodore Tso <tytso@....edu>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Mathieu Desnoyers <compudj@...stal.dyndns.org>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	"Martin J. Bligh" <mbligh@...igh.org>,
	Christoph Hellwig <hch@...radead.org>,
	Li Zefan <lizf@...fujitsu.com>,
	Huang Ying <ying.huang@...el.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>,
	Masami Hiramatsu <mhiramat@...hat.com>
Subject: Re: [PATCH 3/3] ring-buffer: add design document


On Sun, 14 Jun 2009, Frederic Weisbecker wrote:
> > > > +
> > > > +Now the writer can update the head page. This is also why the head page must
> > > > +remain in UPDATE and only reset by the outer most writer. This prevents
> > > > +the reader from seeing the incorrect head page.
> > > > +
> > > > +
> > > > +(first writer)
> > > > +
> > > > +               A        B    tail page
> > > > +               |        |        |
> > > > +               v        v        v
> > > > +    +---+    +---+    +---+    +---+
> > > > +<---|   |--->|   |--->|   |--->|   |-H->
> > > > +--->|   |<---|   |<---|   |<---|   |<---
> > > > +    +---+    +---+    +---+    +---+
> > > 
> > > 
> > > Even more tricky!
> > > 
> > > I just have a stupid question: why can't this be done
> > > only through HEAD and NORMAL flags?
> > > 
> > > There is something certainly very obvious that I'm missing
> > > with the point of the UPDATE flag.
> > 
> > If you can demonstrate how to do the above lockless with just HEAD and 
> > NORMAL, then sure, I'm all ears ;-)
> > 
> > When we switch the HEAD to UPDATE, we stop the reader from moving forward 
> > and being another thing to handle while we move the HEAD forward. A reader 
> > does a cmpxchg to move the head too, and that cmpxchg will always fail if 
> > the pointer is has UPDATE set. The reader will just spin until it 
> > succeeds.
> 
> 
> Aah, so it's here to protect against paralell readers from another cpu
> reading the current cpu buffer, right?

Not readers, but reader. The reader side uses locks to serialize the
accesses. The writer side is lockless.  But it is here to protect the 
writers against a reader on another CPU.

-- Steve


> 
> 
> > Then, the rest of the moving of the header is just races with other 
> > writers that are always on the same CPU, and it becomes a recursive 
> > problem and not a parallel one.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ