Skip to content

omamobile-modem 0.1.9: watch the CP state on one open file - #148

Merged
derekross merged 2 commits into
derekross:mainfrom
W4HO-ham:modem-cp-watch-slow
Oct 31, 2026
Merged

derekross merged 2 commits into
derekross:mainfrom
W4HO-ham:modem-cp-watch-slow

Conversation

@W4HO-ham

@W4HO-ham W4HO-ham commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #141 (it needs 0.1.8's version bump first; the change itself is this one commit).

On the palmtop, every open and close of umts_boot0 wakes the CP's PCIe link for about 100 ms ("PHY out of isolation", link up, "PHY isolated" again); the status ioctl on a file held open does not. omamobile-modem-cp watch opened the file for each 0.5 s poll, so the link cycled twice a second for as long as the modem was up.

The watcher now keeps one open file for the whole watch and polls it every 0.5 s as before (OMAMOBILE_MODEM_WATCH_SECONDS overrides it, read inside watch() and checked against 0.2-60 s, so a bad value can't break the other subcommands). Measured on the palmtop with the modem ONLINE (10-29): the held-file watcher made 0 link-ups in a minute, and a second held-file watcher at 0.5 s added 0 in its minute, so the open and close is what woke the link, not the status ioctl. A crash still shows within a second, and crash timing on the other phones is unchanged.

What this doesn't fix: three times last night the SoC hung (watchdog reset, no oops in ramoops, the log stopping mid-cycle) while the link cycled during gnssd's Kepler image reloads. Once that was with this watcher in place, with the link cycling in step with gnssd's IOCTL_LOAD_GNSS_IMAGE calls. The watcher was one source of the cycling. The hang itself looks like CPIF's link power-down racing an access, and that's still open (MODEM-PLAN G3 on #138).

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Ran a GNSS session on it that made Kepler's watchdog fire 14 times. Each time gnssd reloaded the image over the CP's link (81 GNSS image ioctls in the kernel log), and the palmtop stayed up. The link came up 55 times in 6 minutes of uptime. Earlier sessions with the 0.5 s watcher reset the SoC after far fewer reloads (02:43 and 03:15 last night).

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Correction to my last comment: the hang came back at 05:02 with this watcher installed (bootloader reset reason CLUSTER0_NONCPU_WDTRESET). The ramoops console shows the CP's link still cycling about twice a second in the last minute, this time in step with gnssd's IOCTL_LOAD_GNSS_IMAGE calls after Kepler watchdog resets, and the log stops mid-cycle again. So the watcher was one source of the cycling, not the only one, and this PR doesn't fix the hang. It still cuts link wakes from ~120 to ~5 a minute while the modem is idle, which I think is worth having on its own, but the PR description overstates it. I'll reword it. The underlying fault looks like CPIF's link power-down racing an access while gnssd reloads Kepler.

@derekross

Copy link
Copy Markdown
Owner

Thanks for this, and for posting the correction when the hang came back. That honesty makes these threads much easier to trust. Keeping one fd open is a good change, and cutting the link wakes from about 120 a minute to 5 is worth having on its own, as you say.

I checked:

  • tools/pr-check and the package tests pass, and CI is green.
  • I also drove watch() through BOOTING, ONLINE, an I/O error and a crash with the syscalls stubbed out. It opens once, reopens after an error, drops the marker at ONLINE and records the crash once.

A few things before I merge:

  1. The comment and commit message still describe the old theory. The comment says a link cycling at 2 Hz "hung the SoC once gnssd was reloading Kepler", and the commit body says the SoC "hung in one of those cycles". Since your 05:02 hang happened with this watcher in place, please reword both: the watcher was one source of link cycling, and the hang is still open. The PR description is already right; the commit message is what lands on main.

  2. Which call wakes the link? Your own numbers make me doubt it's the status ioctl. At 5 s the watcher sends 12 requests a minute on the held fd, yet the link came up 5-6 times. In the CPIF source we publish, IOCTL_GET_CP_STATUS only reads the stored state, so I suspect the open/close was what woke it, and the held fd is the real fix. Could you count link-ups for a minute with OMAMOBILE_MODEM_WATCH_SECONDS=0.5 on this build? If it stays around 5, I'd keep 0.5 s as the default. That leaves crash timing on the other phones as it was, and the comment can name the open/close. If the ioctl does wake it on the 9a, 5 s is fine with me, and the comment can say that.

  3. Stacking: once omamobile-modem 0.1.8, extract-vendor-chroot: gnssd's custom GNSS library and the CP state it waits for #141 is squash-merged, please rebase this onto main so it carries only its own commit (git rebase --onto origin/main 665b9fb). Otherwise the two version bumps conflict. I tried it here and it applies cleanly, giving exactly this branch's tree. I can do it at merge if you prefer.

Smaller things:

  • OMAMOBILE_MODEM_WATCH_SECONDS is parsed when the script loads, so a typo there would break every subcommand, power-off at the profile's stop included. Parsing it inside watch(), with a fallback and a sane range, avoids that.
  • Please add a tools/phone-smoke report and uname -r for the build you tested.
  • An idea for later, not for this PR: with the fd held, the watcher could poll() it instead of sleeping. CPIF returns POLLHUP on the boot channel when the CP enters a crash state, so a crash would show at once with no periodic ioctl at all.
  • Related, if open/close turns out to be the trigger: omamobile-modem-sit checks the CP state every 2 s with a fresh open each time, so it would cycle the 9a's link too once it runs there.

This watcher runs on every phone's modem profile, so I'll run it on my 7 Pro for one modem boot before merging.

@W4HO-ham
W4HO-ham force-pushed the modem-cp-watch-slow branch from d4396e3 to 2c9ccad Compare October 29, 2026 16:48
@W4HO-ham W4HO-ham changed the title omamobile-modem 0.1.9: poll the CP state every 5 s, on one open file omamobile-modem 0.1.9: watch the CP state on one open file Oct 29, 2026
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Thanks for the careful read. Two commits on the branch now (I can't force-push from where I am today, so the second one carries the rework; the squash subject is the new title).

  1. The comment and the commit text no longer say the cycling hung the SoC: the watcher was one source of link cycling, and the hang is still open (the 05:02 one happened with this watcher in place).
  2. You were right about which call wakes the link. Measured on the palmtop today with the modem ONLINE, counting "PHY out of isolation" lines: the profile's held-file watcher made 0 link-ups in a minute, a second held-file watcher at OMAMOBILE_MODEM_WATCH_SECONDS=0.5 added 0 in its minute, and the minute after that was 0 again (no ufshcd_err_handler lines). So it's the open and close of umts_boot0, not the status ioctl. The default is back at 0.5 s with the file held open (9aa68b6), so crash timing on the other phones stays as it was, and the comment names the open/close. (My earlier "5 a minute" was measured within the first minute after ONLINE, when the CP itself still brings the link up; the three minutes above start 30 s after ONLINE.)
  3. Stacking: still on omamobile-modem 0.1.8, extract-vendor-chroot: gnssd's custom GNSS library and the CP state it waits for #141's branch, which now has two commits too (c393e0e carries that PR's rework). Rebasing this one at merge, as you offered, is easiest; or I'll do it the moment omamobile-modem 0.1.8, extract-vendor-chroot: gnssd's custom GNSS library and the CP state it waits for #141 lands.

OMAMOBILE_MODEM_WATCH_SECONDS is parsed inside watch(), 0.2-60 s with a fallback to the default and a note on stderr, and the package test covers it (bad values leave baseband-version and the rest working). The poll() on POLLHUP idea is a good one for a later PR, and I'll check omamobile-modem-sit's 2 s open-per-check once the 9a runs it.

Kernel 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty. The smoke report below is from today's boot, before the modem was brought up for the count.

phone-smoke: tegu

Kernel 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, tools at 34778a2, 2026-10-29T16:56Z.

Check Result Detail
boot (required) ok kernel 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, slot b, up 77s
storage guard (required) ok 62 partitions; only userdata and slot B's boot images writable
root (required) ok ext4 on userdata, 19G free
kernel health (required) ok no oops or BUG; 0 WARN, 306 error lines in dmesg
systemd units ok none failed
USB gadget (required) ok bound to 11210000.usb
display ok card1-DSI-1 connected, 1080x2424
GPU ok render node on panthor
session (required) ok Hyprland and the Omarchy shell running
lock ok PAM file present, the shell can lock (passwordPam true, locked false)
touch ok Synaptics TouchComm Touchscreen
buttons ok gpio-keys
Wi-Fi ok wlan0 on brcmfmac, link up
Bluetooth ok hci0, powered true
battery ok 90% Unknown, 32 °C
sound cards ok googleteguaocsn
sensors ok Accelerometer AmbientLight Proximity
cameras ok 3 listed by libcamera
thermal ok hottest zone 42 °C

Packages: hyprland 0.56.2-5.1, libcamera 0.7.2-4.22, mesa 1:26.2.4-1.4, omacam 0.3.3-1, omamobile-apps 0.2.0-1, omamobile-audio 0.4.1-1, omamobile-device-tegu 0.2.0-1, omamobile-fingerprint 0.1.8-1, omamobile-firstboot 0.1.0-1, omamobile-gnss 0.2.1-1, omamobile-keyring 20261013-1, omamobile-mirror 0.1.1-1, omamobile-modem 0.1.4-1, omamobile-omarchy 0.1.12-1, omamobile-owl-widgets 0.1.1-1, omamobile-sensors 0.2.1-1, omamobile-shell 0.2.36-1, omarchy 4.0.6-1

@derekross

Copy link
Copy Markdown
Owner

Thanks, this is a great outcome. Your A/B settles it: a held file at 0.5 s added no link-ups in a minute, so the open and close was the trigger. With the default back at 0.5 s, the other phones keep their crash timing and the 9a still loses the wakes. The interval parsing and its test are just what I hoped for, and thanks for explaining the earlier "5 a minute".

I re-checked:

  • tools/pr-check and the package tests pass, including the new interval test.
  • CI is green.
  • I ran watch() with the syscalls stubbed again at the new default. It opens once, reopens after an error, drops the marker at ONLINE and records the crash once.

How I'll merge it:

  • After omamobile-modem 0.1.8, extract-vendor-chroot: gnssd's custom GNSS library and the CP state it waits for #141's squash, I'll rebase this branch onto main myself, as offered. I tried it here: your two commits apply cleanly, and the package comes out identical to this branch.
  • Because the squash keeps every commit's message, the middle commit's "polls every 5 s … about 5 a minute" would land on main next to the commit that undoes it. So I'll write the squash message by hand from your final wording: the open/close woke the link, the held file doesn't, the interval stays at 0.5 s, the range check, and the hang still open. If you'd like to change any of that, tell me.
  • If you get a moment, the PR description's first line still says every status request wakes the link. It doesn't land anywhere, but someone reading the thread later might trip on it.

Before merging, I'll do one modem boot on my 7 Pro with this version, since the watcher runs on every phone. With the file held open, the boot channel is open for the whole session. On our CPIF that means frames arriving on it would be queued rather than dropped, and that node has no queue cap. I expect the channel to stay silent after ONLINE, but I'd like to see it, so I'll check that nothing is queued after ten minutes. If something is, I'll come back to you before merging.

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

The description's first line now says it the right way round (the open and close wakes the link, the held file doesn't). Your squash message from the final wording is exactly right; nothing to change. Thanks for the boot-channel check on the 7 Pro; if anything queues there I'll look at the poll() route first.

On the palmtop (Pixel 9a) every open and close of umts_boot0 woke the CP's PCIe link for about 100 ms. The watcher opened the file for each 0.5 s poll, so it woke the link about 120 times a minute. It now holds one file open for the whole watch and polls every 5 s, which cuts the link-ups to about 5 a minute. Whether the status ioctl on the held file wakes the link too is being measured. The watcher was one source of link cycling, and the hang seen while gnssd reloaded Kepler is still open: it happened with this watcher in place too. A crash still shows within seconds.

The interval, OMAMOBILE_MODEM_WATCH_SECONDS, is read inside watch() and checked against 0.2-60 s, with the default used otherwise, so a bad value can't break the other subcommands, power-off at the profile's stop included. The package test covers it.
…s at 0.5 s

Measured on the palmtop with the modem ONLINE: the profile's held-file watcher made 0 link-ups in a minute, and a second held-file watcher at 0.5 s added 0 in its minute. So it is the open and close of umts_boot0 that wakes the CP's PCIe link, not the status ioctl, and the default goes back to 0.5 s with the file held open; crash timing on the other phones stays as it was.
@derekross
derekross force-pushed the modem-cp-watch-slow branch from 9aa68b6 to babf987 Compare October 29, 2026 19:28
W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Oct 29, 2026
…L1's frame

The count was wrong by one (eight watchdog resets, the eight times listed). G3-L1 now says its first step, the link held up through cpif's keep_link_up, runs under the same frame and counts toward the same cap; the watcher is named as derekross#148 in review, and the partition check's span is the consoles' (07:34 to 09:19).
W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Oct 30, 2026
…t, and runs on real packages

The slot-B precondition and a one-hang cap head the runbook, citing the AGENTS line that is on main. Every stop of the modem unit by hand becomes an attended reboot, since a profile stop hard-reset the palmtop once and the power-off path is unqualified; SIM-11's checksum compare moves to after the reboot. SIM-1 now requires a real install of omamobile-modem (0.1.10 once derekross#148 and derekross#163 merge) with pacman -Qkk clean and the profile's sha256 recorded, and omamobile-modem-sit 0.3.4, since 0.3.3's state reads cycle the CP link. The start script the runbook relies on is committed under device/tegu/bringup. Smaller: no calls to the palmtop during the test and what to do if a release isn't confirmed, the cluster watchdog reset named for a hang, test -d for the CPIF check, the unit copy marked temporary, the Linux poweroff question answered, the network no longer named.
@derekross

Copy link
Copy Markdown
Owner

Thanks again for this one. I rebased it onto main after #141 landed. Your two commits applied cleanly, the package is identical to what I reviewed, and the checks still pass on today's main. The one thing left is on me: one modem boot on my 7 Pro with 0.1.9, checking that nothing queues on the boot channel after ten minutes. My phone is away from the laptop right now; I'll run it as soon as it's back, post the result here and merge right after, with the squash message from your final wording.

@derekross
derekross merged commit 0c701aa into derekross:main Oct 31, 2026
2 checks passed
@derekross

Copy link
Copy Markdown
Owner

Ran it on my 7 Pro tonight: 0.1.9 with sit 0.3.3, one modem start in a fresh boot. CP ONLINE in about 9 s, the watcher held one file (0 umts_boot0 opens a minute), and after 10 minutes the boot channel had nothing queued (select returned []). No UFS error-handler pass, no "application may be dead" lines; the only CPIF errors were the usual -19 drops on the IPC channels nobody had open (sitd isn't running here). Merged with the squash message from your final wording. Thank you!

Somnius added a commit to Somnius/omarchy-mobile that referenced this pull request Oct 31, 2026
The display bullet cited BRINGUP-M1 test 23 for "Power alone does
nothing", but that test is about forcing a restart of a hung phone, not
about waking a blanked screen. What can be checked: the omamobile head's
zuma-husky.dts has no gpio-keys node, the c6 test tag's has one (derekross#148),
so on the head kernel no key can wake a blanked screen.

Notes only.
derekross pushed a commit that referenced this pull request Oct 31, 2026
Power, volume keys and the touchscreen run on the Pixel 8 Pro with the zuma ALIVE pin controller, gpio-keys and the touch stack from linux-omarchy-mobile #148 and #153 (test tags b, b2, c5, c6 on the author's fork). DEVICES marks them testing.
derekross added a commit that referenced this pull request Oct 31, 2026
The Pixel 9a's SoC and board device tree, 120 Hz, the touchscreen and its
sleep fix, NFC's ST54L mode and poll stop, and the panel's local high
brightness mode are merged (kernel #80/#81, #88, #82, #131, #71, #126;
#155). The Pixel 8 Pro's buttons are in the published kernel (kernel
#148). The OnePlus 13's device package is merged (#111), mustang has stage
0 notes (#198), and kodiak joins the Pixel 11 row (#201).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…#148)

On the Pixel 9a each open and close of umts_boot0 woke the CP's PCIe link
for about 100 ms, so the watcher, which opened the file for every 0.5 s
poll, woke it about 120 times a minute. The watcher now holds one file
open for the whole watch. The status ioctl on the held file doesn't wake
the link (0 link-ups in a minute at 0.5 s, measured 2026-10-29), so the
interval stays at 0.5 s and crash timing on the other phones is unchanged.

OMAMOBILE_MODEM_WATCH_SECONDS overrides the interval. It is read inside
watch() and checked against 0.2-60 s, so a bad value can't break the
other subcommands, power-off at the profile's stop included; the package
test covers it.

The watcher was one source of link cycling. The SoC hang seen while
gnssd reloaded Kepler (device/tegu/MODEM-PLAN.md G3) is still open: it
happened with the held file too.

Tested on the Pixel 7 Pro (2026-10-30, kernel 7.3.0-rc6-omamobile-push1-gaae3b058ef98): CP ONLINE in about 9 s, 0 umts_boot0 opens a minute from the watcher, nothing queued on umts_boot0 after 10 minutes (select returned []), no UFS error-handler pass, no dead-application lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…ross#208)

Power, volume keys and the touchscreen run on the Pixel 8 Pro with the zuma ALIVE pin controller, gpio-keys and the touch stack from linux-omarchy-mobile derekross#148 and derekross#153 (test tags b, b2, c5, c6 on the author's fork). DEVICES marks them testing.
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
The Pixel 9a's SoC and board device tree, 120 Hz, the touchscreen and its
sleep fix, NFC's ST54L mode and poll stop, and the panel's local high
brightness mode are merged (kernel derekross#80/derekross#81, derekross#88, derekross#82, derekross#131, derekross#71, derekross#126;
derekross#155). The Pixel 8 Pro's buttons are in the published kernel (kernel
derekross#148). The OnePlus 13's device package is merged (derekross#111), mustang has stage
0 notes (derekross#198), and kodiak joins the Pixel 11 row (derekross#201).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants