From nobody Mon Apr 29 06:29:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1497430136114296.8055937906546; Wed, 14 Jun 2017 01:48:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2AEEA23E6C4; Wed, 14 Jun 2017 08:48:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 02DDB89704; Wed, 14 Jun 2017 08:48:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7A3E04BB7F; Wed, 14 Jun 2017 08:48:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5E8mpjo005174 for ; Wed, 14 Jun 2017 04:48:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id BC0FC78369; Wed, 14 Jun 2017 08:48:51 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 443BE7838B for ; Wed, 14 Jun 2017 08:48:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2AEEA23E6C4 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2AEEA23E6C4 From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 14 Jun 2017 10:48:33 +0200 Message-Id: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Don't try to use hugepages if not enabled X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 14 Jun 2017 08:48:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1214369 My fix 671d18594f4 was incomplete. If domain doesn't have hugepages enalbed, because of missing condition we would still be putting hugepages path onto qemu cmd line. Clean up the conditions so that it's more visible next time. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 12 +++++----- .../qemuxml2argv-cpu-numa-memshared.args | 26 ++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.= args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3e1552a1b..8c12b2be0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3408,23 +3408,23 @@ qemuBuildMemoryBackendStr(virJSONValuePtr *backendP= rops, =20 if (pagesize || mem->nvdimmPath || memAccess || def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) { *backendType =3D "memory-backend-file"; =20 - if (mem->nvdimmPath) { + if (pagesize) { + if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) <= 0) + goto cleanup; + prealloc =3D true; + } else if (mem->nvdimmPath) { if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0) goto cleanup; prealloc =3D true; - } else if (!pagesize && def->mem.source =3D=3D VIR_DOMAIN_MEMORY_S= OURCE_FILE) { + } else { /* We can have both pagesize and mem source. If that's the cas= e, * prefer hugepages as those are more specific. */ if (VIR_STRDUP(memPath, cfg->memoryBackingDir) < 0) goto cleanup; - } else { - if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) <= 0) - goto cleanup; - prealloc =3D true; } =20 if (virJSONValueObjectAdd(props, "B:prealloc", prealloc, "s:mem-path", memPath, diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args b/= tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args new file mode 100644 index 000000000..cceffce3a --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args @@ -0,0 +1,26 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 16,sockets=3D2,cores=3D4,threads=3D2 \ +-object memory-backend-file,id=3Dram-node0,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +share=3Dyes,size=3D112197632 \ +-numa node,nodeid=3D0,cpus=3D0-7,memdev=3Dram-node0 \ +-object memory-backend-file,id=3Dram-node1,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +share=3Dno,size=3D112197632 \ +-numa node,nodeid=3D1,cpus=3D8-15,memdev=3Dram-node1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot n \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 43d3f1bd3..799aea9fa 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1539,10 +1539,11 @@ mymain(void) DO_TEST_PARSE_ERROR("cpu-numa3", NONE); DO_TEST_FAILURE("cpu-numa-disjoint", NONE); DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA); DO_TEST_FAILURE("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_RAM); DO_TEST_FAILURE("cpu-numa-memshared", NONE); + DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("cpu-host-model", NONE); DO_TEST("cpu-host-model-vendor", NONE); skipLegacyCPUs =3D true; DO_TEST("cpu-host-model-fallback", NONE); DO_TEST_FAILURE("cpu-host-model-nofallback", NONE); --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list