diff options
author | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2018-01-19 10:39:24 +0000 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2018-02-08 21:06:41 +0200 |
commit | aa3c40f6bfae251a483b5c19f5ceb8e11bdbdb18 (patch) | |
tree | a12160ec7416d0997342b84b2360a849ca687f2a /hw/virtio/vhost.c | |
parent | 938eeb640c0a006a3a53ea6f8b409cad56b80a55 (diff) |
vhost: Move log_dirty check
Move the log_dirty check into vhost_section.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/vhost.c')
-rw-r--r-- | hw/virtio/vhost.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 326f168022..4a44e6e6bf 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -27,6 +27,7 @@ #include "hw/virtio/virtio-access.h" #include "migration/blocker.h" #include "sysemu/dma.h" +#include "trace.h" /* enabled until disconnected backend stabilizes */ #define _VHOST_DEBUG 1 @@ -379,8 +380,19 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev, static bool vhost_section(MemoryRegionSection *section) { - return memory_region_is_ram(section->mr) && + bool result; + bool log_dirty = memory_region_get_dirty_log_mask(section->mr) & + ~(1 << DIRTY_MEMORY_MIGRATION); + result = memory_region_is_ram(section->mr) && !memory_region_is_rom(section->mr); + + /* Vhost doesn't handle any block which is doing dirty-tracking other + * than migration; this typically fires on VGA areas. + */ + result &= !log_dirty; + + trace_vhost_section(section->mr->name, result); + return result; } static void vhost_begin(MemoryListener *listener) @@ -510,12 +522,6 @@ static void vhost_region_add_section(struct vhost_dev *dev, trace_vhost_region_add_section(section->mr->name, mrs_gpa, mrs_size, mrs_host); - bool log_dirty = memory_region_get_dirty_log_mask(section->mr) & - ~(1 << DIRTY_MEMORY_MIGRATION); - if (log_dirty) { - return; - } - if (dev->n_tmp_sections) { /* Since we already have at least one section, lets see if * this extends it; since we're scanning in order, we only |