From ae990e6cd77a4e6004b7abc6d293598910abca63 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Mon, 16 Oct 2017 16:42:56 +0200 Subject: memory: call log_start after region_add It might be confusing for some listener implementations that implement both, region_add and log_start (e.g. KVM) if we call log_start before an actual region was added using region_add. This makes current KVM code trigger an assertion ("kvm_section_update_flags: error finding slot"). So let's just reverse the order instead of tolerating log_start on yet unknown regions. Reported-by: Thomas Huth Signed-off-by: David Hildenbrand Message-Id: <20171016144302.24284-2-david@redhat.com> Tested-by: Joe Clifford Signed-off-by: Paolo Bonzini --- memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'memory.c') diff --git a/memory.c b/memory.c index b637c12bad..3e1558a031 100644 --- a/memory.c +++ b/memory.c @@ -2607,12 +2607,12 @@ static void listener_add_address_space(MemoryListener *listener, .offset_within_address_space = int128_get64(fr->addr.start), .readonly = fr->readonly, }; - if (fr->dirty_log_mask && listener->log_start) { - listener->log_start(listener, §ion, 0, fr->dirty_log_mask); - } if (listener->region_add) { listener->region_add(listener, §ion); } + if (fr->dirty_log_mask && listener->log_start) { + listener->log_start(listener, §ion, 0, fr->dirty_log_mask); + } } if (listener->commit) { listener->commit(listener); -- cgit v1.2.3