From nobody Thu May 2 23:14:21 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 1535630526783336.0711738900161; Thu, 30 Aug 2018 05:02:06 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3ADFE308A95D; Thu, 30 Aug 2018 12:02:03 +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 52E062010DA7; Thu, 30 Aug 2018 12:02:02 +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 B74144E9E4; Thu, 30 Aug 2018 12:01:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7UC1wUk019549 for ; Thu, 30 Aug 2018 08:01:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 62CCB2023416; Thu, 30 Aug 2018 12:01:58 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0461A2023415 for ; Thu, 30 Aug 2018 12:01:56 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 30 Aug 2018 14:01:52 +0200 Message-Id: <925f592c75e51060175448dd54919c969174a69f.1535630512.git.mprivozn@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemuBuildMemPathStr: Produce -mem-path more frequently 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.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 30 Aug 2018 12:02:04 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1622455 If a domain is configured to use under we have to honour that setting and produce -mem-path on the command line. We are not doing so if domain has no guest NUMA nodes nor hugepages. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- src/qemu/qemu_command.c | 29 +++++++++++-------= ---- .../fd-memory-no-numa-topology.args | 1 + 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8aa20496bc..df5e5841c2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7531,21 +7531,22 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg, const long system_page_size =3D virGetSystemPageSizeKB(); char *mem_path =3D NULL; =20 - /* - * No-op if hugepages were not requested. - */ - if (!def->mem.nhugepages) + /* There are two cases where we want to put -mem-path onto + * the command line: First one is when there are no guest + * NUMA nodes and hugepages are configured. The second one is + * if user requested file allocation. */ + if (def->mem.nhugepages && + def->mem.hugepages[0].size !=3D system_page_size) { + if (qemuGetDomainHupageMemPath(def, cfg, + def->mem.hugepages[0].size, + &mem_path) < 0) + return -1; + } else if (def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) { + if (qemuGetMemoryBackingPath(def, cfg, "ram", &mem_path) < 0) + return -1; + } else { return 0; - - /* There is one special case: if user specified "huge" - * pages of regular system pages size. - * And there is nothing to do in this case. - */ - if (def->mem.hugepages[0].size =3D=3D system_page_size) - return 0; - - if (qemuGetDomainHupageMemPath(def, cfg, def->mem.hugepages[0].size, &= mem_path) < 0) - return -1; + } =20 if (def->mem.allocation !=3D VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE) virCommandAddArgList(cmd, "-mem-prealloc", NULL); diff --git a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.args b/tests= /qemuxml2argvdata/fd-memory-no-numa-topology.args index 0e0d0830e8..76c7556468 100644 --- a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.args +++ b/tests/qemuxml2argvdata/fd-memory-no-numa-topology.args @@ -10,6 +10,7 @@ QEMU_AUDIO_DRV=3Dnone \ -machine pc-i440fx-wily,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ -m 14336 \ -mem-prealloc \ +-mem-path /var/lib/libvirt/qemu/ram/libvirt/qemu/-1-instance-00000092/ram \ -smp 8,sockets=3D8,cores=3D1,threads=3D1 \ -uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ -display none \ --=20 2.16.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list