lkml.org 
[lkml]   [2011]   [Dec]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: irqsafe_cpu_...() 64-bit operations on 32-bit platform
On Fri, 23 Dec 2011, Jan Beulich wrote:

> you introduced these for 2.6.33, but I wonder about their completeness

> in the current state: On ix86, I can add, sub, xor, etc a 64-bit variable
> this way (through the generic implementation), but there's no way to
> read or write such a variable. While not documented explicitly, it seems
> like the assumption is that this_cpu_{read,write}() can be used for this
> purpose, but that's clearly wrong.

Hmmm... We could add those but then you would usually not assign the
initial values in a situation where concurrency is an issue. Typically you would have
a loop over all possible cpus and then simply do a 64 bit assign to the 64
bit values address determined via per_cpu_ptr().

And yes reading could be an issue if you have concurrent updates ongoing.

However, if you are using a loop to sum up all counters from every
processor then you cannot use the this_cpu ops but would have to use
something like get_64(). Reliably reading a 64 bit value on 32 bit may
strangely require a write operation via cmpxchg8b.




\
 
 \ /
  Last update: 2011-12-23 16:17    [W:0.239 / U:0.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site