man/io_uring_setup.2: improve SQPOLL wakeup example
This makes it consistent with how liburing uses it, instead of using
the sledge hammer that is a fully SMP memory barrier on archs that
don't need it.
Reported-by: Joran Dirk Greef
@@ -97,11 +97,14 @@ call with the following code sequence:
.in +4n
.EX
/*
- * Ensure that the wakeup flag is read after the tail pointer has been
- * written.
+ * Ensure that the wakeup flag is read after the tail pointer
+ * has been written. It's important to use memory load acquire
+ * semantics for the flags read, as otherwise the application
+ * and the kernel might not agree on the consistency of the
+ * wakeup flag.
*/
-smp_mb();
-if (*sq_ring->flags & IORING_SQ_NEED_WAKEUP)
+unsigned flags = atomic_load_relaxed(sq_ring->flags);
+if (flags & IORING_SQ_NEED_WAKEUP)
io_uring_enter(fd, 0, 0, IORING_ENTER_SQ_WAKEUP);
.EE
.in
