[fedora-arm] ARMv5 and atomic operations

Andrew Haley aph at redhat.com
Tue Apr 24 16:59:36 UTC 2012


On 04/24/2012 05:40 PM, Nicolas Pitre wrote:
> On Tue, 24 Apr 2012, Andrew Haley wrote:
> 
>> On 04/24/2012 05:18 PM, Jon Masters wrote:
>>> I wasn't going to reply yet just due to lack of time and because Nico
>>> covered the kernel helper stuff so well in his earlier posts. But just
>>> to add, these kernel helpers have grown a little over time in higher
>>> kernel revisions, but there is a mechanism to discover the revision
>>> available (note: these are not VDSO but if it helps folks understand
>>> them, think of them like that). They are the right way to solve the
>>> atomics problem as best as we can for older devices. I believe the
>>> correct thing to do is to get broken upstream projects to adopt generic
>>> non-reimplemented-of-their-own routines that will transparently use the
>>> kernel helpers if needed.
>>
>> But is that going to help me?  Let's say I'm on an ARMv5 and need to
>> do a longword operation.  I can either use a lightweight spinlock or
>> take the hit of a system call to do the cmpxchg8 operation.  Am I
>> really better off going into the kernel to do that?
> 
> Absolutely!  Because the kernel cmpxchg8 routine is _not_ a system call.  
> and it is going to be lighter than your custom solution with a lock.

Okay, I think I see your point: you're going to use ldm/stm in the
handler and detect an interrupt, then restart if necessary.  Right,
that may well be worth doing.  I'll still need the locking fallback
for old kernels, though.

Andrew.


More information about the arm mailing list