[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1112230908550.1691@router.home>
Date: Fri, 23 Dec 2011 09:13:57 -0600 (CST)
From: Christoph Lameter <cl@...ux.com>
To: Jan Beulich <JBeulich@...e.com>
cc: mingo@...e.hu, linux-kernel@...r.kernel.org
Subject: Re: 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.
--
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