Repository navigation
Retry the kyber write while a sibling disk switches scheduler - #18228
IronsideXXVI wants to merge 3 commits into
Conversation
Since Linux 7.2 (4ff58d6bc9dd, "block: serialize elevator changes for the same queue using a writer lock", on top of ce8ee8583ed8's trylock), a write to queue/scheduler takes its tag set's update_nr_hwq_lock as a writer with a trylock and returns EBUSY when another switch on the same tag set is running. Every namespace of an NVMe controller shares one tag set, as do the LUNs of a USB card reader, and udev handles sibling disks in parallel workers and never retries an ATTR write. So all but one of them keep the kernel's pick. On Apple Silicon Macs that is every boot: the controller exposes three namespaces (the system disk plus two small Apple ones), all three race, and one wins. An M4 MacBook Pro logged EBUSY for two of the three on each of six boots, and the system disk, nvme0n1, stayed on mq-deadline in four of them. Write from RUN instead and retry for up to two seconds, the way blktests handles the same EBUSY. RUN runs after every rule, so zoned disks are left out here: 64-btrfs-zoned.rules moves zoned btrfs back to mq-deadline, and a later kyber write must not undo that. Refs omacom#17500 Signed-off-by: Dylan Ironside <dylan@dylanironside.io> Assisted-by: Claude:claude-opus-5.5
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge, with no new actionable findings. SummaryThe PR retries busy scheduler writes before leaving a disk on its current scheduler.
Reviews (3) · Last reviewed commit: "Note that the kyber EBUSY race affects L..." · Reviewed by Greptile |
What the J604 runs now: kernel 1.848, mesa-aurora and vulkan-aurora 1.8139 (the 1.8134 content, rebuilt so the repository matches what is installed after a rollback), omarchy-dev 1.3 (the 1.1 content), stock Hyprland. The mesa T8132 patch drops a trailer line; its change is the same. UPSTREAM.md: the new heads of aurora-silicon/linux#1494, #1495 and #1496 (now with Dylan's Signed-off-by), omacom/omarchy#18582 and omacom/omarchy-mac-pkgs#134. omacom/omarchy#18228 is a live release item again: on 1.848 two NVMe namespaces fall back to mq-deadline on every boot.
|
GPT-6 in Codex read the diff, the current Verification stopped at that classification gate: no worker tests ran, no fix was pushed, and no class or verification labels were applied. The review service passed its availability check, but no second code review was requested. This needs a maintainer to resolve classification before verification continues. |
|
For the classification: this is a compatibility fix, as the first read said. It changes nothing for a machine with one disk per tag set. It only matters where sibling disks share a tag set, like the three NVMe namespaces on Apple Silicon Macs or the LUNs of a USB card reader (#17500), on Linux 7.2 and later. I re-checked it today against current |
|
Some on-device numbers for this, from an M4 MacBook Pro (three NVMe namespaces sharing one tag set) on Linux 7.3 with the current rule, no retry:
Without the retry, which scheduler each namespace gets changes from boot to boot. |
|
Follow-up with the retry rule installed (the rule file from this PR head, byte for byte; same M4 MacBook Pro, Linux 7.3):
Before the retry, the same machine came up with two of the three namespaces on mq-deadline after a fresh boot. With it, every boot gives the same result. |
Let the retry command create the scheduler file after the placeholder directory is removed. A separate truncation can run after a successful retry and erase kyber before the assertion reads it. Co-Authored-By: GPT-6 <noreply@openai.com> Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
|
GPT-6 in Codex (effort setting not exposed), Opus 5.5 High and muse-wonder via pi (thinking high) reviewed this change. Opus found a race in the test: the background job could truncate a successful On a disposable Omarchy worker running kernel 7.2.15, I reproduced the scheduler failure through real udev change events and sysfs on 16 SCSI test-driver LUNs with a shared tag set:
The base failures logged EBUSY. #17516 adds a complementary empty-disk guard; the two changes touch the same rule line. Deferring the write to |
|
For context: on Apple Silicon NVMe (sibling namespaces sharing one tag set) this EBUSY comes from a kernel regression in 7.2 (4ff58d6bc9dd) that is fixed upstream by 603523fd5466 ("block: only serialize elevator switches of the same queue"). The first stable release with it is 7.3.5 (e68b22b51c60). After the fix, switches on sibling queues no longer block each other; writes that race with the same queue, an nr_hw_queues update, an nr_requests write or disk removal can still get EBUSY. So the retry still helps on kernels without the fix, such as linux-aurora 7.3.0.aurora1-48, where I see 2 of 3 namespaces fail each boot on a MacBook Pro 14" M4 Pro. Kernel-side report: aurora-silicon/linux#3899. |
|
GPT-6.2 Sol High in Codex checked the Linux changelog, Omarchy’s package indexes and the earlier worker results. Linux 7.3.5 includes Opus 5.5 High and muse-wonder via pi (thinking high) agreed on the kernel and package evidence, with independence unconfirmed. Both flagged that the rule’s “since Linux 7.2” wording now needs to specify kernels without the fix. The earlier worker verification still applies to |
Clarify the rule and test comments to note that the sibling tag-set EBUSY race applies to Linux 7.2 and later kernels without commit 603523fd5466 (backported in Linux 7.3.5 as e68b22b51c60). Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
|
Updated the rule and test comments in |
|
Recommend: Hold — the Tests workflow needs maintainer approval, and the maintainer needs to decide whether to carry the retry while affected kernels still ship. Tests workflow On Omarchy stable kernel 7.2.15-4, 1 of 16 shared-tag-set test disks selected Kyber with the stock rule, 16 of 16 with GPT-6 High in Codex, Opus 5.5 High and muse-wonder via pi (thinking high) agreed that the updated comments describe the upstream fix correctly and found no new code defect. Independence of that agreement is unconfirmed. Please give the PR description the same qualification about kernels that lack the upstream fix. Linux 7.3.5 changelog |
|
Updated the PR description to clarify that the sibling tag-set |
|
Recommend: Hold — the maintainer needs to approve the Tests workflow and decide whether to carry the retry while affected kernels still ship. Tests workflow The updated description names the upstream fix for the sibling-queue race. GPT-6.2 Sol High in Codex, Opus 5.5 High and muse-wonder via pi (thinking high) checked that clarification and the existing ISO-worker evidence for the unchanged head. Opus also flagged that udev runs the Kyber write after processing all rules, so it can overwrite a scheduler set by a later local |
What changes
On Linux 7.2 (4ff58d6bc9dd on top of ce8ee8583ed8) and later kernels without commit
603523fd5466("block: only serialize elevator switches of the same queue", backported in Linux 7.3.5 ase68b22b51c60), a write toqueue/schedulerreturns EBUSY while another scheduler switch is running on the same tag set, instead of waiting. All namespaces of an NVMe controller share one tag set, and so do the LUNs of a USB card reader. udev handles sibling disks in parallel and never retries anATTRwrite, so all but one of them keep the kernel's pick.On Apple Silicon Macs this happens on every boot: the controller exposes three namespaces (the system disk and two small Apple ones), all three race, and one wins.
60-omarchy-io-scheduler.rulesnow writes fromRUNand retries for up to two seconds, the way blktests handles the same EBUSY.RUNruns after every rule, so zoned disks are left out of this rule: 64-btrfs-zoned.rules moves zoned btrfs disks back to mq-deadline, and a later kyber write must not undo that.Refs #17500, which reports the same EBUSY on empty USB card readers. #17516 skips zero-size disks for that case and notes that a busy queue on a disk with media "would need a retry mechanism udev rules do not have". This is that retry. It covers the card readers too, and it does not conflict with #17516's intent:
ATTR{size}!="0"can sit on this line as well, so whichever merges first, the other rebases with a one-line change.Verification
bash test/shell.d/io-scheduler-rule-test.shpasses on this branch and fails on quattro (cbd0029) with "the kyber write runs from RUN, so a busy queue is not the last attempt".RUNcommand against a scratch disk whosequeue/schedulerrefuses writes, like a busy queue, until a background job frees it after 0.5 s.udevadm verify(systemd 255) accepts the rule file on quattro and on this branch.omarchy-settings4.5.0-3 and linux-aurora 7.2.11 (it still happens on the edge channel,omarchy-settings-dev4.0.0.r7634.gcbd0029: after a fresh boot nvme0n1 and nvme0n3 stay on mq-deadline and only nvme0n2 gets kyber):nvme0n1(the system disk) andnvme0n2are onmq-deadline, andnvme0n3is onkyber.omarchy-settingspatch since 2026-11-04), the 7 boots before that one have no such error, and all three namespaces were onkyber../test/all, because AGENTS.md reserves it for shared code; CI runs it on this PR.Screenshots
No visible change: a udev rule that picks the I/O scheduler.