From a75920a06a2940e4085b86a07f01b0d45d7eccb8 Mon Sep 17 00:00:00 2001 From: Patrick Mooney Date: Mon, 22 Jul 2024 18:14:27 -0500 Subject: [PATCH] Use block_in_place for device pause/halt 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. --- bin/propolis-server/src/lib/vm/objects.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/propolis-server/src/lib/vm/objects.rs b/bin/propolis-server/src/lib/vm/objects.rs index 8fff5bbb9..86ee5fff5 100644 --- a/bin/propolis-server/src/lib/vm/objects.rs +++ b/bin/propolis-server/src/lib/vm/objects.rs @@ -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 { @@ -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() {