Skip to content

Commit 1db8858

Browse files
weltlingrbradford
authored andcommitted
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>
1 parent dd2f18e commit 1db8858

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

virtio-devices/src/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ impl BlockEpollHandler {
317317
.add_used(desc_chain.memory(), desc_chain.head_index(), 1)
318318
.map_err(Error::QueueAddUsed)?;
319319
queue
320-
.enable_notification(self.mem.memory().deref())
320+
.enable_notification(desc_chain.memory())
321321
.map_err(Error::QueueEnableNotification)?;
322322
continue;
323323
}
@@ -404,7 +404,7 @@ impl BlockEpollHandler {
404404
.add_used(desc_chain.memory(), desc_chain.head_index(), len)
405405
.map_err(Error::QueueAddUsed)?;
406406
queue
407-
.enable_notification(self.mem.memory().deref())
407+
.enable_notification(desc_chain.memory())
408408
.map_err(Error::QueueEnableNotification)?;
409409
}
410410
}

0 commit comments

Comments
 (0)