Skip to content

mips: fold the IP7 ticket module back into mips_core - #799

Open
jamesbraid wants to merge 1 commit into
mainfrom
fix/ip7-claiming
Open

jamesbraid wants to merge 1 commit into
mainfrom
fix/ip7-claiming

Conversation

@jamesbraid

Copy link
Copy Markdown
Collaborator

A timer callback delivers IP7 in two steps on two words: it claims the
armed ticket, then sets IP7 in the pending word. A Compare write issues
a new ticket and clears IP7. With only "armed" and "consumed" in the
ticket word, a callback that had claimed the old ticket could set IP7
after the write had cleared it, and the guest saw a timer interrupt for
a deadline it had just replaced. 8b4b6ba closed that with a third
state, held from the claim until IP7 is set, which a Compare write waits
out.

That fix put the word in a module of its own, behind closures, so a loom
model could drive it. The model could not use the real pending word,
which is a std atomic that compiled code reads, so it checked the ticket
word against a copy of the two closures and of the Compare write's
order. The module, its wrappers and the model were about 170 lines for a
protocol that is one extra state.

Keep the state and drop the rest. claim_ip7 and arm_ip7_sequence hold
the protocol directly, as they did before, and the Compare write takes
its ticket at the top again. The new test runs the real claim_ip7 on one
thread against real Compare writes on another and checks IP7 after both
finish. With the third state removed it failed 60 runs of 60 on two or
more CPUs, and it passed 250 of 250 with it. Pinned to one CPU it passed
20 of 20 without the state, so it only catches a regression on a
multiprocessor host.

A timer callback delivers IP7 in two steps on two words: it claims the
armed ticket, then sets IP7 in the pending word. A Compare write issues
a new ticket and clears IP7. With only "armed" and "consumed" in the
ticket word, a callback that had claimed the old ticket could set IP7
after the write had cleared it, and the guest saw a timer interrupt for
a deadline it had just replaced. 8b4b6ba closed that with a third
state, held from the claim until IP7 is set, which a Compare write waits
out.

That fix put the word in a module of its own, behind closures, so a loom
model could drive it. The model could not use the real pending word,
which is a std atomic that compiled code reads, so it checked the ticket
word against a copy of the two closures and of the Compare write's
order. The module, its wrappers and the model were about 170 lines for a
protocol that is one extra state.

Keep the state and drop the rest. claim_ip7 and arm_ip7_sequence hold
the protocol directly, as they did before, and the Compare write takes
its ticket at the top again. The new test runs the real claim_ip7 on one
thread against real Compare writes on another and checks IP7 after both
finish. With the third state removed it failed 60 runs of 60 on two or
more CPUs, and it passed 250 of 250 with it. Pinned to one CPU it passed
20 of 20 without the state, so it only catches a regression on a
multiprocessor host.
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.

1 participant