summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmerdabbelt@google.com>2020-07-16 11:57:26 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-29 10:18:40 +0200
commit35728cac176a1cc1c57aa87a1e55e95a0ee3e985 (patch)
tree3188c3cd195c8715955b2423525127f43ce8a3b9
parent5345ede4acde4dc6ea54841917a8c671e39599da (diff)
downloadlinux-stable-35728cac176a1cc1c57aa87a1e55e95a0ee3e985.tar.gz
linux-stable-35728cac176a1cc1c57aa87a1e55e95a0ee3e985.tar.bz2
linux-stable-35728cac176a1cc1c57aa87a1e55e95a0ee3e985.zip
RISC-V: Upgrade smp_mb__after_spinlock() to iorw,iorw
[ Upstream commit 38b7c2a3ffb1fce8358ddc6006cfe5c038ff9963 ] While digging through the recent mmiowb preemption issue it came up that we aren't actually preventing IO from crossing a scheduling boundary. While it's a bit ugly to overload smp_mb__after_spinlock() with this behavior, it's what PowerPC is doing so there's some precedent. Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--arch/riscv/include/asm/barrier.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/riscv/include/asm/barrier.h b/arch/riscv/include/asm/barrier.h
index 3f1737f301cc..d0e24aaa2aa0 100644
--- a/arch/riscv/include/asm/barrier.h
+++ b/arch/riscv/include/asm/barrier.h
@@ -58,8 +58,16 @@ do { \
* The AQ/RL pair provides a RCpc critical section, but there's not really any
* way we can take advantage of that here because the ordering is only enforced
* on that one lock. Thus, we're just doing a full fence.
+ *
+ * Since we allow writeX to be called from preemptive regions we need at least
+ * an "o" in the predecessor set to ensure device writes are visible before the
+ * task is marked as available for scheduling on a new hart. While I don't see
+ * any concrete reason we need a full IO fence, it seems safer to just upgrade
+ * this in order to avoid any IO crossing a scheduling boundary. In both
+ * instances the scheduler pairs this with an mb(), so nothing is necessary on
+ * the new hart.
*/
-#define smp_mb__after_spinlock() RISCV_FENCE(rw,rw)
+#define smp_mb__after_spinlock() RISCV_FENCE(iorw,iorw)
#include <asm-generic/barrier.h>