Skip to content

omamobile-modem-sit 0.3.34: count suspend in transport deadlines - #595

Open
nrempel wants to merge 1 commit into
derekross:mainfrom
nrempel:fix/sit-suspend-deadlines
Open

nrempel wants to merge 1 commit into
derekross:mainfrom
nrempel:fix/sit-suspend-deadlines

Conversation

@nrempel

@nrempel nrempel commented Nov 10, 2026 •

Copy link
Copy Markdown

What and why

SIT transport deadlines currently use MONOTONIC, which excludes suspend. A matching reply can also cross the deadline during a read or scheduling pause and still be accepted. This changes transport deadline accounting to BOOTTIME and checks expiry before interpreting a matching response.

The socket regressions reproduce the old behavior and pass with the fix. They hold MONOTONIC still while advancing BOOTTIME across real socket reads, cover the before/at/after deadline boundary, preserve indications, verify no transport retransmission, and reject both success and modem-error replies after a scheduling pause.

This is a narrow offline prerequisite for MODEM-PLAN M6/section 6.3, not an implementation or qualification of modem-on suspend. The sleep inhibitor is unchanged. Relative select waits do not become wake alarms or guarantee immediate expiry on resume without socket activity. A timeout does not cancel a modem operation or prove it did not execute.

Device and build

  • Phone: none accessed; host-only work on Harbour.
  • Kernel release: no phone kernel tested or changed.
  • Packages changed: omamobile-modem-sit 0.3.33 → 0.3.34.
  • Base reviewed: 0c2c737.
  • Contribution: a0801f9.

Checks (no phone needed)

  • tools/pr-check origin/main passes.
  • tests/all passes, with its environment-dependent skips.
  • tests/packages omamobile-modem-sit passes: unit tests, real RIL against sit-sim, staged layout/config/units.
  • Focused transport tests pass (10 test methods, including deadline subcases); original code failed the new regressions.
  • Changed package version bumped and included in commit subject.
  • Commit has an area prefix, rationale and AI attribution; no AI Signed-off-by.

The repository-wide run skipped optional paths requiring lz4, Docker/Arch image, AOSP boot-image tools, dtc, repo-add, Unicorn/pyelftools, bsdtar, Node, and a built root image. The modified modem package's RIL simulator did run. Host dependencies binutils and build-essential were installed for the checks.

On the phone

  • Run on a phone booted into the changed package.
  • Awake modem smoke/telephony checks and tools/phone-smoke report.
  • Hardware suspend/resume qualification.

Hardware validation outstanding: no device smoke report is available. The code is ready for maintainer review; device qualification is not claimed. MODEM-CLIENT documents the verification boundary, stop conditions and rollback. CPIF/PCIe suspend, incoming call/SMS wake, IMS continuity and battery behavior remain untested. Do not bypass the inhibitor to test this patch.

  • No partition writes, storage-guard changes or userspace register access.
tools/phone-smoke report

Not run: no physical device accessed.

MONOTONIC excludes suspend, so an expired request can accept a reply
when execution resumes. Use BOOTTIME for SIT transport waits and check
expiry again before interpreting a matching reply. Keep indications
queued and do not replay a timed-out request.

Socket regressions reproduce late success on the old implementation
and pass with the fix. They model a BOOTTIME jump with MONOTONIC frozen,
cover the deadline boundary and a scheduling pause after packet receipt,
and retain indications without retransmission. The package's unit/RIL
simulator and staged-install checks pass.

This is offline preparation only: select still has a relative timeout,
the modem sleep inhibitor remains, and no device was accessed. Document
the remaining awake-device smoke and modem-on suspend qualification.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@derekross

Copy link
Copy Markdown
Owner

Thank you for this, and for being so clear about what it is and isn't: no phone, the inhibitor untouched, no claim about modem-on suspend. The tests are careful work. I ran them here: both new tests fail on main's sit.py and pass on yours, and with only the late-reply check removed, the suspend test still passes while the "reply crossing the deadline" test fails, so the two changes are independent.

I don't want to merge it as it stands, though, because I'm not convinced either change makes the outcome better. Two questions:

  1. The check after a matching reply (sit.py, "A late response cannot turn an expired transaction into success"). Why not? The token check already keeps a reply to an older request out, so a reply that matches is the modem's answer to this request. Throwing it away turns something we know into something we don't. The clearest case is send_sms in service.py: each part is sent with timeout=90, and on TimeoutError the message is recorded as "Delivery uncertain; check with the recipient before sending again". With this check, a "sent" that is handled a moment past the deadline (a stall, or a suspend) becomes that, and so does a definite rejection from the carrier, since the test asserts a late modem error also becomes a timeout. Bring-up treats a timeout as a failed step too, on every phone and with no suspend involved. Is there a caller that is harmed when a late reply is accepted? If so, please name it and I'll look again; if not, I'd like this part and its test dropped.

  2. CLOCK_BOOTTIME for request deadlines. A request in flight across a suspend longer than its timeout now always ends in TimeoutError on resume, whatever the modem then answers; with monotonic it gets its reply. For a request and its response, that looks like the better behaviour to me rather than the bug. Counting suspend seems right for timers that follow the network's clock (the hang-up deadline, registration and poll timers), and those stay on monotonic here. What goes wrong today, or would under omamobile-modem-sit 0.3.37, omamobile-modem 0.1.25, device-cheetah 0.1.56: suspend with the modem online (M6) #556 (the open PR for suspend with the modem online, which leaves sit.py alone), with the deadlines as they are? It may be worth the two of you agreeing on what the transport should do across a sleep before it changes.

Smaller things:

  • The new MODEM-CLIENT section mostly records what wasn't tested and what someone should do before "promoting" the package. I'd keep a few sentences on what the code does (which clock, that a timeout neither cancels nor retries, the pointer to M6) and leave merge conditions to this PR. A step that someone runs on a phone goes in the plan as a gated step with its command, what to expect, a stop condition and a rollback that can be typed.
  • A small _now() helper would replace nine copies of time.clock_gettime(time.CLOCK_BOOTTIME) and give the tests one thing to patch.
  • The number: omamobile-modem 0.1.22, omamobile-modem-sit 0.3.35, device-raven 0.1.36: the modem runtime on the Pixel 6 Pro #389 also carries omamobile-modem-sit 0.3.34 and has been waiting longer, so it keeps that one. I set the versions at merge, so there's nothing for you to do; just don't be surprised when this lands under the next free number, and the heading in MODEM-CLIENT will need to follow it.

This package runs on my Pixel 7 Pro at every boot, so whatever remains gets a boot there with a call and an SMS before it merges; you don't need a phone for that part.

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