Skip to content

Comments

kvm: replace machine.availableCond with futexes#11568

Open
copybara-service[bot] wants to merge 1 commit intomasterfrom
test/cl738486108
Open

kvm: replace machine.availableCond with futexes#11568
copybara-service[bot] wants to merge 1 commit intomasterfrom
test/cl738486108

Conversation

@copybara-service
Copy link

kvm: replace machine.availableCond with futexes

Between when machine.Get() observes that a vCPU is not in state vCPUReady, and
when it observes that the same vCPU is not in state vCPUGuest, the vCPU can
racily transition from vCPUGuest to vCPUReady in bluepillGuestExit(), causing
machine.Get() to block in machine.available.Wait() despite a vCPU being ready.
To fix this, drop the vCPU handoff mechanism (vCPUWaiter is still needed for
bounce()) and replace machine.available with a sequence counter futex. This
also improves utilization by allowing machine.Get() to grab the first vCPU that
becomes ready, rather than only the specific vCPU it tags for handoff.

Between when machine.Get() observes that a vCPU is not in state vCPUReady, and
when it observes that the same vCPU is not in state vCPUGuest, the vCPU can
racily transition from vCPUGuest to vCPUReady in bluepillGuestExit(), causing
machine.Get() to block in machine.available.Wait() despite a vCPU being ready.
To fix this, drop the vCPU handoff mechanism (vCPUWaiter is still needed for
bounce()) and replace machine.available with a sequence counter futex. This
also improves utilization by allowing machine.Get() to grab the first vCPU that
becomes ready, rather than only the specific vCPU it tags for handoff.

PiperOrigin-RevId: 738486108
@copybara-service copybara-service bot added the exported Issue was exported automatically label Mar 19, 2025
@zhimin-z
Copy link

A friendly reminder that this PR had no activity for 120 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants