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 <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-06-20 15:12:11 +02:00
committed by Rob Bradford
parent dd2f18e73e
commit 1db8858fac

View File

@@ -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)?;
}
}