Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wifibox): avoid race conditions on restarting the guest #125

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

pgj
Copy link
Owner

@pgj pgj commented Sep 27, 2024

The ppt driver cannot be cleared until the VM runs so move the respective devctl(8) call back to the end of destroy_vm. Restore the wait period after the VM is destroyed to make sure that the device is released.

More importantly, do not let vm_stop to call destroy_vm but leave it the VM manager to take care of the clean-up tasks. The VM manager should be unblocked to do that after the guest either stops by itself (due to the ACPI power-off event) or forcefully stopped. In addition to that, wait for the VM manager to stop too, because it should not be launched again (on a different thread) until all the clean-up tasks have been completed.

The `ppt` driver cannot be cleared until the VM runs so move the
respective `devctl(8)` call back to the end of `destroy_vm`.
Restore the wait period after the VM is destroyed to make sure that
the device is released.

More importantly, do not let `vm_stop` to call `destroy_vm` but
leave it the VM manager to take care of the clean-up tasks.  The
VM manager should be unblocked to do that after the guest either
stops by itself (due to the ACPI power-off event) or forcefully
stopped.  In addition to that, wait for the VM manager to stop too,
because it should not be launched again (on a different thread)
until all the clean-up tasks have been completed.
@pgj pgj force-pushed the fix/wifibox/races_on_restart branch from 77d8494 to 3d6cb5b Compare September 27, 2024 20:13
@pgj pgj merged commit a499a87 into main Sep 27, 2024
@pgj pgj deleted the fix/wifibox/races_on_restart branch September 27, 2024 20:16
pgj added a commit to pgj/freebsd-wifibox-port that referenced this pull request Sep 27, 2024
pgj added a commit to pgj/freebsd-wifibox-port that referenced this pull request Sep 27, 2024
pgj added a commit to pgj/freebsd-wifibox-port that referenced this pull request Sep 27, 2024
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