lkml.org 
[lkml]   [2012]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 0/2] irq_work: A couple fixes
From
Date
On Tue, 2012-10-30 at 16:34 +0100, Frederic Weisbecker wrote:
> Hi,

> And I still wonder if cpu_relax() is enough to prevent the compiler
> from correctly reloading work->flags in irq_work_sync() loop.
> Do we need ACCESS_ONCE()?

You mean this loop:

flags = work->flags & ~IRQ_WORK_PENDING;
for (;;) {
nflags = flags | IRQ_WORK_FLAGS;
oflags = cmpxchg(&work->flags, flags, nflags);
if (oflags == flags)
break;
if (oflags & IRQ_WORK_PENDING)
return false;
flags = oflags;
cpu_relax();
}

After the first loading of work->flags, you are worried about the
&work->flags in the cmpxchg()? The cmpxchg() will handle that itself. I
don't see any place that a ACCESS_ONCE() is required here. The cmpxchg()
acts on the address of work->flags, the compiler isn't involved with the
value at that address.

-- Steve




\
 
 \ /
  Last update: 2012-11-01 17:21    [W:0.113 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site