From nobody Sat Feb 7 06:55:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15058254915061017.7284092094313; Tue, 19 Sep 2017 05:51:31 -0700 (PDT) Received: from localhost ([::1]:42661 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duHzu-0004jS-Qd for importer@patchew.org; Tue, 19 Sep 2017 08:51:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duHfP-0004Cd-LQ for qemu-devel@nongnu.org; Tue, 19 Sep 2017 08:30:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duHfK-0005TO-0X for qemu-devel@nongnu.org; Tue, 19 Sep 2017 08:30:19 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:34414) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duHfJ-0005Sz-QK for qemu-devel@nongnu.org; Tue, 19 Sep 2017 08:30:13 -0400 Received: by mail-wm0-x243.google.com with SMTP id i131so3749880wma.1 for ; Tue, 19 Sep 2017 05:30:13 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-246-117.clienti.tiscali.it. [78.12.246.117]) by smtp.gmail.com with ESMTPSA id k18sm1292878wmd.22.2017.09.19.05.30.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Sep 2017 05:30:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=LS0BuA7ZSohUgDY7Bs9FC909dO8teSCPWNEseucNpHg=; b=jODD3N18Du5D1Z5cqYFpjo6blMYaD4mrXjlEeK3AKUh6Tcp6GmBpkpO9ia7tJRFv2d MUDMo6EipOpkzlFAWmuIRqt4pK+HOxd7v3PkqdGHj51O7yrMcVo8lxF/7FkqI+sIhyUF bFOALMVjr+TGjjDVKramKzjvr8K+dvFrJiQhbPu7i/PyeczVqBkReglBx0AHLB0zgmpI cEzCFvER9W3wHZ0dEI+/i5SCoR9t/vFsZ49p4VKQ6/qtq2wpO1POA8TRNyRKA9i6T8Md Ega8f4g2bKPmDBuXQCAEoK7yBNb2xPV9N/d8hrp6osVlhq7HH7j9CFB6fj5p790LqpgA ZJuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=LS0BuA7ZSohUgDY7Bs9FC909dO8teSCPWNEseucNpHg=; b=GeuQHtm29yKGV9B8Ti5e3F4N4SsGPKuhebrTkSK1Ry06Wnz0BzDPEkRr6EopaJE8/c 5/J6GSgdMAZlhJLiqqOymh96ORL6Jp+RPgzjAMe0V4BVweMoZgpfJokN/UN0nIZjScNk WcHojIkN6QksHhT0Rfj0sLWd7DotK7SP5hXQV6KCjXXSl84ebMb5h3QrZ/PNgsfPgr++ 1UdTVSa2yhcQ/DTXejk7j6cctujdDMHoSQMTw8J60bKsC+/uSmpxxKiLSziJ5aiujQkD NefV/sxDiOyPksf8QXI8KfjKOCSdj46MRyC+etrqH+rvlB6zgIE6IH3I8YBwFBi9VvHZ I2GA== X-Gm-Message-State: AHPjjUgNlkupQ6GkYqoHJRFmWOQtZ9wab7OjifjDHS5yOdgbKmD3mxM6 rpcp4ohmRwryh+83YXeEGTQm91Sb X-Google-Smtp-Source: AOwi7QAImFRWeRg99Q8JXSCq+fGoUWo3nXZeWS6kgusfy99P7s2GQIjDKIzpI4I9+b8jYzH3LACp/w== X-Received: by 10.28.175.75 with SMTP id y72mr896711wme.20.1505824212508; Tue, 19 Sep 2017 05:30:12 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 14:29:15 +0200 Message-Id: <1505824179-21541-27-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1505824179-21541-1-git-send-email-pbonzini@redhat.com> References: <1505824179-21541-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 26/50] kvm: require JOIN_MEMORY_REGIONS_WORKS X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand 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 Message-Id: <20170911174933.20789-2-david@redhat.com> Signed-off-by: Paolo Bonzini --- 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 f85553a..985b179 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[] =3D { KVM_CAP_INFO(USER_MEMORY), KVM_CAP_INFO(DESTROY_MEMORY_REGION_WORKS), + KVM_CAP_INFO(JOIN_MEMORY_REGIONS_WORKS), KVM_CAP_LAST_INFO }; =20 @@ -696,7 +696,6 @@ kvm_check_extension_list(KVMState *s, const KVMCapabili= tyInfo *list) static void kvm_set_phys_mem(KVMMemoryListener *kml, MemoryRegionSection *section, bool add) { - KVMState *s =3D kvm_state; KVMSlot *mem, old; int err; MemoryRegion *mr =3D section->mr; @@ -763,35 +762,6 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, abort(); } =20 - /* Workaround for older KVM versions: we can't join slots, even no= t 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 =3D=3D start_addr && old.memory_size < size && = add) { - mem =3D kvm_alloc_slot(kml); - mem->memory_size =3D old.memory_size; - mem->start_addr =3D old.start_addr; - mem->ram =3D old.ram; - mem->flags =3D kvm_mem_flags(mr); - - err =3D kvm_set_user_memory_region(kml, mem); - if (err) { - fprintf(stderr, "%s: error updating slot: %s\n", __func__, - strerror(-err)); - abort(); - } - - start_addr +=3D old.memory_size; - ram +=3D old.memory_size; - size -=3D old.memory_size; - continue; - } - /* register prefix slot */ if (old.start_addr < start_addr) { mem =3D kvm_alloc_slot(kml); @@ -833,10 +803,6 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, } } =20 - /* 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) =20 s->coalesced_mmio =3D kvm_check_extension(s, KVM_CAP_COALESCED_MMIO); =20 - s->broken_set_mem_region =3D 1; - ret =3D kvm_check_extension(s, KVM_CAP_JOIN_MEMORY_REGIONS_WORKS); - if (ret > 0) { - s->broken_set_mem_region =3D 0; - } - #ifdef KVM_CAP_VCPU_EVENTS s->vcpu_events =3D kvm_check_extension(s, KVM_CAP_VCPU_EVENTS); #endif --=20 1.8.3.1