From nobody Tue May 7 00:31:42 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 1496770212806703.7477235825964; Tue, 6 Jun 2017 10:30:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 52B6180F75; Tue, 6 Jun 2017 17:30:11 +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 E9CA971CA2; Tue, 6 Jun 2017 17:30:10 +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 20D044BB7F; Tue, 6 Jun 2017 17:30:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v569gIKG020175 for ; Tue, 6 Jun 2017 05:42:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9C3BB17B80; Tue, 6 Jun 2017 09:42:18 +0000 (UTC) Received: from moe.brq.redhat.com (dhcp129-131.brq.redhat.com [10.34.129.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2551217B9A for ; Tue, 6 Jun 2017 09:42:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 52B6180F75 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.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 52B6180F75 From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 6 Jun 2017 11:42:12 +0200 Message-Id: <509b3b77845a0d48f876f1b0a571a5de3e78ff77.1496742132.git.mprivozn@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Allow memAccess for hugepages again 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 06 Jun 2017 17:30:12 +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=3D1458638 Historically, we've always supported memAccess for domains backed by hugepages. However, somewhere along the way we've regressed and stopped allowing such configuration. Fix it. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 4 +- .../qemuxml2argv-hugepages-memaccess.args | 38 ++++++++++++++++++ .../qemuxml2argv-hugepages-memaccess.xml | 45 ++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess= .args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess= .xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 015af1036..2a076301f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3361,7 +3361,9 @@ qemuBuildMemoryBackendStr(virJSONValuePtr *backendPro= ps, return -1; =20 if (pagesize || mem->nvdimmPath || - def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) { + def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE || + (memAccess =3D=3D VIR_DOMAIN_MEMORY_ACCESS_SHARED && + def->mem.nhugepages)) { *backendType =3D "memory-backend-file"; =20 if (mem->nvdimmPath) { diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.args b= /tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.args new file mode 100644 index 000000000..c3f2c5397 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.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 QEMUGuest1 \ +-S \ +-M pc \ +-m 4096 \ +-smp 4,sockets=3D4,cores=3D1,threads=3D1 \ +-object memory-backend-file,id=3Dram-node0,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=3D1073741824,\ +host-nodes=3D0-3,policy=3Dbind \ +-numa node,nodeid=3D0,cpus=3D0,memdev=3Dram-node0 \ +-object memory-backend-file,id=3Dram-node1,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=3Dyes,size=3D= 1073741824,\ +host-nodes=3D0-3,policy=3Dbind \ +-numa node,nodeid=3D1,cpus=3D1,memdev=3Dram-node1 \ +-object memory-backend-file,id=3Dram-node2,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,share=3Dno,size=3D1= 073741824,\ +host-nodes=3D0-3,policy=3Dbind \ +-numa node,nodeid=3D2,cpus=3D2,memdev=3Dram-node2 \ +-object memory-backend-file,id=3Dram-node3,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=3D1073741824,\ +host-nodes=3D3,policy=3Dbind \ +-numa node,nodeid=3D3,cpus=3D3,memdev=3Dram-node3 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.xml b/= tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.xml new file mode 100644 index 000000000..55379dcab --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.xml @@ -0,0 +1,45 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 4194304 + 4194304 + + + + + + + 4 + + + + + + hvm + + + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + +
+ + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b7d7cc2ab..836f413ce 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -819,6 +819,7 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-pages5", QEMU_CAPS_MEM_PATH); DO_TEST("hugepages-pages6", NONE); + DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("nosharepages", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MEM_MERGE); DO_TEST("disk-cdrom", NONE); DO_TEST("disk-iscsi", NONE); --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list