Skip to content

Commit

Permalink
Use block_in_place for device pause/halt
Browse files Browse the repository at this point in the history
This should address cases where propolis-server was found to be wedged
when the viona interrupt poller task happened to be assigned to the same
tokio thread as the synchronous pause/halt action.
  • Loading branch information
pfmooney committed Jul 22, 2024
1 parent 0dd258e commit a75920a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bin/propolis-server/src/lib/vm/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,11 @@ impl VmObjectsLocked {

/// Pauses all of a VM's devices.
async fn pause_devices(&self) {
self.for_each_device(|name, dev| {
info!(self.log, "sending pause request to {}", name);
dev.pause();
tokio::task::block_in_place(|| {
self.for_each_device(|name, dev| {
info!(self.log, "sending pause request to {}", name);
dev.pause();
});
});

struct NamedFuture {
Expand Down Expand Up @@ -396,9 +398,11 @@ impl VmObjectsLocked {
/// Stops all of a VM's devices and detaches its block backends from their
/// devices.
async fn halt_devices(&self) {
self.for_each_device(|name, dev| {
info!(self.log, "sending halt request to {}", name);
dev.halt();
tokio::task::block_in_place(|| {
self.for_each_device(|name, dev| {
info!(self.log, "sending halt request to {}", name);
dev.halt();
});
});

for (name, backend) in self.block_backends.iter() {
Expand Down

0 comments on commit a75920a

Please sign in to comment.