From nobody Thu May 15 03:03:37 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1513085918295918.0683053461983; Tue, 12 Dec 2017 05:38:38 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA57425C51; Tue, 12 Dec 2017 13:38:36 +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 96E8A5471B; Tue, 12 Dec 2017 13:38:36 +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 520504A468; Tue, 12 Dec 2017 13:38:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vBCDap2d018415 for ; Tue, 12 Dec 2017 08:36:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id C40A15E9C7; Tue, 12 Dec 2017 13:36:51 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C2BD70A0C for ; Tue, 12 Dec 2017 13:36:50 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 12 Dec 2017 14:36:38 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] qemuBuildMemPathStr: Forbid memoryBacking/access for non-numa case 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 12 Dec 2017 13:38:37 +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=3D1448149 If a domain has no numa nodes, that means we don't put any memory-backend-file onto the qemu command line. That in turn means we can't set access=3D'shared'. Therefore, we should produce an error instead of ignoring the setting silently. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- src/qemu/qemu_command.c | 9 +++ tests/qemuxml2argvdata/hugepages-memaccess3.xml | 87 +++++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 3 + 3 files changed, 99 insertions(+) create mode 100644 tests/qemuxml2argvdata/hugepages-memaccess3.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2dd50a214..dfc17ce34 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7682,6 +7682,15 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg, return -1; } =20 + if (def->mem.access !=3D VIR_DOMAIN_MEMORY_ACCESS_DEFAULT && + def->mem.access !=3D VIR_DOMAIN_MEMORY_ACCESS_PRIVATE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("memory access mode '%s' not supported " + "without guest numa node"), + virDomainMemoryAccessTypeToString(def->mem.access)); + return -1; + } + if (qemuGetDomainHupageMemPath(def, cfg, def->mem.hugepages[0].size, &= mem_path) < 0) return -1; =20 diff --git a/tests/qemuxml2argvdata/hugepages-memaccess3.xml b/tests/qemuxm= l2argvdata/hugepages-memaccess3.xml new file mode 100644 index 000000000..8ec38d802 --- /dev/null +++ b/tests/qemuxml2argvdata/hugepages-memaccess3.xml @@ -0,0 +1,87 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 4194304 + 4194304 + + + + + 4 + + hvm + + + + + + + + + + + + + + + + destroy + restart + destroy + + + + + + /usr/bin/qemu-system-x86_64 + + + + + +
+ + +
+ + + +
+ + +
+ + +
+ + + + + + + + + + + +
+ + + + + + + + + +