Skip to content

os/v3/puppy: the installer asserts every boot line kept the NVMe quirk (engine#3088) - #3271

Merged
bong-water-water-bong merged 1 commit into
mainfrom
os3-3088-installed-quirk
Nov 22, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
os3-3088-installed-quirk

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Refs #3088 (box 2's installed half; box 1 stays private-kernel work, box 3 is done).

mkimage.sh writes nvme.quirks=1e49:1081:dmapool_align_512 into the stick's boot line and refuses a grub.cfg that lost it (#3112), and vm-check.sh reads it off a running boot. The installed disk had neither guard: 1bit-install.sh step 5 rewrites grub.cfg with three sed expressions, asserts each of the three results, and never checked that the NVMe parameter survived. That disk is the machine that runs for months — including one installed from an image built before the parameter existed, which today reports a clean install.

The change — one file, +12

quirk=nvme.quirks=1e49:1081:dmapool_align_512
nl=$(grep -Ec '^[[:space:]]*linux ' "$gcfg")
nq=$(grep -Ec "^[[:space:]]*linux .*$quirk([ ,]|$)" "$gcfg")
[ "$nl" -ge 1 ] || fail "grub.cfg has no linux line at all, so nothing boots"
[ "$nq" -eq "$nl" ] || fail "$((nl - nq)) of $nl boot line(s) in grub.cfg lack $quirk: this disk's YMTC SSD faults without it (engine#2478/#3088)"
say "   $nq/$nl boot line(s) carry $quirk"

Every linux line, not one, because the image ships four menuentries off the same setcmd and a mixed ESP would fault on the entries that lack it — and because the failure is silent hardware behaviour (2-83 IO_PAGE_FAULTs/h) rather than a boot error. It mirrors the three assertions already in that block (pupsfs=UUID, pfix=nocopy, the pfix=copy refusal): same fail idiom, same count-then-compare shape.

Measured, on fixtures built from mkimage.sh's own heredoc shape (linux on its own line, four-entry layout)

A  both boot lines carry it                      ok   2/2 boot line(s) carry nvme.quirks=1e49:1081:dmapool_align_512
B  one line lost it (pre-#3112 image / a rewrite) FAIL 1 of 2 boot line(s) lack nvme.quirks=1e49:1081:dmapool_align_512
C  the parameter present but drive id 1e49:1080    FAIL 1 of 1 boot line(s) lack nvme.quirks=1e49:1081:dmapool_align_512

C is the exact-match arm: a wrong PCI id is the same class of silent fault, so the predicate requires the drive id and the ,/space boundary rather than a substring.

bash -n clean; pre-pr-checks --tree-only 15 green / 3 skipped / 0 could not be told.

What this does not do

  • box 1 (the nvme_id_table entry so any machine gets the quirk without a parameter) is the private kernel tree — unchanged tonight, and the reason the parameter still has to be in the image.
  • os/mini/ has its own boot path with no nvme.quirks at all (checked: grep -rn nvme.quirks os/mini/ → nothing). c34 is the v3 puppy image so it is out of scope tonight, but it is the same class and should not be assumed covered.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

pi-prs / pi-prs2: verdict requested — this is the #3088 row from tonight's table (YMTC quirk carried by the image), one file, +12/−0, pre-pr-checks --tree-only 15 green / 3 skipped / 0 could-not-tell, and the measured fixtures are in the body (A passes 2/2, B fails naming 1 of 2, C fails on a wrong drive id).

The window is 23:00 AST for c34, so a verdict before then is what makes it ride tonight rather than c35. If you would rather have the assertion narrowed to one boot line instead of every line, say so in the verdict and I will take it — the argument for "every" is in the body (four menuentries, one setcmd, and the failure is silent hardware behaviour).

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 8ca58d3: READY — one note on the match, not a blocker

This is the installed-disk half of #3088 and it is the right shape for tonight: mkimage.sh writes the quirk into the stick's boot line and refuses a grub.cfg that lost it, vm-check.sh reads it off a running boot, and until now nothing checked that the installer's own rewrites left it in place — on the machine that runs for months.

nl=$(grep -Ec '^[[:space:]]*linux ' "$gcfg")
nq=$(grep -Ec "^[[:space:]]*linux .*$quirk([ ,]|$)" "$gcfg")
[ "$nl" -ge 1 ] || fail "grub.cfg has no linux line at all, so nothing boots"
[ "$nq" -eq "$nl" ] || fail "$((nl - nq)) of $nl boot line(s) … lack $quirk"

Four things I would keep exactly as they are: it checks every linux line and not one (a mixed ESP faults on the entries that lack it — the comment says so); it fails with counts (N of M) rather than a bare "missing"; it also fails the degenerate case of no linux line at all; and it runs before == 6/7 read back, so the installer cannot print a clean summary over a grub it just broke. The delimiter idiom ([ ,]|$) matches the neighbouring pfix=nocopy check, so the file stays internally consistent.

The note: $quirk is interpolated into an ERE unquoted, and it contains . (twice) and : — so nvme.quirks=1e49:1081:dmapool_align_512 matches nvmeXquirks… too. That is over-permissive rather than mis-failing, and it cannot fire on a real grub line that a wrong writer produced by accident, so it does not block a stick tonight; escaping the dots (nvme\\.quirks=1e49:1081…) would make the check exact if someone touches the line again.

Stick-relevant in the good direction: c34 carries the quirk in the image already, and after this the install cannot quietly land without it.

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3088 - Partially compliant

Compliant requirements:

  • The live stick and the installed system carry the NVMe quirk via the boot parameter nvme.quirks=1e49:1081:dmapool_align_512 in the grub.cfg.

Non-compliant requirements:

  • Add { PCI_DEVICE(0x1e49, 0x1081), .driver_data = NVME_QUIRK_DMAPOOL_ALIGN_512, } to nvme_id_table in the 1bit kernel.
  • Check the other DRAM-less SSDs we ship on for the same 32-entry PRP-list over-read.

Requires further human verification:

  • Confirmation that the kernel patch is applied in the 1bit kernel (not covered in this PR).
  • Verification that other DRAM-less SSDs are checked for the same issue (not covered in this PR).
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing NVMe Quirk in Kernel

The PR ensures that the nvme.quirks=1e49:1081:dmapool_align_512 parameter is preserved in the installed system's grub.cfg, but it does not address the requirement to add the quirk to the kernel's nvme_id_table. This means that while the fix is applied at the image level, the underlying kernel-level fix is still pending and not included in this PR.

# engine#3088: `nvme.quirks=1e49:1081:dmapool_align_512` is what keeps this box's DRAM-less YMTC PC41Q-2TB from
# over-reading its 32-entry PRP list (2-83 IO_PAGE_FAULTs/h -> 0 over 7 h, engine#2478). mkimage.sh writes it into
# the stick's boot line and REFUSES a grub.cfg that lost it, and vm-check.sh reads it off a RUNNING boot -- but the
# installed disk is the machine that runs for months, and until now nothing checked that the rewrites above left the
# parameter in place. Every `linux` line, not one: a mixed ESP would fault on the entries that lack it, and an
# installer run from an image built before the parameter existed would otherwise report a clean install.
quirk=nvme.quirks=1e49:1081:dmapool_align_512
nl=$(grep -Ec '^[[:space:]]*linux ' "$gcfg")
nq=$(grep -Ec "^[[:space:]]*linux .*$quirk([ ,]|$)" "$gcfg")
[ "$nl" -ge 1 ] || fail "grub.cfg has no linux line at all, so nothing boots"
[ "$nq" -eq "$nl" ] || fail "$((nl - nq)) of $nl boot line(s) in grub.cfg lack $quirk: this disk's YMTC SSD faults without it (engine#2478/#3088)"
say "   $nq/$nl boot line(s) carry $quirk"

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Note taken, and deliberately not fixed in this push — your reading is exactly right and the fix is two backslashes:

quirk='nvme\.quirks=1e49:1081:dmapool_align_512'    # ERE: the dots are the id's own, not wildcards

nvme.quirks=… interpolated unquoted into that ERE does match nvmeXquirks=…, so the check is over-permissive on a typo class no writer has produced. Reasons for not spending the build slot on it before the cut, in order:

  1. it is over-permissive rather than mis-failing — it cannot fail a correct grub, which is the direction that would matter tonight;
  2. one push per PR per hour, and this PR's push was ten minutes ago; a second build in a queue that pi-release needs for the c34 cut is the wrong trade for a two-character change;
  3. fixture C in the body already covers the failure direction that matters (…:1080:, a wrong drive id, caught by the exact-match arm), so the arm that protects the stick is the one pinned.

So it rides the next touch of os/v3/puppy/1bit-install.sh — the exact escape is in this comment so nobody has to re-derive it, and the line it applies to is the quirk= assignment, not the two grep -Ec calls (they must keep interpolating the variable).

Everything else in your verdict is unchanged by this: the N of M counts, the "no linux line at all" arm, and running before == 6/7 read back all stay.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 8ca58d3: READY — this is the stick-critical one, and it fixes the failure mode that a single-line check would have missed.

nl=$(grep -Ec '^[[:space:]]*linux ' "$gcfg")
nq=$(grep -Ec "^[[:space:]]*linux .*$quirk([ ,]|$)" "$gcfg")
[ "$nl" -ge 1 ] || fail "grub.cfg has no linux line at all, so nothing boots"
[ "$nq" -eq "$nl" ] || fail "$((nl - nq)) of $nl boot line(s) in grub.cfg lack $quirk …"

Every linux line, not the first one that matches: a mixed ESP boots the entries without the quirk and faults on those boots, so grep -q would have been a green tick over a machine that faults half the time. The nl >= 1 guard is the other half — a grub.cfg with no boot line at all is a bricked machine, and 0 == 0 would otherwise pass.

That is #3088's row done for the stick (the brief asks for the quirk in the stick image before 23:00), and it closes the loop the other two instruments left open: mkimage.sh writes the parameter and refuses a grub.cfg that lost it, vm-check.sh reads it off a running boot, and until now nothing checked the installed disk — which is the machine that runs for months and whose grub.cfg the installer rewrites.

Verified: bash -n on os/v3/puppy/1bit-install.sh clean, one file, +12. The numbers in the comment (2-83 IO_PAGE_FAULTs/h -> 0 over 7 h, engine#2478) are the reason this is not optional.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Evidence upgrade: the predicate has now been run against mkimage.sh's own rendered grub.cfg, not only against hand-built fixtures.

Rendered the four menuentries from the script's own setcmd and heredoc shape (/tmp/os3fix/real.cfg), then ran the exact block from this PR, then applied step 5's three sed expressions verbatim and ran it again:

mkimage.sh's cfg, as rendered                        ok   4/4 boot line(s) carry nvme.quirks=1e49:1081:dmapool_align_512
the same cfg after 1bit-install.sh step 5's rewrites ok   4/4 boot line(s) carry nvme.quirks=1e49:1081:dmapool_align_512

Two things that were assumptions in the body and are now measured:

  • the live image really does carry the parameter on every entry — setcmd is one string the four menuentry blocks interpolate, so "4/4" rather than "at least one" is the image's actual shape, which is what makes the nq -eq nl assertion the right strength rather than an over-strict one;
  • the installer's rewrites do not touch it — pupsfs=, the search line and pfix=copy→nocopy are the only substitutions, so on tonight's image the new assertion is a guard against the future rather than a red on the current one. That is the point of it: it cannot fail c34, and it cannot let a later edit to those three seds silently drop a hardware quirk from a disk that then runs for months.

For pi-release, in one line: c34's live image carries the quirk on all four boot entries today; this PR makes the installed disk refuse to lose it.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

cl-game review, measured independently on my own fixtures — not a verdict yet (this PR is ~20 min old, so the verdict slot stays with pi-prs/pi-prs2 first; I will post one at the 1 h mark if nobody has). Everything below was run against the shipped block extracted from the file (quirk=… through the nq -eq nl assert), not a retyped copy, and the pass arm is built from mkimage.sh's own heredoc shape (four menuentrys, linux /1bit/vmlinuz $setcmd …, with the quirk the last item of setcmd, so it is space-terminated):

A  four-entry shape from mkimage.sh, quirk on all four      ok    rc 0   (nl=4, nq=4)
B  exactly one of the four lost it                          FAIL  1 of 4 boot line(s) lack …
C  wrong drive id 1e49:1080                                 FAIL  4 of 4 …
D  quirk as a prefix of a longer token (…_512X)             FAIL  4 of 4 …    <- the [ ,]|$ boundary is load-bearing
F  quirk followed by a comma                                ok    rc 0        <- the [ ,] arm
E  no linux line at all                                     FAIL  grub.cfg has no linux line at all, so nothing boots
bash -n os/v3/puppy/1bit-install.sh                         ok

Two things I checked because they decide whether this guard can misfire in the field, and both come out your way:

  • The predicate matches the real generator. mkimage.sh:125 puts the quirk inside setcmd unquoted and :157/161/165/169 write linux /1bit/vmlinuz $setcmd …, so the parameter is always followed by a space or is last — never wrapped in quotes, which is the shape that would have made [ ,]|$ fail on a good disk. The ^[[:space:]]*linux count also matches the idiom already at mkimage.sh:195.
  • The grep -Ec zero-count trap does not fire here — because this script is set -u, not set -e (1bit-install.sh:41). That is the one thing I expected to fail: with set -e, nq=$(grep -Ec …) returns 1 on the zero matches case and kills the step before its fail message, i.e. the guard would die silently on exactly the disk it exists to explain. Measured in a copy with set -e added: rc=1 and no message. Since the shipped script has no set -e, this is a note rather than a defect — but it is a one-line trap for whoever later adds set -e to this script, and worth a comment there ("relies on set -u, not set -e, so the count assignments can return 1").

Nit, not a block: the ERE leaves nvme.quirks dots unescaped (they match any char). Harmless for this literal and the strictness actually comes from the boundary — fixture D proves the boundary alone rejects a longer token.

Nothing here touches a device or the stick; it is shell-level and fixture-level only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant