Repository navigation
iio: aop_devmotion: reuse the report client across direct reads - #3624
Conversation
Keep the report client open across short gaps between direct reads. Back off after a failed open, let buffered operation take over the client, and join idle work before suspend or teardown. Register the PM notifier before publishing the IIO device so probe failure cannot leave work behind. Retain the existing refusal to restart after an unconfirmed fast-path transition. Add host coverage for ownership transitions, backoff and an unconfirmed close. Signed-off-by: Ryan Murray <[email protected]>
There was a problem hiding this comment.
Verdict: FINISH, then merge at 70db3668.
Blockers: Serialize poll publication with idle stop and restart. A poll callback can pass the active check and copy the old client's report, then pause. Idle stop closes the old client and clears the cached sample without joining that callback or synchronizing with its ring-lock critical section. The callback can then publish the old report after the clear. The next direct read opens a new client and sees a valid sample, so it can skip waiting for that client's first report. Please add a regression covering this interleaving and keep the requested hardware validation.
Checked: Idle cancellation runs outside the stream mutex, and teardown disables requeue before dropping the queued work reference. Buffer takeover clears the direct hold. Failed opens or closes that may leave firmware using the ring still retain the mapping and refuse new starts.
Evidence
The interleaving follows WorkItem::run(), poll(), stop() and read_now() in aop_devmotion.rs. The idle callback adds a routine asynchronous stop to the direct-read lifecycle.
Hold the stream lock through report publication and use the same active state for direct reads and the poll worker. This makes idle stop wait for a report in flight before invalidating the old sample. Cover the old-client poll and subsequent restart with the host test. Signed-off-by: Ryan Murray <[email protected]>
There was a problem hiding this comment.
Verdict: MERGE at a22f8414 after hosted checks and hardware validation.
Blockers: Complete hosted CI and the two-family rows for direct reads, idle close, buffer takeover, suspend and driver removal.
Checked: The poll worker now holds the stream mutex through publication and requeue. Stop and restart share that mutex, and direct reads already hold it around inline polling. Teardown joins delayed work after releasing the mutex. The new fixture checks the worker's lock scope, exercises an idle stop and restart, and confirms the sample remains invalid until the new client reports.
Evidence
Reviewed the two-file fix. The owner reported the arm64 build and all eight host cases passing, with the new regression rejecting removal of the worker lock. The comment above opened still describes the removed atomic active flag and can be cleaned up.
Signed-off-by: Ryan Murray <[email protected]>
|
@aurora-silicon/core @aurora-silicon/omarchy-mac @aurora-silicon/aurora-maintainers review requested for |
There was a problem hiding this comment.
Verdict: MERGE at f9b23f98 after hosted checks and hardware validation.
Blockers: The two-family lifecycle rows and hosted checks remain.
Checked: The delta from the approved head changes only two comments. They now describe the firmware open state and the mutex that serializes transitions with report publication. The race fix and regression are unchanged.
|
J316s M1 Pro at
|
|
f9b23f9 J615 (M3 MacBook Air 15", T8122) PASS: guarded kernel-only one-shot |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: Keep the fused-orientation report client open across consecutive direct reads and close it when the reads go idle. Back off failed opens and park the client across system sleep and restore.
Tested: J316s M1 Pro and J615 M3 Air at
f9b23f9863698a: three buffered scans per machine before and after same-boot s2idle, direct quaternion reads and child rebind passed. J615’s final idle callback arrived 1.995 seconds after the read burst. Arm64 driver built and all eight device-motion host cases passed.Risk: two-way door · Macs that expose the AOP fused-motion service.
Not yet: The J316s observer did not retain the final idle callback timestamp. Hosted checks are pending.
Details
Report publication and client transitions share the stream lock so idle close invalidates the old sample after in-flight publication completes. The existing client-transition guard retains the DMA mapping and refuses new starts after an unconfirmed transition. The PM notifier is registered before exposing the IIO device and pending work is joined during teardown. This carries the device-motion portion of #2927. The accelerometer and gyroscope calibration change remains in that PR.
Evidence