hal: an entitlement must not outlive the probe that took it - #220
Merged
Merged
Conversation
#219 taught rule 3 to keep the entitlement when the register still held the word we wrote, so that a second arm inside one sweep would not drop the undo the first one owed. That was wrong, and it reached the field. The word we write is 0x11. The word the vendor SDK writes when it starts a pipeline is also 0x11. So "the register still holds what I wrote" cannot tell our own ungate still standing from the consumer's clock running, and this sequence gated a streaming camera: boot arm finds 0x10, ungates to 0x11, entitled pipeline up the SDK writes 0x11 -- the same word t+30 min a probe arms: want == cur, and cur == wrote, so the entitlement was kept cleanup re-reads, sees wrote, writes found = 0x10 Reported on a second camera running nightly-20260919, which carries this fix: black picture thirty minutes after every start, while the camera running the build from before #219's review held 0x00000011 for twenty-four hours (OpenIPC/firmware#2439). So rule 3 disowns unconditionally again. The cost is the thing #219's review asked to avoid: a probe that ungated a gated clock and then armed again leaves it running. That is the deliberate trade and it is now pinned by test rather than left to drift -- of the two ways to be wrong, a clock left on costs microamps and a clock taken away costs the picture. The failed-read half of #219's review stands: a read we could not make still drops the entitlement, for the same reason. Three cases added, the important one being the field sequence above: arm while gated, consumer writes the same word, probe half an hour later, assert nothing is written. It fails against the shipped code.
PR Summary by QodoPrevent stale sensor-clock entitlements from gating live cameras
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #219, and corrects a mistake I made in its review round. Field regression — please take it quickly.
What went wrong
#219's review asked that a second arm inside one sweep should not drop the undo the first arm owed. I made rule 3 keep the entitlement when the register still held the word we wrote. That is exactly the distinction the register cannot support:
The word we write is
0x11. The word the vendor SDK writes when it starts a pipeline is also0x11.So "the register still holds what I wrote" cannot tell our own ungate still standing from the consumer's clock simply running, and this sequence gated a live camera:
The evidence
Two cameras, same model, reported together:
0x00000011held for 24 hours, cleannightly-20260919, which carries #219 as mergedThat is as clean a bisect of my own mistake as I could ask for.
The fix
Rule 3 disowns unconditionally again.
The cost is the thing the review round asked to avoid: a probe that ungated a gated clock and then armed again leaves it running. That is the deliberate trade, and it is now pinned by test rather than left to drift — of the two ways to be wrong, a clock left on costs microamps and a clock taken away costs the picture.
The other half of that review round stands: a read we could not make still drops the entitlement, for the same reason.
Tests
Three cases, the important one being the field sequence: arm while gated, consumer writes the same word, probe half an hour later, assert nothing is written. Verified it fails against the shipped code before fixing — and the two cases the review round added are re-aimed to assert the deliberate leave-it-running behaviour rather than a restore that must not happen.
ipcinfounchanged at 1063400 bytes.Field report: OpenIPC/firmware#2439.