From nobody Fri Dec 19 06:39:20 2025 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=1668440149; cv=none; d=zohomail.com; s=zohoarc; b=EBhfaJLRHVkFv5RWLW+xqFxmrDauxbm8G2w44IrkYbtLBdjqD+Oo4cd+CzWh0jWcG0SxRmUqmzU/tGjIIz1iIc6Tu6jFjyVN2MH0VvkjrqxBKUFDCqHJ71GN/b239+TtS43bYVfftXsWXvQD4f8t1tY2motk+8Xd4KAcSq4gRNk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668440149; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VHJlt2d4d1/J1ujw0piUngLfwMXPMHP4a4ePFKcYjCg=; b=eJNz4HOvJ2USKiticvc8IFLMFP5qijufMAYTi8oMS9P1I8KxzeK86RboqFDl1fwsU8PbXmG/0TvShp4+D0nhNBNDrJFOhU3d8xdz6h9xEbBaTt95bwPxFQidaKeyAvX0hVqPP7P4jvrkcF+A2usYiSBFPnUmB5QvKcoCOLuNlTs= 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 1668440149119755.1191208972964; Mon, 14 Nov 2022 07:35:49 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-662-bWUqqpWRN-SClF-CtGWa7A-1; Mon, 14 Nov 2022 10:35:45 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CF58518153EC; Mon, 14 Nov 2022 15:35:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD4ADFD48; Mon, 14 Nov 2022 15:35:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A6375194658C; Mon, 14 Nov 2022 15:35:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E88FB1946589 for ; Mon, 14 Nov 2022 15:35:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D939C475061; Mon, 14 Nov 2022 15:35:39 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DDA2475060 for ; Mon, 14 Nov 2022 15:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668440147; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VHJlt2d4d1/J1ujw0piUngLfwMXPMHP4a4ePFKcYjCg=; b=SHEgOEulJS0047c4V5cuHlHgr4DslOERYu2MttmyYLlp74CLNCnB/jjX+xHx5zaCIWiBD8 zhe+EOhQK1Q3dGTSt+jloyz5GTMJMAkbhq78+Zx09PMGbTrRORaw5sSCtjf+DkaTlzEC7k MRmcVQuZAGVnG18U7jOgQPF6wIM8VsM= X-MC-Unique: bWUqqpWRN-SClF-CtGWa7A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 5/7] qemu: Generate thread-context object for memory devices Date: Mon, 14 Nov 2022 16:35:33 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1668440150643100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When generating memory for memory devices memory-backend-* might be used. This means, we may need to generate thread-context objects too. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_command.c | 9 +++++++++ .../hugepages-memaccess.x86_64-latest.args | 3 ++- .../hugepages-memaccess2.x86_64-latest.args | 3 ++- .../hugepages-numa-default-dimm.x86_64-latest.args | 3 ++- .../memfd-memory-numa.x86_64-latest.args | 3 ++- .../memory-hotplug-dimm-addr.x86_64-latest.args | 3 ++- .../memory-hotplug-virtio-mem.x86_64-latest.args | 3 ++- .../pages-dimm-discard.x86_64-latest.args | 3 ++- 8 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a0f2644ba1..49ecd91300 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3503,6 +3503,7 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd, qemuDomainObjPrivate *priv) { g_autoptr(virJSONValue) props =3D NULL; + g_autoptr(virJSONValue) tcProps =3D NULL; g_autofree char *alias =3D NULL; =20 if (!mem->info.alias) { @@ -3517,6 +3518,14 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd, priv, def, mem, true, false) < 0) return -1; =20 + if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0) + return -1; + + if (tcProps && + qemuBuildObjectCommandlineFromJSON(cmd, tcProps, + priv->qemuCaps) < 0) + return -1; + if (qemuBuildObjectCommandlineFromJSON(cmd, props, priv->qemuCaps) < 0) return -1; =20 diff --git a/tests/qemuxml2argvdata/hugepages-memaccess.x86_64-latest.args = b/tests/qemuxml2argvdata/hugepages-memaccess.x86_64-latest.args index 9db085fd1d..8342a30c86 100644 --- a/tests/qemuxml2argvdata/hugepages-memaccess.x86_64-latest.args +++ b/tests/qemuxml2argvdata/hugepages-memaccess.x86_64-latest.args @@ -39,7 +39,8 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -no-acpi \ -boot strict=3Don \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ --object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/de= v/hugepages2M/libvirt/qemu/-1-QEMUGuest1","share":true,"prealloc":true,"siz= e":536870912,"host-nodes":[0,1,2,3],"policy":"bind"}' \ +-object '{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[= 0,1,2,3]}' \ +-object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/de= v/hugepages2M/libvirt/qemu/-1-QEMUGuest1","share":true,"prealloc":true,"siz= e":536870912,"host-nodes":[0,1,2,3],"policy":"bind","prealloc-context":"tc-= memdimm0"}' \ -device '{"driver":"pc-dimm","node":1,"memdev":"memdimm0","id":"dimm0","sl= ot":0,"addr":4294967296}' \ -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ diff --git a/tests/qemuxml2argvdata/hugepages-memaccess2.x86_64-latest.args= b/tests/qemuxml2argvdata/hugepages-memaccess2.x86_64-latest.args index 37f6dfabe9..f73da5865d 100644 --- a/tests/qemuxml2argvdata/hugepages-memaccess2.x86_64-latest.args +++ b/tests/qemuxml2argvdata/hugepages-memaccess2.x86_64-latest.args @@ -39,7 +39,8 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -no-acpi \ -boot strict=3Don \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ --object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/de= v/hugepages2M/libvirt/qemu/-1-QEMUGuest1","share":true,"prealloc":true,"siz= e":536870912,"host-nodes":[0,1,2,3],"policy":"bind"}' \ +-object '{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[= 0,1,2,3]}' \ +-object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/de= v/hugepages2M/libvirt/qemu/-1-QEMUGuest1","share":true,"prealloc":true,"siz= e":536870912,"host-nodes":[0,1,2,3],"policy":"bind","prealloc-context":"tc-= memdimm0"}' \ -device '{"driver":"pc-dimm","node":1,"memdev":"memdimm0","id":"dimm0","sl= ot":0,"addr":4294967296}' \ -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ diff --git a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.x86_64-late= st.args b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.x86_64-latest.= args index 015464bded..3b8dfeea16 100644 --- a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.x86_64-latest.args +++ b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.x86_64-latest.args @@ -29,7 +29,8 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-fedora/.config \ -no-acpi \ -boot strict=3Don \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ --object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/de= v/hugepages1G/libvirt/qemu/-1-fedora","prealloc":true,"size":1073741824,"ho= st-nodes":[1,2,3],"policy":"bind"}' \ +-object '{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[= 1,2,3]}' \ +-object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/de= v/hugepages1G/libvirt/qemu/-1-fedora","prealloc":true,"size":1073741824,"ho= st-nodes":[1,2,3],"policy":"bind","prealloc-context":"tc-memdimm0"}' \ -device '{"driver":"pc-dimm","node":0,"memdev":"memdimm0","id":"dimm0","sl= ot":0}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args b/= tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args index c51bb6f828..4748f0fbb2 100644 --- a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args @@ -30,7 +30,8 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-instance-00000092/.c= onfig \ -no-acpi \ -boot strict=3Don \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ --object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/= tmp/nvdimm","share":true,"prealloc":true,"prealloc-threads":8,"size":536870= 912,"host-nodes":[3],"policy":"preferred"}' \ +-object '{"qom-type":"thread-context","id":"tc-memnvdimm0","node-affinity"= :[3]}' \ +-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/= tmp/nvdimm","share":true,"prealloc":true,"prealloc-threads":8,"size":536870= 912,"host-nodes":[3],"policy":"preferred","prealloc-context":"tc-memnvdimm0= "}' \ -device '{"driver":"nvdimm","node":0,"memdev":"memnvdimm0","id":"nvdimm0",= "slot":0}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x3"}' \ diff --git a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.= args b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args index ac24c77a2b..4e9bbde448 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.x86_64-latest.args @@ -29,7 +29,8 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -no-acpi \ -boot strict=3Don \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ --object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/de= v/hugepages2M/libvirt/qemu/-1-QEMUGuest1","prealloc":true,"size":536870912,= "host-nodes":[1,2,3],"policy":"bind"}' \ +-object '{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[= 1,2,3]}' \ +-object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/de= v/hugepages2M/libvirt/qemu/-1-QEMUGuest1","prealloc":true,"size":536870912,= "host-nodes":[1,2,3],"policy":"bind","prealloc-context":"tc-memdimm0"}' \ -device '{"driver":"pc-dimm","node":0,"memdev":"memdimm0","id":"dimm0","sl= ot":0,"addr":4294967296}' \ -object '{"qom-type":"memory-backend-ram","id":"memdimm2","size":536870912= }' \ -device '{"driver":"pc-dimm","node":0,"memdev":"memdimm2","id":"dimm2","sl= ot":2}' \ diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest= .args b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args index 5aa8110aeb..04876fc044 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args @@ -32,7 +32,8 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ -object '{"qom-type":"memory-backend-ram","id":"memvirtiomem0","reserve":f= alse,"size":1073741824}' \ -device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"request= ed-size":536870912,"memdev":"memvirtiomem0","id":"virtiomem0","bus":"pci.0"= ,"addr":"0x2"}' \ --object '{"qom-type":"memory-backend-file","id":"memvirtiomem1","mem-path"= :"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","reserve":false,"size":21474= 83648,"host-nodes":[1,2,3],"policy":"bind"}' \ +-object '{"qom-type":"thread-context","id":"tc-memvirtiomem1","node-affini= ty":[1,2,3]}' \ +-object '{"qom-type":"memory-backend-file","id":"memvirtiomem1","mem-path"= :"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","reserve":false,"size":21474= 83648,"host-nodes":[1,2,3],"policy":"bind","prealloc-context":"tc-memvirtio= mem1"}' \ -device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"request= ed-size":1073741824,"memdev":"memvirtiomem1","prealloc":true,"id":"virtiome= m1","bus":"pci.1","addr":"0x1"}' \ -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ diff --git a/tests/qemuxml2argvdata/pages-dimm-discard.x86_64-latest.args b= /tests/qemuxml2argvdata/pages-dimm-discard.x86_64-latest.args index 19ed3928de..2418133aa0 100644 --- a/tests/qemuxml2argvdata/pages-dimm-discard.x86_64-latest.args +++ b/tests/qemuxml2argvdata/pages-dimm-discard.x86_64-latest.args @@ -29,7 +29,8 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-fedora/.config \ -no-acpi \ -boot strict=3Don \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ --object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/de= v/hugepages1G/libvirt/qemu/-1-fedora","discard-data":false,"prealloc":true,= "size":1073741824,"host-nodes":[1,2,3],"policy":"bind"}' \ +-object '{"qom-type":"thread-context","id":"tc-memdimm0","node-affinity":[= 1,2,3]}' \ +-object '{"qom-type":"memory-backend-file","id":"memdimm0","mem-path":"/de= v/hugepages1G/libvirt/qemu/-1-fedora","discard-data":false,"prealloc":true,= "size":1073741824,"host-nodes":[1,2,3],"policy":"bind","prealloc-context":"= tc-memdimm0"}' \ -device '{"driver":"pc-dimm","node":0,"memdev":"memdimm0","id":"dimm0","sl= ot":0}' \ -object '{"qom-type":"memory-backend-file","id":"memdimm1","mem-path":"/va= r/lib/libvirt/qemu/ram/-1-fedora/dimm1","discard-data":true,"share":false,"= size":536870912}' \ -device '{"driver":"pc-dimm","node":0,"memdev":"memdimm1","id":"dimm1","sl= ot":1}' \ --=20 2.37.4