qemu-kvm/kvm-memory-Remove-has_coalesced_range-counter.patch
Danilo C. L. de Paula 549f70b1e3 * Wed Sep 04 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.1.0-6.el8
- kvm-memory-Refactor-memory_region_clear_coalescing.patch [bz#1743142]
- kvm-memory-Split-zones-when-do-coalesced_io_del.patch [bz#1743142]
- kvm-memory-Remove-has_coalesced_range-counter.patch [bz#1743142]
- kvm-memory-Fix-up-memory_region_-add-del-_coalescing.patch [bz#1743142]
- kvm-enable-virgl-for-real-this-time.patch [bz#1559740]
- Resolves: bz#1559740
  ([RFE] Enable virgl as TechPreview (qemu))
- Resolves: bz#1743142
  (Boot guest with multiple e1000 devices, qemu will crash after several guest reboots: kvm_mem_ioeventfd_add: error adding ioeventfd: No space left on device (28))
2019-09-04 17:07:50 +01:00

97 lines
3.4 KiB
Diff

From c1db31bce6d2e5f49e34a2e7282e50bea3f92278 Mon Sep 17 00:00:00 2001
From: Peter Xu <peterx@redhat.com>
Date: Fri, 23 Aug 2019 06:14:30 +0100
Subject: [PATCH 3/5] memory: Remove has_coalesced_range counter
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Peter Xu <peterx@redhat.com>
Message-id: <20190823061431.31759-4-peterx@redhat.com>
Patchwork-id: 90135
O-Subject: [RHEL-AV-8.1 qemu-kvm PATCH 3/4] memory: Remove has_coalesced_range counter
Bugzilla: 1743142
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
The has_coalesced_range could potentially be problematic in that it
only works for additions of coalesced mmio ranges but not deletions.
The reason is that has_coalesced_range information can be lost when
the FlatView updates the topology again when the updated region is not
covering the coalesced regions. When that happens, due to
flatrange_equal() is not checking against has_coalesced_range, the new
FlatRange will be seen as the same one as the old and the new
instance (whose has_coalesced_range will be zero) will replace the old
instance (whose has_coalesced_range _could_ be non-zero).
The counter was originally used to make sure every FlatRange will only
notify once for coalesced_io_{add|del} memory listeners, because each
FlatRange can be used by multiple address spaces, so logically
speaking it could be called multiple times. However we should not
limit that, because memory listeners should will only be registered
with specific address space rather than multiple address spaces.
So let's fix this up by simply removing the whole has_coalesced_range.
Fixes: 3ac7d43a6fbb5d4a3
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190820141328.10009-3-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 264ef5a5c52c249ff51a16d141fc03df71714a13)
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
memory.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/memory.c b/memory.c
index 7b24cb8..c7cd43f 100644
--- a/memory.c
+++ b/memory.c
@@ -217,7 +217,6 @@ struct FlatRange {
bool romd_mode;
bool readonly;
bool nonvolatile;
- int has_coalesced_range;
};
#define FOR_EACH_FLAT_RANGE(var, view) \
@@ -654,7 +653,6 @@ static void render_memory_region(FlatView *view,
fr.romd_mode = mr->romd_mode;
fr.readonly = readonly;
fr.nonvolatile = nonvolatile;
- fr.has_coalesced_range = 0;
/* Render the region itself into any gaps left by the current view. */
for (i = 0; i < view->nr && int128_nz(remain); ++i) {
@@ -888,14 +886,6 @@ static void flat_range_coalesced_io_del(FlatRange *fr, AddressSpace *as)
{
CoalescedMemoryRange *cmr;
- if (!fr->has_coalesced_range) {
- return;
- }
-
- if (--fr->has_coalesced_range > 0) {
- return;
- }
-
QTAILQ_FOREACH(cmr, &fr->mr->coalesced, link) {
flat_range_coalesced_io_notify(fr, as, cmr, false);
}
@@ -910,10 +900,6 @@ static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as)
return;
}
- if (fr->has_coalesced_range++) {
- return;
- }
-
QTAILQ_FOREACH(cmr, &mr->coalesced, link) {
flat_range_coalesced_io_notify(fr, as, cmr, true);
}
--
1.8.3.1