Skip to content
Snippets Groups Projects
Commit fc5c4a7a authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Justin M. Forbes
Browse files

vhost: fix dirty page handling


vhost was passing a physical address to cpu_physical_memory_set_dirty,
which is wrong: we need to translate to ram address first.

Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>

Note: this lead to crashes during migration, so the patch
is needed on the stable branch too.
parent 22da30fc
No related branches found
No related tags found
No related merge requests found
...@@ -47,8 +47,10 @@ static void vhost_dev_sync_region(struct vhost_dev *dev, ...@@ -47,8 +47,10 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
log = __sync_fetch_and_and(from, 0); log = __sync_fetch_and_and(from, 0);
while ((bit = sizeof(log) > sizeof(int) ? while ((bit = sizeof(log) > sizeof(int) ?
ffsll(log) : ffs(log))) { ffsll(log) : ffs(log))) {
ram_addr_t ram_addr;
bit -= 1; bit -= 1;
cpu_physical_memory_set_dirty(addr + bit * VHOST_LOG_PAGE); ram_addr = cpu_get_physical_page_desc(addr + bit * VHOST_LOG_PAGE);
cpu_physical_memory_set_dirty(ram_addr);
log &= ~(0x1ull << bit); log &= ~(0x1ull << bit);
} }
addr += VHOST_LOG_CHUNK; addr += VHOST_LOG_CHUNK;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment