Messages in this thread | | | Date | Tue, 9 Apr 2013 07:32:42 -0700 | Subject | Re: [PATCH] [PATCH] Gaurantee spinlocks implicit barrier for !PREEMPT_COUNT | From | Linus Torvalds <> |
| |
On Mon, Apr 8, 2013 at 8:07 AM, Linus Torvalds <torvalds@linux-foundation.org> wrote: > On Mon, Apr 8, 2013 at 7:59 AM, Steven Rostedt <srostedt@redhat.com> wrote: >>> +/* This is only a barrier to other asms. Notably get_user/put_user */ >> >> Probably should add in the comment: >> >> " or anything else that can cause a hidden schedule. " >> > > Fair enough. And I just remembered why I thought UP was special - we > need to do the same thing about spinlocks, for the same reasons. > > So that "asm_barrier()" should probably be in <linux/compiler.h> along > with the "normal" barrier() definition. >
I'm a moron.
Yes, "asm_barrier()" is a valid barrier for asms. But without the "memory" clobber, it doesn't actually end up being a barrier to any normal C loads and stores from memory, so it doesn't actually help.
So I suspect we need to just make UP spinlocks and preemption enable/disable be full compiler barriers after all.
Something like the attached (still untested, although it seems to at least compile) patch. Comments?
Linus [unhandled content-type:application/octet-stream] | |