From nobody Fri May 3 12:16:32 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1534169621197860.1228230961374; Mon, 13 Aug 2018 07:13:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B92B33084039; Mon, 13 Aug 2018 14:13:38 +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 82F2326FAA; Mon, 13 Aug 2018 14:13:38 +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 3AAC94A460; Mon, 13 Aug 2018 14:13:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7DEDaRh018253 for ; Mon, 13 Aug 2018 10:13:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 834CC112D18A; Mon, 13 Aug 2018 14:13:36 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-61.brq.redhat.com [10.40.204.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09AC11007093 for ; Mon, 13 Aug 2018 14:13:34 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 13 Aug 2018 16:13:31 +0200 Message-Id: <9555094cbc88a6ff9f938ce94289ecb7c1d0ac4b.1534169611.git.mprivozn@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Prefer nvdimmPath over hugepages for memory-backend-file 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 13 Aug 2018 14:13:39 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If a domain has hugepages configured and we're currently building memory-backend-file for a nvdimm device that domain has we will put hugepages path onto the command line. It should have been nvdimm path configured in the XML. Signed-off-by: Michal Privoznik Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 10 ++-- .../hugepages-nvdimm.x86_64-latest.args | 38 ++++++++++++++ tests/qemuxml2argvdata/hugepages-nvdimm.xml | 59 ++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 1 + tests/qemuxml2xmloutdata/hugepages-nvdimm.xml | 1 + tests/qemuxml2xmltest.c | 1 + 6 files changed, 105 insertions(+), 5 deletions(-) create mode 100644 tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.a= rgs create mode 100644 tests/qemuxml2argvdata/hugepages-nvdimm.xml create mode 120000 tests/qemuxml2xmloutdata/hugepages-nvdimm.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a3fadc505d..ddb90895e0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3148,14 +3148,14 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backen= dProps, if (useHugepage || mem->nvdimmPath || memAccess || def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) { =20 - if (useHugepage) { - if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) <= 0) - goto cleanup; - prealloc =3D true; - } else if (mem->nvdimmPath) { + if (mem->nvdimmPath) { if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0) goto cleanup; prealloc =3D true; + } else if (useHugepage) { + if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) <= 0) + goto cleanup; + prealloc =3D true; } else { /* We can have both pagesize and mem source. If that's the cas= e, * prefer hugepages as those are more specific. */ diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args b/t= ests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args new file mode 100644 index 0000000000..3a6dd364da --- /dev/null +++ b/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args @@ -0,0 +1,38 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,nvdimm=3Don \ +-m size=3D1048576k,slots=3D16,maxmem=3D1099511627776k \ +-realtime mlock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-object memory-backend-file,id=3Dram-node0,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=3Dyes,size=3D= 1073741824 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ +-object memory-backend-file,id=3Dmemnvdimm0,prealloc=3Dyes,mem-path=3D/tmp= /nvdimm,\ +share=3Dyes,size=3D536870912 \ +-device nvdimm,node=3D0,memdev=3Dmemnvdimm0,id=3Dnvdimm0,slot=3D0 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.xml b/tests/qemuxml2ar= gvdata/hugepages-nvdimm.xml new file mode 100644 index 0000000000..cdc409ff32 --- /dev/null +++ b/tests/qemuxml2argvdata/hugepages-nvdimm.xml @@ -0,0 +1,59 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1099511627776 + 1267710 + 1267710 + + + + + + + 2 + + hvm + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + +
+ + +
+ + +
+ + + + + +
+ + + + /tmp/nvdimm + + + 523264 + 0 + +
+ + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 96482a84a1..8a7b82a1f2 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -994,6 +994,7 @@ mymain(void) DO_TEST_FAILURE("hugepages-memaccess3", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_CAPS_LATEST("hugepages-nvdimm"); DO_TEST("nosharepages", QEMU_CAPS_MEM_MERGE); DO_TEST("disk-cdrom", NONE); DO_TEST_CAPS_LATEST("disk-cdrom"); diff --git a/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml b/tests/qemuxml2= xmloutdata/hugepages-nvdimm.xml new file mode 120000 index 0000000000..8288d3c58f --- /dev/null +++ b/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/hugepages-nvdimm.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 7fe5043519..8e58c7b844 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -339,6 +339,7 @@ mymain(void) DO_TEST("hugepages-shared", NONE); DO_TEST("hugepages-memaccess", NONE); DO_TEST("hugepages-memaccess2", NONE); + DO_TEST("hugepages-nvdimm", NONE); DO_TEST("nosharepages", NONE); DO_TEST("restore-v2", NONE); DO_TEST("migrate", NONE); --=20 2.16.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list