- /* Read reader_gp before read futex */
- smp_mb_heavy();
- if (uatomic_read(&gp_futex) == -1)
- futex_async(&gp_futex, FUTEX_WAIT, -1,
- NULL, NULL, 0);
+ /*
+ * Read reader_gp before read futex. smp_mb_master() needs to
+ * be called with the rcu registry lock held in RCU_SIGNAL
+ * flavor.
+ */
+ smp_mb_master(RCU_MB_GROUP);
+ /* Temporarily unlock the registry lock. */
+ mutex_unlock(&rcu_registry_lock);
+ if (uatomic_read(&rcu_gp.futex) != -1)
+ goto end;
+ while (futex_async(&rcu_gp.futex, FUTEX_WAIT, -1,
+ NULL, NULL, 0)) {
+ switch (errno) {
+ case EWOULDBLOCK:
+ /* Value already changed. */
+ goto end;
+ case EINTR:
+ /* Retry if interrupted by signal. */
+ break; /* Get out of switch. */
+ default:
+ /* Unexpected error. */
+ urcu_die(errno);
+ }
+ }
+end:
+ /*
+ * Re-lock the registry lock before the next loop.
+ */
+ mutex_lock(&rcu_registry_lock);