On 2025-12-17 20:45, Mathieu Desnoyers wrote:
[...]
+static inline
+void hazptr_note_context_switch(void)
+{
+       struct hazptr_ctx *ctx;
+
+       list_for_each_entry(ctx, &current->hazptr_ctx_list, preempt_node) {
+               struct hazptr_slot *slot;
+
+               if (hazptr_slot_is_backup(ctx, ctx->slot))
+                       continue;
+               slot = hazptr_chain_backup_slot(ctx);
+               /*
+                * Move hazard pointer from per-CPU slot to backup slot.
+                * This requires hazard pointer synchronize to iterate
+                * on per-CPU slots with load-acquire before iterating
+                * on the overflow list.
+                */
+               WRITE_ONCE(slot->addr, ctx->slot->addr);
+               /*
+                * store-release orders store to backup slot addr before
+                * store to per-CPU slot addr.
+                */
+               smp_store_release(&ctx->slot->addr, NULL);

I missed this:

+               /* Use the backup slot for context. */
+               ctx->slot = slot;

This triggered the hazptr_release WARN_ON_ONCE() within modified
refscale tests.

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com

Reply via email to