* + ipc-semc-fix-complex_count-vs-simple-op-race-update.patch added to -mm tree
@ 2016-07-13 22:05 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2016-07-13 22:05 UTC (permalink / raw)
To: manfred, dave, mm-commits
The patch titled
Subject: ipc-semc-fix-complex_count-vs-simple-op-race-update
has been added to the -mm tree. Its filename is
ipc-semc-fix-complex_count-vs-simple-op-race-update.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/ipc-semc-fix-complex_count-vs-simple-op-race-update.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/ipc-semc-fix-complex_count-vs-simple-op-race-update.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Manfred Spraul <manfred@colorfullife.com>
Subject: ipc-semc-fix-complex_count-vs-simple-op-race-update
Link: http://lkml.kernel.org/r/1468386412-3608-2-git-send-email-manfred@colorfullife.com
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
ipc/sem.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff -puN ipc/sem.c~ipc-semc-fix-complex_count-vs-simple-op-race-update ipc/sem.c
--- a/ipc/sem.c~ipc-semc-fix-complex_count-vs-simple-op-race-update
+++ a/ipc/sem.c
@@ -291,6 +291,14 @@ static void complexmode_enter(struct sem
sem = sma->sem_base + i;
spin_unlock_wait(&sem->lock);
}
+ /*
+ * spin_unlock_wait() is not a memory barriers, it is only a
+ * control barrier. The code must pair with spin_unlock(&sem->lock),
+ * thus just the control barrier is insufficient.
+ *
+ * smp_rmb() is sufficient, as writes cannot pass the control barrier.
+ */
+ smp_rmb();
}
/*
@@ -346,7 +354,7 @@ static inline int sem_lock(struct sem_ar
/*
* Initial check for complex_mode. Just an optimization,
- * no locking.
+ * no locking, no memory barrier.
*/
if (!READ_ONCE(sma->complex_mode)) {
/*
@@ -361,7 +369,7 @@ static inline int sem_lock(struct sem_ar
*/
smp_mb();
- if (!READ_ONCE(sma->complex_mode)) {
+ if (!smp_load_acquire(&sma->complex_mode)) {
/* fast path successful! */
return sops->sem_num;
}
_
Patches currently in -mm which might be from manfred@colorfullife.com are
ipc-semc-fix-complex_count-vs-simple-op-race.patch
ipc-semc-fix-complex_count-vs-simple-op-race-update.patch
ipc-semc-remove-duplicated-memory-barriers.patch
ipc-sem-sem_lock-with-hysteresis.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-07-13 22:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-13 22:05 + ipc-semc-fix-complex_count-vs-simple-op-race-update.patch added to -mm tree akpm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).