From 1db8858fac037277f6d744db8dbcb637b1295b9b Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 20 Jun 2026 15:12:11 +0200 Subject: [PATCH] virtio-devices: block: Reuse descriptor chain's memory for queue enable The two synchronous completion paths add the head to the used ring with desc_chain.memory() but reload self.mem.memory() to enable notifications. Keep both on the snapshot the chain was parsed from so the used ring update and the notification enable always act on one guest memory view rather than two independent atomic loads. Signed-off-by: Anatol Belski --- virtio-devices/src/block.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virtio-devices/src/block.rs b/virtio-devices/src/block.rs index 202c02c83..30bbf9296 100644 --- a/virtio-devices/src/block.rs +++ b/virtio-devices/src/block.rs @@ -317,7 +317,7 @@ impl BlockEpollHandler { .add_used(desc_chain.memory(), desc_chain.head_index(), 1) .map_err(Error::QueueAddUsed)?; queue - .enable_notification(self.mem.memory().deref()) + .enable_notification(desc_chain.memory()) .map_err(Error::QueueEnableNotification)?; continue; } @@ -404,7 +404,7 @@ impl BlockEpollHandler { .add_used(desc_chain.memory(), desc_chain.head_index(), len) .map_err(Error::QueueAddUsed)?; queue - .enable_notification(self.mem.memory().deref()) + .enable_notification(desc_chain.memory()) .map_err(Error::QueueEnableNotification)?; } }