[PATCH 28/28] Documentation/litmus-tests: Add hazptr bloom wildcard-hole test

From: Kunwu Chan

Date: Wed Nov 04 2026 - 12:08:34 EST


Test the wildcard-deferral of the shared-scan Bloom walk: a
slow-path acquire that published a wildcard to an overflow-list
slot cannot be missed by the kthread's post-wildcard slot read.
Verified with herd7: Never 0 6.

Signed-off-by: Kunwu Chan <kunwu.chan@xxxxxxxxx>
---
Documentation/litmus-tests/README | 7 +++
.../hazptr/hazptr-bloom-wildcard-hole.litmus | 49 +++++++++++++++++++
2 files changed, 56 insertions(+)
create mode 100644 Documentation/litmus-tests/hazptr/hazptr-bloom-wildcard-hole.litmus

diff --git a/Documentation/litmus-tests/README b/Documentation/litmus-tests/README
index 79b0634ddb13..561319404126 100644
--- a/Documentation/litmus-tests/README
+++ b/Documentation/litmus-tests/README
@@ -111,6 +111,7 @@ hazptr-wildcard-flip-escape.litmus
scan: a straggling acquire that published the old wildcard after
the final walk cannot still load the unpublished object.

+
hazptr-drain-engage-wildcard.litmus
Test the drain engage's wildcard defer: an engage that reads a
slot holding a wildcard (an in-flight slow-path acquire) must
@@ -127,3 +128,9 @@ hazptr-drain-safety.litmus
hazptr-drain-generation-visibility.litmus
Test the drain generation ordering: a release hook that observes
the new drain address also observes the new generation.
+
+hazptr-bloom-wildcard-hole.litmus
+ Test the wildcard-deferral of the shared-scan Bloom walk: a
+ slow-path acquire that published a wildcard to an overflow-list
+ slot cannot be missed by the kthread's post-wildcard slot read
+ (completion is deferred until the wildcard resolves).
diff --git a/Documentation/litmus-tests/hazptr/hazptr-bloom-wildcard-hole.litmus b/Documentation/litmus-tests/hazptr/hazptr-bloom-wildcard-hole.litmus
new file mode 100644
index 000000000000..28a2bc1206c7
--- /dev/null
+++ b/Documentation/litmus-tests/hazptr/hazptr-bloom-wildcard-hole.litmus
@@ -0,0 +1,49 @@
+C hazptr-bloom-wildcard-hole
+
+(*
+ * Result: Never
+ *
+ * Wildcard handling in the shared-scan Bloom walk: a slow-path
+ * acquire publishes HAZPTR_WILDCARD (Store B) to an overflow-list
+ * slot before loading the target pointer (Load A) and publishing the
+ * real address (Store C). The scan kthread observes the wildcard
+ * (r2=2, its walk loop keeps waiting) and defers completion
+ * decisions; the model captures the final post-wildcard slot read
+ * (r0) that gates completion.
+ *
+ * P0 models the kthread's post-wildcard read: it must not complete
+ * the waiter based on a slot value observed before the reader's
+ * Load A. P1 is the slow-path reader.
+ *
+ * Question: can the kthread's post-wildcard slot read (r0) miss the
+ * reader's Store C while the reader's Load A still saw the old
+ * pointer (1:r1=1)? The smp_mb() between Store B and Load A, paired
+ * with the kthread waiting out the wildcard before its final
+ * load-acquire, forbids it: Never.
+ *)
+
+{
+ slot = 2;
+ head = 1;
+}
+
+P0(int *slot, int *head) /* scan kthread */
+{
+ int r0;
+ int r2;
+
+ r2 = smp_load_acquire(slot); /* walk sees wildcard... */
+ r0 = smp_load_acquire(slot); /* ...waits, reads again */
+}
+
+P1(int *slot, int *head) /* slow-path reader */
+{
+ int r1;
+
+ WRITE_ONCE(*slot, 2); /* Store B: wildcard */
+ smp_mb();
+ r1 = READ_ONCE(*head); /* Load A */
+ WRITE_ONCE(*slot, 1); /* Store C: real address */
+}
+
+exists (0:r0=0 /\ 0:r2=2 /\ 1:r1=1)
--
2.43.0