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:	Sat, 13 Mar 2010 10:26:15 +0100
From:	Stefan Richter <stefanr@...6.in-berlin.de>
To:	David Howells <dhowells@...hat.com>
CC:	torvalds@...l.org, akpm@...ux-foundation.org, sgruszka@...hat.com,
	davem@...emloft.net, linux-kernel@...r.kernel.org,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Randy Dunlap <rdunlap@...otime.net>
Subject: Re: [PATCH] Document Linux's circular buffering capabilities

David Howells wrote:
> Stefan Richter <stefanr@...6.in-berlin.de> wrote:
>> "...do this" could be misunderstood as "use a modulus instruction",
...
> How about:
> 
> 	Calculation of the occupancy or the remaining capacity of an
> 	arbitrarily sized circular buffer would normally be a slow operation,
> 	requiring the use of a modulus (divide) instruction.  However, if the
> 	buffer is of a power-of-2 size,
[...]

Yep.

>> I don't understand why ACCESS_ONCE is needed here.  The CIRC_SPACE and
>> CIRC_CNT macros do not look at head and tail more than once.
> 
> In this example they don't, but say someone wants to read several elements
> from the buffer, they might end up accessing their copy of head several times.

Would you agree to add a quick note that these examples are simple
enough to not strictly require ACCESS_ONCE but are meant to show what
more general code would have to do?  Else a reader might be left puzzled
why he can't see in the example code the circumstances which require
ACCESS_ONCE and may remain unsure about where to use it in his own works...

(BTW, good that I came across your documentation posting.  This twist
with possibly multiple loads was not apparent to me too.  I am going to
have to have another look at some driver code with this in mind...)
-- 
Stefan Richter
-=====-==-=- --== -==-=
http://arcgraph.de/sr/
--
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