From: David Hildenbrand <david@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
kvm@vger.kernel.org, david@redhat.com
Subject: [Qemu-devel] [PATCH v1 1/6] kvm: require JOIN_MEMORY_REGIONS_WORKS
Date: Mon, 11 Sep 2017 19:49:28 +0200 [thread overview]
Message-ID: <20170911174933.20789-2-david@redhat.com> (raw)
In-Reply-To: <20170911174933.20789-1-david@redhat.com>
We already require DESTROY_MEMORY_REGION_WORKS, JOIN_MEMORY_REGIONS_WORKS
was added just half a year later.
In addition, with flatview overlapping memory regions are first
removed before adding the changed one. So we can't really detect joining
memory regions this way.
Let's just get rid of this special handling.
Signed-off-by: David Hildenbrand <david@redhat.com>
---
accel/kvm/kvm-all.c | 42 +-----------------------------------------
1 file changed, 1 insertion(+), 41 deletions(-)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index f85553a851..985b179ab6 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -79,7 +79,6 @@ struct KVMState
int coalesced_mmio;
struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
bool coalesced_flush_in_progress;
- int broken_set_mem_region;
int vcpu_events;
int robust_singlestep;
int debugregs;
@@ -127,6 +126,7 @@ static bool kvm_immediate_exit;
static const KVMCapabilityInfo kvm_required_capabilites[] = {
KVM_CAP_INFO(USER_MEMORY),
KVM_CAP_INFO(DESTROY_MEMORY_REGION_WORKS),
+ KVM_CAP_INFO(JOIN_MEMORY_REGIONS_WORKS),
KVM_CAP_LAST_INFO
};
@@ -696,7 +696,6 @@ kvm_check_extension_list(KVMState *s, const KVMCapabilityInfo *list)
static void kvm_set_phys_mem(KVMMemoryListener *kml,
MemoryRegionSection *section, bool add)
{
- KVMState *s = kvm_state;
KVMSlot *mem, old;
int err;
MemoryRegion *mr = section->mr;
@@ -763,35 +762,6 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml,
abort();
}
- /* Workaround for older KVM versions: we can't join slots, even not by
- * unregistering the previous ones and then registering the larger
- * slot. We have to maintain the existing fragmentation. Sigh.
- *
- * This workaround assumes that the new slot starts at the same
- * address as the first existing one. If not or if some overlapping
- * slot comes around later, we will fail (not seen in practice so far)
- * - and actually require a recent KVM version. */
- if (s->broken_set_mem_region &&
- old.start_addr == start_addr && old.memory_size < size && add) {
- mem = kvm_alloc_slot(kml);
- mem->memory_size = old.memory_size;
- mem->start_addr = old.start_addr;
- mem->ram = old.ram;
- mem->flags = kvm_mem_flags(mr);
-
- err = kvm_set_user_memory_region(kml, mem);
- if (err) {
- fprintf(stderr, "%s: error updating slot: %s\n", __func__,
- strerror(-err));
- abort();
- }
-
- start_addr += old.memory_size;
- ram += old.memory_size;
- size -= old.memory_size;
- continue;
- }
-
/* register prefix slot */
if (old.start_addr < start_addr) {
mem = kvm_alloc_slot(kml);
@@ -833,10 +803,6 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml,
}
}
- /* in case the KVM bug workaround already "consumed" the new slot */
- if (!size) {
- return;
- }
if (!add) {
return;
}
@@ -1692,12 +1658,6 @@ static int kvm_init(MachineState *ms)
s->coalesced_mmio = kvm_check_extension(s, KVM_CAP_COALESCED_MMIO);
- s->broken_set_mem_region = 1;
- ret = kvm_check_extension(s, KVM_CAP_JOIN_MEMORY_REGIONS_WORKS);
- if (ret > 0) {
- s->broken_set_mem_region = 0;
- }
-
#ifdef KVM_CAP_VCPU_EVENTS
s->vcpu_events = kvm_check_extension(s, KVM_CAP_VCPU_EVENTS);
#endif
--
2.13.5
next prev parent reply other threads:[~2017-09-11 17:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-11 17:49 [Qemu-devel] [PATCH v1 0/6] QEMU: kvm: cleanup kvm_slot handling David Hildenbrand
2017-09-11 17:49 ` David Hildenbrand [this message]
2017-09-11 17:49 ` [Qemu-devel] [PATCH v1 2/6] kvm: factor out alignment of memory section David Hildenbrand
2017-09-11 17:49 ` [Qemu-devel] [PATCH v1 3/6] kvm: use start + size for memory ranges David Hildenbrand
2017-09-11 17:49 ` [Qemu-devel] [PATCH v1 4/6] kvm: we never have overlapping slots in kvm_set_phys_mem() David Hildenbrand
2017-09-11 17:49 ` [Qemu-devel] [PATCH v1 5/6] kvm: kvm_log_start/stop are only called with known sections David Hildenbrand
2017-10-10 9:06 ` Thomas Huth
2017-10-10 13:29 ` Paolo Bonzini
2017-10-16 7:16 ` David Hildenbrand
2017-10-16 8:52 ` Thomas Huth
2017-10-16 9:19 ` David Hildenbrand
2017-09-11 17:49 ` [Qemu-devel] [PATCH v1 6/6] kvm: kvm_log_sync() is only called with known memory sections David Hildenbrand
2017-09-12 7:39 ` [Qemu-devel] [PATCH v1 0/6] QEMU: kvm: cleanup kvm_slot handling Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170911174933.20789-2-david@redhat.com \
--to=david@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rkrcmar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).