From nobody Wed May 8 22:51:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1624345956; cv=none; d=zohomail.com; s=zohoarc; b=aiyDC/+wabKQdnA/zrOCTIFBDMBJbI9IdRwAE2FsDmbY3E7IFlFoXe298PSkxD56Btkmj8+CRdEM9i/SO8Wi6GrYEPkqBu4H5vwx1E8FLA97ZuPA71NNOp/HqQMtxhOkp7oKoE8Qis1+h4yIveQRE4a6WkYt9HnC3IS8Cg5AUo8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624345956; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=XYjgwELFrWk3l3qOA4TCTXklgYrpo7XNcsT1Vkwm/Hc=; b=Qk0vCA+TXL76ddc5eFDKcY+pxsoPV9KvlqkLO8uRKwUyX7J5EmP+YmTUvSi+w+Sn2WyelJ83soTVNglKANndxhjUJgvI8WEOeQ4DwqggVOpxmjwOgg6bGNrrk6p9yCfE8MHZFaOTlp03kqG+OJJZUN8dzRpvb7pUfS59+HFhFPI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1624345956754320.73001145206376; Tue, 22 Jun 2021 00:12:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-110-KIEyt3SfOgmxYWmkByn-Jg-1; Tue, 22 Jun 2021 03:11:50 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id E06B3106B7DB; Tue, 22 Jun 2021 07:11:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B85CB26370; Tue, 22 Jun 2021 07:11:43 +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 37EE21809C99; Tue, 22 Jun 2021 07:11:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15M7BgqN009788 for ; Tue, 22 Jun 2021 03:11:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2E85D1017CE8; Tue, 22 Jun 2021 07:11:42 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id A583B100F49F for ; Tue, 22 Jun 2021 07:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624345955; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XYjgwELFrWk3l3qOA4TCTXklgYrpo7XNcsT1Vkwm/Hc=; b=LhbJwMlk4j8XyB3hZFgJi7TDpMXlx6DciMwgVeNMoAu7cKYwMyNcjvwJ/IHnGK7OhoIso5 /vkNLHtCUKvGf5bRzwEYyXxHBdH7CiAgFn4sRcbBM7fwqgk2lvbBjt2Q9RViWukahkYA3M tlc1NPIGqe8vPIaJ8nlgv1Z8lMauaiA= X-MC-Unique: KIEyt3SfOgmxYWmkByn-Jg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu: Don't use memory-backend-memfd for NVDIMMs Date: Tue, 22 Jun 2021 09:11:35 +0200 Message-Id: <59c4a095841ba67262ca84f5db55112d1a64e7a3.1624345895.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If guest is configured to use memfd then the function that build memory-backend-* part of command line will put memory-backend-memfd, always. Even for NVDIMMs. This is not correct, because NVDIMMs need a backing path (usually to a real host NVDIMM device). Therefore, regardless of memfd being requested, we have to stick with memory-backend-file. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 3 ++- .../memfd-memory-numa.x86_64-latest.args | 6 ++++-- tests/qemuxml2argvdata/memfd-memory-numa.xml | 11 +++++++++++ tests/qemuxml2xmltest.c | 3 ++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ea513693f7..0473e7deaa 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3052,7 +3052,8 @@ qemuBuildMemoryBackendProps(virJSONValue **backendPro= ps, =20 props =3D virJSONValueNewObject(); =20 - if (def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_MEMFD) { + if (!mem->nvdimmPath && + def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_MEMFD) { backendType =3D "memory-backend-memfd"; =20 if (useHugepage) { diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args b/= tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args index 5e54908666..3b33db3c55 100644 --- a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args @@ -10,13 +10,15 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-instance-00000092/= .config \ -name guest=3Dinstance-00000092,debug-threads=3Don \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-instance-00000092/master-key.aes"}' \ --machine pc-i440fx-2.3,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-machine pc-i440fx-2.3,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,nvdimm= =3Don \ -cpu qemu64 \ --m 14336 \ +-m size=3D14680064k,slots=3D16,maxmem=3D1099511627776k \ -overcommit mem-lock=3Doff \ -smp 8,sockets=3D1,dies=3D1,cores=3D8,threads=3D1 \ -object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":tru= e,"hugetlbsize":2097152,"share":true,"prealloc":true,"size":15032385536,"ho= st-nodes":[3],"policy":"preferred"}' \ -numa node,nodeid=3D0,cpus=3D0-7,memdev=3Dram-node0 \ +-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/= tmp/nvdimm","share":true,"prealloc":true,"size":536870912,"host-nodes":[3],= "policy":"preferred"}' \ +-device nvdimm,node=3D0,memdev=3Dmemnvdimm0,id=3Dnvdimm0,slot=3D0 \ -uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ -display none \ -no-user-config \ diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.xml b/tests/qemuxml2a= rgvdata/memfd-memory-numa.xml index 3f448790a6..d9e1a9f564 100644 --- a/tests/qemuxml2argvdata/memfd-memory-numa.xml +++ b/tests/qemuxml2argvdata/memfd-memory-numa.xml @@ -1,6 +1,7 @@ instance-00000092 126f2720-6f8e-45ab-a886-ec9277079a67 + 1099511627776 14680064 14680064 @@ -41,5 +42,15 @@
+ + + /tmp/nvdimm + + + 523264 + 0 + +
+ diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 40e027aaa4..c5005d41a0 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1305,7 +1305,8 @@ mymain(void) DO_TEST("memfd-memory-numa", QEMU_CAPS_OBJECT_MEMORY_MEMFD, QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB, - QEMU_CAPS_OBJECT_MEMORY_FILE); + QEMU_CAPS_OBJECT_MEMORY_FILE, + QEMU_CAPS_DEVICE_NVDIMM); DO_TEST("memfd-memory-default-hugepage", QEMU_CAPS_OBJECT_MEMORY_MEMFD, QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB, --=20 2.31.1