From nobody Mon Apr 29 05:44:13 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=1642599155; cv=none; d=zohomail.com; s=zohoarc; b=KAOcbkGJ2Jyux6RJtTZ/QnK/9UqWSiFhtRpzeOg6lRclhh7rY8DYDHQYQYc5FGG3Aa0HVGCa1nV36006TeYc0JQ5Payt3OS0rmRJwJujgerwhNXeKeUZiGZgVOiwFLbddAm+MEOyyCYrp3R+OEjnhl5+/dKUsSYQQAmx750qWrk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642599155; h=Content-Type:Content-Transfer-Encoding:Cc: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=Ye2wdlSyTXB9kAhqrvcWD6oYPpSFBXorlJI5IiL9waI=; b=OJZr37GiDgc1ECZDkWpv6/oIRJWIk2gAaqYbdJof0/anJpFM3l8v4fz2nYON/XWnboCObCkxG74mx36iiYrilaiOrkeaG6pu94k3d2hQ+nJIArr+cjj8/GCZIx/7znRKNedmRmoqMhoyFLOeHOEorE4qxwNhucOyvwro5C2zaMo= 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 1642599155698563.502975898064; Wed, 19 Jan 2022 05:32:35 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-86--VC65mLHPYuWvMnPTMTz1Q-1; Wed, 19 Jan 2022 08:32:32 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E763190A7AA; Wed, 19 Jan 2022 13:32:27 +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 1F213105B1F0; Wed, 19 Jan 2022 13:32:27 +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 523101802E34; Wed, 19 Jan 2022 13:32:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20JDWP0w008990 for ; Wed, 19 Jan 2022 08:32:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4AB477DE50; Wed, 19 Jan 2022 13:32:25 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F71C7DE4D; Wed, 19 Jan 2022 13:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642599153; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Ye2wdlSyTXB9kAhqrvcWD6oYPpSFBXorlJI5IiL9waI=; b=gFtWlCPCTQCbas5bD8lpApO5YTadoN5Zs2DAbYz0G5FpBMwQBMJnjuxB/qdFZhMb4efEH1 Xw9NbrU0PIB0ejrI/O6w6bbB6ABXJ/UL8ycAljvE3KYn3Iv9gSw4alLPavgP0FVsISSUpb vyJoStH+C0u9B4/rN1D8DYJismpex9k= X-MC-Unique: -VC65mLHPYuWvMnPTMTz1Q-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 1/5] qemuBuildMemoryDeviceProps: Fix const correctness Date: Wed, 19 Jan 2022 14:32:14 +0100 Message-Id: <419a199d71fa098e41ae3b263bb5e1ade33d9d3c.1642598968.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: david@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.22 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) X-ZM-MESSAGEID: 1642599157813100001 Content-Type: text/plain; charset="utf-8" The @mem agrument of qemuBuildMemoryDeviceProps() function is only read from. Make this fact obvious from the function declaration too. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_command.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bca867a492..fb87649e65 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4002,7 +4002,7 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd, =20 virJSONValue * qemuBuildMemoryDeviceProps(const virDomainDef *def, - virDomainMemoryDef *mem) + const virDomainMemoryDef *mem) { g_autoptr(virJSONValue) props =3D NULL; const char *device =3D NULL; diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index dbdf3a4793..dd981e333f 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -154,7 +154,7 @@ int qemuBuildMemoryBackendProps(virJSONValue **backendP= rops, =20 virJSONValue * qemuBuildMemoryDeviceProps(const virDomainDef *def, - virDomainMemoryDef *mem); + const virDomainMemoryDef *mem); =20 /* Current, best practice */ virJSONValue * --=20 2.34.1 From nobody Mon Apr 29 05:44:13 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=1642599164; cv=none; d=zohomail.com; s=zohoarc; b=ni+SCGa5htF+lnRYLjtX460lRxxIcvEsCYrm7375Xk/9dhALpDtTCwx2ztrgyJ869iAQBwiOZGvMKSMHHqUQrebUF8MbD3HFxGdW9uby5Fa18vhOunns7Jd+ymAcL1ZNHZo535hMVJmuKqn/65nQ6dUWkCu87Hr2WMw2yRnn/rM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642599164; h=Content-Type:Content-Transfer-Encoding:Cc: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=24kQeOS25lhfnC8MTEoalULELH78VTeQ90oqLWSYdQ4=; b=hBm2OzihYa9IMd867UFWBDX1XVroX5Aze18lmzJkfFEAExJdKShrGdBOILM1SeOLPePmN7fwS79lUjaMvDEKNvCKg5cfLPyE4w5ST/NNStRRcXge4XjeTDkMAvWn248/COGgfm7zeEZEt4Yd8LTW99JDZyLsHGhC5rO9tB7qnB0= 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 1642599164694265.1343324163349; Wed, 19 Jan 2022 05:32:44 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-588-2GxVtJDtNAeWK8e3cBGO4w-1; Wed, 19 Jan 2022 08:32:40 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC270851A1B; Wed, 19 Jan 2022 13:32:32 +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 4D1697E412; Wed, 19 Jan 2022 13:32:32 +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 14BC44BB7C; Wed, 19 Jan 2022 13:32:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20JDWQpD009003 for ; Wed, 19 Jan 2022 08:32:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 429F17DE50; Wed, 19 Jan 2022 13:32:26 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 974B17DE4D; Wed, 19 Jan 2022 13:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642599163; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=24kQeOS25lhfnC8MTEoalULELH78VTeQ90oqLWSYdQ4=; b=RQ6ZKGUFE343QLfbK5UZ/155OGFmqoMK/rA4X80iOO/quA3cyP1bAFjn+qNN1fMvVJrSUC kOmxwUtMAH7pLGOsUGlHh9YyqdvdREhIDVcNlDX1ZhotVslbX+cpdksOy0Yv/5UIIgDy7d Q8mlAlPhA9pVedWQERpZDFRe6JM4K1Y= X-MC-Unique: 2GxVtJDtNAeWK8e3cBGO4w-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 2/5] qemu: Separate out hugepages handling from qemuBuildMemoryBackendProps() Date: Wed, 19 Jan 2022 14:32:15 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: david@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.79 on 10.5.11.11 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) X-ZM-MESSAGEID: 1642599165283100002 Content-Type: text/plain; charset="utf-8" The qemuBuildMemoryBackendProps() function is already long enough. Move code that decides what hugepages to use into a separate function. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 148 +++++++++++++++++++++++----------------- 1 file changed, 86 insertions(+), 62 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index fb87649e65..858aa0211a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3603,6 +3603,86 @@ qemuBuildMemoryGetDefaultPagesize(virQEMUDriverConfi= g *cfg, } =20 =20 +static int +qemuBuildMemoryGetPagesize(virQEMUDriverConfig *cfg, + const virDomainDef *def, + const virDomainMemoryDef *mem, + unsigned long long *pagesizeRet, + bool *needHugepageRet, + bool *useHugepageRet) +{ + const long system_page_size =3D virGetSystemPageSizeKB(); + unsigned long long pagesize =3D mem->pagesize; + bool needHugepage =3D !!pagesize; + bool useHugepage =3D !!pagesize; + + if (pagesize =3D=3D 0) { + virDomainHugePage *master_hugepage =3D NULL; + virDomainHugePage *hugepage =3D NULL; + bool thisHugepage =3D false; + size_t i; + + /* Find the huge page size we want to use */ + for (i =3D 0; i < def->mem.nhugepages; i++) { + hugepage =3D &def->mem.hugepages[i]; + + if (!hugepage->nodemask) { + master_hugepage =3D hugepage; + continue; + } + + /* just find the master hugepage in case we don't use NUMA */ + if (mem->targetNode < 0) + continue; + + if (virBitmapGetBit(hugepage->nodemask, mem->targetNode, + &thisHugepage) < 0) { + /* Ignore this error. It's not an error after all. Well, + * the nodemask for this can contain lower NUMA + * nodes than we are querying in here. */ + continue; + } + + if (thisHugepage) { + /* Hooray, we've found the page size */ + needHugepage =3D true; + break; + } + } + + if (i =3D=3D def->mem.nhugepages) { + /* We have not found specific huge page to be used with this + * NUMA node. Use the generic setting then ( without any + * @nodemask) if possible. */ + hugepage =3D master_hugepage; + } + + if (hugepage) { + pagesize =3D hugepage->size; + useHugepage =3D true; + } + } + + if (pagesize =3D=3D system_page_size) { + /* However, if user specified to use "huge" page + * of regular system page size, it's as if they + * hasn't specified any huge pages at all. */ + pagesize =3D 0; + needHugepage =3D false; + useHugepage =3D false; + } else if (useHugepage && pagesize =3D=3D 0) { + if (qemuBuildMemoryGetDefaultPagesize(cfg, &pagesize) < 0) + return -1; + } + + *pagesizeRet =3D pagesize; + *needHugepageRet =3D needHugepage; + *useHugepageRet =3D useHugepage; + + return 0; +} + + /** * qemuBuildMemoryBackendProps: * @backendProps: [out] constructed object @@ -3640,18 +3720,16 @@ qemuBuildMemoryBackendProps(virJSONValue **backendP= rops, { const char *backendType =3D "memory-backend-file"; virDomainNumatuneMemMode mode; - const long system_page_size =3D virGetSystemPageSizeKB(); virDomainMemoryAccess memAccess =3D mem->access; - size_t i; g_autofree char *memPath =3D NULL; bool prealloc =3D false; virBitmap *nodemask =3D NULL; int rc; g_autoptr(virJSONValue) props =3D NULL; bool nodeSpecified =3D virDomainNumatuneNodeSpecified(def->numa, mem->= targetNode); - unsigned long long pagesize =3D mem->pagesize; - bool needHugepage =3D !!pagesize; - bool useHugepage =3D !!pagesize; + unsigned long long pagesize =3D 0; + bool needHugepage =3D false; + bool useHugepage =3D false; int discard =3D mem->discard; bool disableCanonicalPath =3D false; =20 @@ -3696,63 +3774,9 @@ qemuBuildMemoryBackendProps(virJSONValue **backendPr= ops, virDomainNumatuneGetMode(def->numa, -1, &mode) < 0) mode =3D VIR_DOMAIN_NUMATUNE_MEM_STRICT; =20 - if (pagesize =3D=3D 0) { - virDomainHugePage *master_hugepage =3D NULL; - virDomainHugePage *hugepage =3D NULL; - bool thisHugepage =3D false; - - /* Find the huge page size we want to use */ - for (i =3D 0; i < def->mem.nhugepages; i++) { - hugepage =3D &def->mem.hugepages[i]; - - if (!hugepage->nodemask) { - master_hugepage =3D hugepage; - continue; - } - - /* just find the master hugepage in case we don't use NUMA */ - if (mem->targetNode < 0) - continue; - - if (virBitmapGetBit(hugepage->nodemask, mem->targetNode, - &thisHugepage) < 0) { - /* Ignore this error. It's not an error after all. Well, - * the nodemask for this can contain lower NUMA - * nodes than we are querying in here. */ - continue; - } - - if (thisHugepage) { - /* Hooray, we've found the page size */ - needHugepage =3D true; - break; - } - } - - if (i =3D=3D def->mem.nhugepages) { - /* We have not found specific huge page to be used with this - * NUMA node. Use the generic setting then ( without any - * @nodemask) if possible. */ - hugepage =3D master_hugepage; - } - - if (hugepage) { - pagesize =3D hugepage->size; - useHugepage =3D true; - } - } - - if (pagesize =3D=3D system_page_size) { - /* However, if user specified to use "huge" page - * of regular system page size, it's as if they - * hasn't specified any huge pages at all. */ - pagesize =3D 0; - needHugepage =3D false; - useHugepage =3D false; - } else if (useHugepage && pagesize =3D=3D 0) { - if (qemuBuildMemoryGetDefaultPagesize(cfg, &pagesize) < 0) - return -1; - } + if (qemuBuildMemoryGetPagesize(cfg, def, mem, &pagesize, + &needHugepage, &useHugepage) < 0) + return -1; =20 props =3D virJSONValueNewObject(); =20 --=20 2.34.1 From nobody Mon Apr 29 05:44:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1642599156; cv=none; d=zohomail.com; s=zohoarc; b=hUQ1O15M934KhkGJ//OGEG8/EWuQvKa+kjIx0s3DeKoo5nykyvf+qDE825QIEeirTM+wdXDqzAKPVEHoFVa420eMRK4NDnZGfnIRA0oxJ5WTTScZDnV7Tqeb8R3oMUL59H73IaXMKxY7O50TAsjag5/Tqm9/oUcaLnlHrhHiHrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642599156; h=Content-Type:Content-Transfer-Encoding:Cc: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=WHMzIGuGlB6biUiU7/iThnkmMg9XyqqHclvKPCPRULc=; b=S5FEbwofjbbbcAt35yW27WGPD+uUfqQM3sBg5fHfjVQ4YHqHwaicrKdjDvtvL2qjPRa9VFvpefGs7ib5cfmmgI/eK9k3PrnvjX4QH1NLIUFJedTKKK2JpgU49gC8QzQpqQJvIzkYDrRaiSZNR9OUFCGYHOG2wLA7RZEyAq7fsLQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1642599156214320.4397338422858; Wed, 19 Jan 2022 05:32:36 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-421-I0KLKhqPMtybsNWiUlldMA-1; Wed, 19 Jan 2022 08:32:33 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 523E18519E1; Wed, 19 Jan 2022 13:32:28 +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 225B784A0F; Wed, 19 Jan 2022 13:32:28 +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 E0C841806D1C; Wed, 19 Jan 2022 13:32:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20JDWRc3009010 for ; Wed, 19 Jan 2022 08:32:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3B5B67DE4D; Wed, 19 Jan 2022 13:32:27 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 909377DE50; Wed, 19 Jan 2022 13:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642599155; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=WHMzIGuGlB6biUiU7/iThnkmMg9XyqqHclvKPCPRULc=; b=EypInqXhgFQhFCVzewOVa07UT9wRrMVbTFEBLrdXC3pqBVXuqZNovh1qS9j4DhUXrcmjYe FJOA2x4ubY/BjVX3I+4xYRZS8s5zGDUQtIazLCRiZsC618huy8ZdBBwvDs6Heua/z3RhHP lfIHpWv9IIJOuZaGG3U4ncCt8t9gtRg= X-MC-Unique: I0KLKhqPMtybsNWiUlldMA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 3/5] qemu: Move @prealloc into qemuBuildMemoryGetPagesize() Date: Wed, 19 Jan 2022 14:32:16 +0100 Message-Id: <817058c2b8bb4fbed4fdaf679039fc6e2c416d1a.1642598968.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: david@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.79 on 10.5.11.13 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) X-ZM-MESSAGEID: 1642599157972100003 Content-Type: text/plain; charset="utf-8" The qemuBuildMemoryGetPagesize() function has everything is needs to decide whether preallocation is needed or not. Move the logic from qemuBuildMemoryBackendProps() into qemuBuildMemoryGetPagesize(). Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 858aa0211a..9ab2b25fe2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3609,12 +3609,14 @@ qemuBuildMemoryGetPagesize(virQEMUDriverConfig *cfg, const virDomainMemoryDef *mem, unsigned long long *pagesizeRet, bool *needHugepageRet, - bool *useHugepageRet) + bool *useHugepageRet, + bool *preallocRet) { const long system_page_size =3D virGetSystemPageSizeKB(); unsigned long long pagesize =3D mem->pagesize; bool needHugepage =3D !!pagesize; bool useHugepage =3D !!pagesize; + bool prealloc =3D false; =20 if (pagesize =3D=3D 0) { virDomainHugePage *master_hugepage =3D NULL; @@ -3675,9 +3677,23 @@ qemuBuildMemoryGetPagesize(virQEMUDriverConfig *cfg, return -1; } =20 + if (def->mem.allocation =3D=3D VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE) + prealloc =3D true; + + /* If the NVDIMM is a real device then there's nothing to prealloc. + * If anything, we would be only wearing off the device. + * Similarly, virtio-pmem-pci doesn't need prealloc either. */ + if (mem->nvdimmPath && !mem->nvdimmPmem && + mem->model !=3D VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM) + prealloc =3D true; + + if (useHugepage) + prealloc =3D true; + *pagesizeRet =3D pagesize; *needHugepageRet =3D needHugepage; *useHugepageRet =3D useHugepage; + *preallocRet =3D prealloc; =20 return 0; } @@ -3767,15 +3783,12 @@ qemuBuildMemoryBackendProps(virJSONValue **backendP= rops, if (discard =3D=3D VIR_TRISTATE_BOOL_ABSENT) discard =3D def->mem.discard; =20 - if (def->mem.allocation =3D=3D VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE) - prealloc =3D true; - if (virDomainNumatuneGetMode(def->numa, mem->targetNode, &mode) < 0 && virDomainNumatuneGetMode(def->numa, -1, &mode) < 0) mode =3D VIR_DOMAIN_NUMATUNE_MEM_STRICT; =20 if (qemuBuildMemoryGetPagesize(cfg, def, mem, &pagesize, - &needHugepage, &useHugepage) < 0) + &needHugepage, &useHugepage, &prealloc)= < 0) return -1; =20 props =3D virJSONValueNewObject(); @@ -3784,13 +3797,10 @@ qemuBuildMemoryBackendProps(virJSONValue **backendP= rops, def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_MEMFD) { backendType =3D "memory-backend-memfd"; =20 - if (useHugepage) { - if (virJSONValueObjectAdd(&props, "b:hugetlb", useHugepage, NU= LL) < 0 || - virJSONValueObjectAdd(&props, "U:hugetlbsize", pagesize <<= 10, NULL) < 0) { - return -1; - } - - prealloc =3D true; + if (useHugepage && + (virJSONValueObjectAdd(&props, "b:hugetlb", useHugepage, NULL)= < 0 || + virJSONValueObjectAdd(&props, "U:hugetlbsize", pagesize << 10= , NULL) < 0)) { + return -1; } =20 if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0) @@ -3804,15 +3814,9 @@ qemuBuildMemoryBackendProps(virJSONValue **backendPr= ops, =20 if (mem->nvdimmPath) { memPath =3D g_strdup(mem->nvdimmPath); - /* If the NVDIMM is a real device then there's nothing to prea= lloc. - * If anything, we would be only wearing off the device. - * Similarly, virtio-pmem-pci doesn't need prealloc either. */ - if (!mem->nvdimmPmem && mem->model !=3D VIR_DOMAIN_MEMORY_MODE= L_VIRTIO_PMEM) - prealloc =3D true; } else if (useHugepage) { if (qemuGetDomainHupageMemPath(priv->driver, def, pagesize, &m= emPath) < 0) return -1; - prealloc =3D true; } else { /* We can have both pagesize and mem source. If that's the cas= e, * prefer hugepages as those are more specific. */ --=20 2.34.1 From nobody Mon Apr 29 05:44:13 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=1642599166; cv=none; d=zohomail.com; s=zohoarc; b=OzgSIhoV7YkM/d2sROcJzvQ2C9cAstRkzmXn+nrvHbkXKnkwqPd28vLFNTLHMSFwR2r6/E+OQOWx6p/7V81/aiBSiBmM/oqnGvJRL7RWcrr4buEhwcZX616FhOGeQllpIwOF8To/gp+JOUBui7eAictNZTFTw+X9RJ9C7/7L2Q4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642599166; h=Content-Type:Content-Transfer-Encoding:Cc: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=8dVLZGik1ZpMbrmxnQFR3uHWydtZl50INt9slBp5bSU=; b=nryAGcKEjjF4oUET+SV2Ovnd+H7zGc4C89/L39xYCP63EDYQ1ZqsfUTzhsx50ORRwuU3C0FqOQ7Gt23hq4iEZ9+URkDuEtdg1+vOzLthVrMwHHu3hW/KElRzZON6fBIi5SvlE3iqQ3uZ3pZzwS6Aan6MGioBzyEJqmcGsObrRcc= 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 1642599166269949.2730895327973; Wed, 19 Jan 2022 05:32:46 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-460-lPRdQYLBN12RTfM9Rj4ABQ-1; Wed, 19 Jan 2022 08:32:41 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 813D8654; Wed, 19 Jan 2022 13:32:35 +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 107F77E641; Wed, 19 Jan 2022 13:32:35 +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 C469F4A7C9; Wed, 19 Jan 2022 13:32:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20JDWSC5009027 for ; Wed, 19 Jan 2022 08:32:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 873D07E230; Wed, 19 Jan 2022 13:32:28 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 890437DE4D; Wed, 19 Jan 2022 13:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642599165; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=8dVLZGik1ZpMbrmxnQFR3uHWydtZl50INt9slBp5bSU=; b=L8oLBYFOb+vqLMfIJ2X4V4jIS/Wzov/kk7g5HrWi8BORh9TDgYSOQZOdVqi9jLWUS7KjoF xsvG+TSyAsBRhM7Je4Am7FeXzPbcHNHbuTNu4sFtidyDiFiZcdk4UNaSgvZZ738ctx4bA4 hIu8vKXj+5QC8zt/OKTwHM7uGH0Fb0o= X-MC-Unique: lPRdQYLBN12RTfM9Rj4ABQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 4/5] qemu_capabilities: Introduce QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC Date: Wed, 19 Jan 2022 14:32:17 +0100 Message-Id: <7537fa48a023cd373570bf6b43495d9c71966aee.1642598968.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: david@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.79 on 10.5.11.11 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) X-ZM-MESSAGEID: 1642599167780100001 Content-Type: text/plain; charset="utf-8" This new capability tracks whether virtio-mem device is capable of memory preallocation, which is detected by the device having .prealloc attribute. Signed-off-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 8 + src/qemu/qemu_capabilities.h | 1 + .../caps_5.1.0.x86_64.replies | 255 +++++++++++++-- .../caps_5.2.0.x86_64.replies | 260 ++++++++++++++-- .../caps_6.0.0.x86_64.replies | 282 +++++++++++++++-- .../caps_6.1.0.x86_64.replies | 282 +++++++++++++++-- .../caps_6.2.0.x86_64.replies | 282 +++++++++++++++-- .../caps_7.0.0.x86_64.replies | 293 ++++++++++++++++-- .../caps_7.0.0.x86_64.xml | 1 + 9 files changed, 1508 insertions(+), 156 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 66d5effba8..5cccc267a4 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -657,6 +657,7 @@ VIR_ENUM_IMPL(virQEMUCaps, =20 /* 420 */ "device.json+hotplug", /* QEMU_CAPS_DEVICE_JSON */ + "virtio-mem-pci.prealloc", /* QEMU_CAPS_DEVICE_VIRTIO_MEM_PC= I_PREALLOC */ ); =20 =20 @@ -1538,6 +1539,10 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCap= sDevicePropsVhostUserFS[] =3D { "bootindex", QEMU_CAPS_VHOST_USER_FS_BOOTINDEX, NULL }, }; =20 +static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioMemP= CI[] =3D { + { "prealloc", QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC, NULL }, +}; + /* see documentation for virQEMUQAPISchemaPathGet for the query format */ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] =3D { { "block-commit/arg-type/*top", QEMU_CAPS_ACTIVE_COMMIT }, @@ -1699,6 +1704,9 @@ static virQEMUCapsDeviceTypeProps virQEMUCapsDevicePr= ops[] =3D { { "vhost-user-fs-device", virQEMUCapsDevicePropsVhostUserFS, G_N_ELEMENTS(virQEMUCapsDevicePropsVhostUserFS), QEMU_CAPS_DEVICE_VHOST_USER_FS }, + { "virtio-mem-pci", virQEMUCapsDevicePropsVirtioMemPCI, + G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioMemPCI), + QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendFi= le[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 2c1b6a99c4..fcfecb1db1 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -636,6 +636,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ =20 /* 420 */ QEMU_CAPS_DEVICE_JSON, /* -device accepts JSON (and works with hot-unp= lug) */ + QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC, /* -device virtio-mem-pci.pr= ealloc=3D */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.replies b/tests/q= emucapabilitiesdata/caps_5.1.0.x86_64.replies index b8f3c79026..cfb28e77bd 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.replies @@ -20625,12 +20625,215 @@ "id": "libvirt-37" } =20 +{ + "execute": "device-list-properties", + "arguments": { + "typename": "virtio-mem-pci" + }, + "id": "libvirt-38" +} + +{ + "return": [ + { + "name": "romfile", + "type": "str" + }, + { + "default-value": -1, + "name": "addr", + "description": "Slot and optional function number, example: 06.0 or = 06", + "type": "int32" + }, + { + "name": "failover_pair_id", + "type": "str" + }, + { + "default-value": true, + "name": "x-pcie-lnksta-dllla", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 1, + "name": "rombar", + "type": "uint32" + }, + { + "default-value": true, + "name": "x-pcie-extcap-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "multifunction", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "migrate-extra", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "ats", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-ignore-backend-features", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-pm-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-flr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-lnkctl-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "page-per-vq", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-deverr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "virtio-pci-bus-master-bug-migration", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "modern-pio-notify", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-disable-pcie", + "description": "on/off", + "type": "bool" + }, + { + "default-value": "auto", + "name": "disable-legacy", + "description": "on/off/auto", + "type": "OnOffAuto" + }, + { + "default-value": false, + "name": "disable-modern", + "type": "bool" + }, + { + "default-value": true, + "name": "use-disabled-flag", + "type": "bool" + }, + { + "default-value": false, + "name": "packed", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "iommu_platform", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 0, + "name": "memaddr", + "type": "uint64" + }, + { + "default-value": 0, + "name": "node", + "type": "uint32" + }, + { + "name": "virtio-backend", + "type": "child" + }, + { + "name": "memdev", + "type": "link" + }, + { + "default-value": true, + "name": "event_idx", + "description": "on/off", + "type": "bool" + }, + { + "name": "requested-size", + "type": "size" + }, + { + "name": "size", + "type": "size" + }, + { + "default-value": true, + "name": "notify_on_empty", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "any_layout", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "use-started", + "type": "bool" + }, + { + "name": "block-size", + "type": "size" + }, + { + "default-value": true, + "name": "indirect_desc", + "description": "on/off", + "type": "bool" + } + ], + "id": "libvirt-38" +} + { "execute": "qom-list-properties", "arguments": { "typename": "memory-backend-file" }, - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -20700,7 +20903,7 @@ "type": "bool" } ], - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -20708,7 +20911,7 @@ "arguments": { "typename": "memory-backend-memfd" }, - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -20777,7 +20980,7 @@ "type": "int" } ], - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -20785,7 +20988,7 @@ "arguments": { "typename": "max-x86_64-cpu" }, - "id": "libvirt-40" + "id": "libvirt-41" } =20 { @@ -22371,12 +22574,12 @@ "type": "bool" } ], - "id": "libvirt-40" + "id": "libvirt-41" } =20 { "execute": "query-machines", - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -22768,7 +22971,7 @@ "deprecated": false } ], - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -22776,7 +22979,7 @@ "arguments": { "typename": "none-machine" }, - "id": "libvirt-42" + "id": "libvirt-43" } =20 { @@ -22866,12 +23069,12 @@ "type": "string" } ], - "id": "libvirt-42" + "id": "libvirt-43" } =20 { "execute": "query-cpu-definitions", - "id": "libvirt-43" + "id": "libvirt-44" } =20 { @@ -24573,12 +24776,12 @@ "migration-safe": true } ], - "id": "libvirt-43" + "id": "libvirt-44" } =20 { "execute": "query-tpm-models", - "id": "libvirt-44" + "id": "libvirt-45" } =20 { @@ -24586,12 +24789,12 @@ "tpm-crb", "tpm-tis" ], - "id": "libvirt-44" + "id": "libvirt-45" } =20 { "execute": "query-tpm-types", - "id": "libvirt-45" + "id": "libvirt-46" } =20 { @@ -24599,12 +24802,12 @@ "passthrough", "emulator" ], - "id": "libvirt-45" + "id": "libvirt-46" } =20 { "execute": "query-command-line-options", - "id": "libvirt-46" + "id": "libvirt-47" } =20 { @@ -25899,12 +26102,12 @@ "option": "drive" } ], - "id": "libvirt-46" + "id": "libvirt-47" } =20 { "execute": "query-migrate-capabilities", - "id": "libvirt-47" + "id": "libvirt-48" } =20 { @@ -25982,16 +26185,16 @@ "capability": "validate-uuid" } ], - "id": "libvirt-47" + "id": "libvirt-48" } =20 { "execute": "query-sev-capabilities", - "id": "libvirt-48" + "id": "libvirt-49" } =20 { - "id": "libvirt-48", + "id": "libvirt-49", "error": { "class": "GenericError", "desc": "SEV is not enabled in KVM" @@ -26006,7 +26209,7 @@ "name": "host" } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -26314,7 +26517,7 @@ } } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -26328,7 +26531,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { @@ -26636,7 +26839,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.replies b/tests/q= emucapabilitiesdata/caps_5.2.0.x86_64.replies index 54d8db5904..22a1087e23 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.replies @@ -21220,12 +21220,220 @@ "id": "libvirt-37" } =20 +{ + "execute": "device-list-properties", + "arguments": { + "typename": "virtio-mem-pci" + }, + "id": "libvirt-38" +} + +{ + "return": [ + { + "name": "romfile", + "type": "str" + }, + { + "default-value": -1, + "name": "addr", + "description": "Slot and optional function number, example: 06.0 or = 06", + "type": "int32" + }, + { + "name": "failover_pair_id", + "type": "str" + }, + { + "default-value": true, + "name": "x-pcie-lnksta-dllla", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 1, + "name": "rombar", + "type": "uint32" + }, + { + "default-value": true, + "name": "x-pcie-extcap-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "multifunction", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "migrate-extra", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "ats", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-ignore-backend-features", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-pm-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-flr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-lnkctl-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "page-per-vq", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-deverr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "virtio-pci-bus-master-bug-migration", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "modern-pio-notify", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-disable-pcie", + "description": "on/off", + "type": "bool" + }, + { + "default-value": "auto", + "name": "disable-legacy", + "description": "on/off/auto", + "type": "OnOffAuto" + }, + { + "default-value": false, + "name": "disable-modern", + "type": "bool" + }, + { + "default-value": 0, + "name": "memaddr", + "type": "uint64" + }, + { + "default-value": true, + "name": "indirect_desc", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "iommu_platform", + "description": "on/off", + "type": "bool" + }, + { + "name": "memdev", + "type": "link" + }, + { + "default-value": true, + "name": "use-disabled-flag", + "type": "bool" + }, + { + "default-value": true, + "name": "event_idx", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 0, + "name": "node", + "type": "uint32" + }, + { + "default-value": false, + "name": "x-disable-legacy-check", + "type": "bool" + }, + { + "default-value": true, + "name": "any_layout", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "notify_on_empty", + "description": "on/off", + "type": "bool" + }, + { + "name": "requested-size", + "type": "size" + }, + { + "name": "block-size", + "type": "size" + }, + { + "default-value": true, + "name": "use-started", + "type": "bool" + }, + { + "default-value": false, + "name": "packed", + "description": "on/off", + "type": "bool" + }, + { + "name": "size", + "type": "size" + }, + { + "name": "virtio-backend", + "type": "child" + } + ], + "id": "libvirt-38" +} + { "execute": "qom-list-properties", "arguments": { "typename": "memory-backend-file" }, - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -21295,7 +21503,7 @@ "type": "bool" } ], - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -21303,7 +21511,7 @@ "arguments": { "typename": "memory-backend-memfd" }, - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -21372,7 +21580,7 @@ "type": "int" } ], - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -21380,7 +21588,7 @@ "arguments": { "typename": "max-x86_64-cpu" }, - "id": "libvirt-40" + "id": "libvirt-41" } =20 { @@ -22978,12 +23186,12 @@ "type": "bool" } ], - "id": "libvirt-40" + "id": "libvirt-41" } =20 { "execute": "query-machines", - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -23441,7 +23649,7 @@ "default-ram-id": "pc.ram" } ], - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -23449,7 +23657,7 @@ "arguments": { "typename": "none-machine" }, - "id": "libvirt-42" + "id": "libvirt-43" } =20 { @@ -23534,12 +23742,12 @@ "type": "string" } ], - "id": "libvirt-42" + "id": "libvirt-43" } =20 { "execute": "query-cpu-definitions", - "id": "libvirt-43" + "id": "libvirt-44" } =20 { @@ -25364,12 +25572,12 @@ "deprecated": false } ], - "id": "libvirt-43" + "id": "libvirt-44" } =20 { "execute": "query-tpm-models", - "id": "libvirt-44" + "id": "libvirt-45" } =20 { @@ -25377,12 +25585,12 @@ "tpm-crb", "tpm-tis" ], - "id": "libvirt-44" + "id": "libvirt-45" } =20 { "execute": "query-tpm-types", - "id": "libvirt-45" + "id": "libvirt-46" } =20 { @@ -25390,12 +25598,12 @@ "passthrough", "emulator" ], - "id": "libvirt-45" + "id": "libvirt-46" } =20 { "execute": "query-command-line-options", - "id": "libvirt-46" + "id": "libvirt-47" } =20 { @@ -26690,12 +26898,12 @@ "option": "drive" } ], - "id": "libvirt-46" + "id": "libvirt-47" } =20 { "execute": "query-migrate-capabilities", - "id": "libvirt-47" + "id": "libvirt-48" } =20 { @@ -26773,16 +26981,16 @@ "capability": "validate-uuid" } ], - "id": "libvirt-47" + "id": "libvirt-48" } =20 { "execute": "query-sev-capabilities", - "id": "libvirt-48" + "id": "libvirt-49" } =20 { - "id": "libvirt-48", + "id": "libvirt-49", "error": { "class": "GenericError", "desc": "SEV is not enabled in KVM" @@ -26797,7 +27005,7 @@ "name": "host" } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -27106,7 +27314,7 @@ } } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -27120,7 +27328,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { @@ -27429,7 +27637,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.replies b/tests/q= emucapabilitiesdata/caps_6.0.0.x86_64.replies index 986bb56630..4cde1b4eb5 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.replies @@ -22982,12 +22982,242 @@ "id": "libvirt-37" } =20 +{ + "execute": "device-list-properties", + "arguments": { + "typename": "virtio-mem-pci" + }, + "id": "libvirt-38" +} + +{ + "return": [ + { + "name": "failover_pair_id", + "type": "str" + }, + { + "name": "romfile", + "type": "str" + }, + { + "default-value": -1, + "name": "addr", + "description": "Slot and optional function number, example: 06.0 or = 06", + "type": "int32" + }, + { + "default-value": 4294967295, + "name": "romsize", + "type": "uint32" + }, + { + "default-value": true, + "name": "x-pcie-lnksta-dllla", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 1, + "name": "rombar", + "type": "uint32" + }, + { + "default-value": true, + "name": "x-pcie-extcap-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 0, + "name": "acpi-index", + "type": "uint32" + }, + { + "default-value": false, + "name": "multifunction", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "migrate-extra", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "ats", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-ignore-backend-features", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-pm-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "aer", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-flr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-lnkctl-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-ats-page-aligned", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "page-per-vq", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-deverr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "virtio-pci-bus-master-bug-migration", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "modern-pio-notify", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-disable-pcie", + "description": "on/off", + "type": "bool" + }, + { + "default-value": "auto", + "name": "disable-legacy", + "description": "on/off/auto", + "type": "OnOffAuto" + }, + { + "default-value": false, + "name": "disable-modern", + "type": "bool" + }, + { + "default-value": 0, + "name": "memaddr", + "type": "uint64" + }, + { + "default-value": true, + "name": "indirect_desc", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "iommu_platform", + "description": "on/off", + "type": "bool" + }, + { + "name": "memdev", + "type": "link" + }, + { + "default-value": true, + "name": "use-disabled-flag", + "type": "bool" + }, + { + "default-value": true, + "name": "event_idx", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 0, + "name": "node", + "type": "uint32" + }, + { + "default-value": false, + "name": "x-disable-legacy-check", + "type": "bool" + }, + { + "default-value": true, + "name": "any_layout", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "notify_on_empty", + "description": "on/off", + "type": "bool" + }, + { + "name": "requested-size", + "type": "size" + }, + { + "name": "block-size", + "type": "size" + }, + { + "default-value": true, + "name": "use-started", + "type": "bool" + }, + { + "default-value": false, + "name": "packed", + "description": "on/off", + "type": "bool" + }, + { + "name": "size", + "type": "size" + }, + { + "name": "virtio-backend", + "type": "child" + } + ], + "id": "libvirt-38" +} + { "execute": "qom-list-properties", "arguments": { "typename": "memory-backend-file" }, - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -23061,7 +23291,7 @@ "type": "bool" } ], - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -23069,7 +23299,7 @@ "arguments": { "typename": "memory-backend-memfd" }, - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -23138,7 +23368,7 @@ "type": "int" } ], - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -23146,7 +23376,7 @@ "arguments": { "typename": "max-x86_64-cpu" }, - "id": "libvirt-40" + "id": "libvirt-41" } =20 { @@ -24792,12 +25022,12 @@ "type": "bool" } ], - "id": "libvirt-40" + "id": "libvirt-41" } =20 { "execute": "query-machines", - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -25244,7 +25474,7 @@ "default-ram-id": "pc.ram" } ], - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -25252,7 +25482,7 @@ "arguments": { "typename": "none-machine" }, - "id": "libvirt-42" + "id": "libvirt-43" } =20 { @@ -25350,12 +25580,12 @@ "type": "child" } ], - "id": "libvirt-42" + "id": "libvirt-43" } =20 { "execute": "query-cpu-definitions", - "id": "libvirt-43" + "id": "libvirt-44" } =20 { @@ -27223,12 +27453,12 @@ "deprecated": false } ], - "id": "libvirt-43" + "id": "libvirt-44" } =20 { "execute": "query-tpm-models", - "id": "libvirt-44" + "id": "libvirt-45" } =20 { @@ -27236,12 +27466,12 @@ "tpm-crb", "tpm-tis" ], - "id": "libvirt-44" + "id": "libvirt-45" } =20 { "execute": "query-tpm-types", - "id": "libvirt-45" + "id": "libvirt-46" } =20 { @@ -27249,12 +27479,12 @@ "passthrough", "emulator" ], - "id": "libvirt-45" + "id": "libvirt-46" } =20 { "execute": "query-command-line-options", - "id": "libvirt-46" + "id": "libvirt-47" } =20 { @@ -28573,12 +28803,12 @@ "option": "drive" } ], - "id": "libvirt-46" + "id": "libvirt-47" } =20 { "execute": "query-migrate-capabilities", - "id": "libvirt-47" + "id": "libvirt-48" } =20 { @@ -28660,12 +28890,12 @@ "capability": "background-snapshot" } ], - "id": "libvirt-47" + "id": "libvirt-48" } =20 { "execute": "query-sev-capabilities", - "id": "libvirt-48" + "id": "libvirt-49" } =20 { @@ -28675,7 +28905,7 @@ "cert-chain": "AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAA= ", "pdh": "AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAA= OAAA" }, - "id": "libvirt-48" + "id": "libvirt-49" } =20 { @@ -28686,7 +28916,7 @@ "name": "host" } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -29007,7 +29237,7 @@ } } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -29021,7 +29251,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { @@ -29342,7 +29572,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { diff --git a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.replies b/tests/q= emucapabilitiesdata/caps_6.1.0.x86_64.replies index 92feb723e6..1fb3b3de8c 100644 --- a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.replies @@ -23224,12 +23224,242 @@ "id": "libvirt-37" } =20 +{ + "execute": "device-list-properties", + "arguments": { + "typename": "virtio-mem-pci" + }, + "id": "libvirt-38" +} + +{ + "return": [ + { + "name": "failover_pair_id", + "type": "str" + }, + { + "name": "romfile", + "type": "str" + }, + { + "default-value": -1, + "name": "addr", + "description": "Slot and optional function number, example: 06.0 or = 06", + "type": "int32" + }, + { + "default-value": 4294967295, + "name": "romsize", + "type": "uint32" + }, + { + "default-value": true, + "name": "x-pcie-lnksta-dllla", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 1, + "name": "rombar", + "type": "uint32" + }, + { + "default-value": true, + "name": "x-pcie-extcap-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 0, + "name": "acpi-index", + "type": "uint32" + }, + { + "default-value": false, + "name": "multifunction", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "migrate-extra", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "ats", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-ignore-backend-features", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-pm-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "aer", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-flr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-lnkctl-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-ats-page-aligned", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "page-per-vq", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-deverr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "virtio-pci-bus-master-bug-migration", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "modern-pio-notify", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-disable-pcie", + "description": "on/off", + "type": "bool" + }, + { + "default-value": "auto", + "name": "disable-legacy", + "description": "on/off/auto", + "type": "OnOffAuto" + }, + { + "default-value": false, + "name": "disable-modern", + "type": "bool" + }, + { + "default-value": 0, + "name": "memaddr", + "type": "uint64" + }, + { + "default-value": true, + "name": "indirect_desc", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "iommu_platform", + "description": "on/off", + "type": "bool" + }, + { + "name": "memdev", + "type": "link" + }, + { + "default-value": true, + "name": "use-disabled-flag", + "type": "bool" + }, + { + "default-value": true, + "name": "event_idx", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 0, + "name": "node", + "type": "uint32" + }, + { + "default-value": false, + "name": "x-disable-legacy-check", + "type": "bool" + }, + { + "default-value": true, + "name": "any_layout", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "notify_on_empty", + "description": "on/off", + "type": "bool" + }, + { + "name": "requested-size", + "type": "size" + }, + { + "name": "block-size", + "type": "size" + }, + { + "default-value": true, + "name": "use-started", + "type": "bool" + }, + { + "default-value": false, + "name": "packed", + "description": "on/off", + "type": "bool" + }, + { + "name": "size", + "type": "size" + }, + { + "name": "virtio-backend", + "type": "child" + } + ], + "id": "libvirt-38" +} + { "execute": "qom-list-properties", "arguments": { "typename": "memory-backend-file" }, - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -23308,7 +23538,7 @@ "type": "bool" } ], - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -23316,7 +23546,7 @@ "arguments": { "typename": "memory-backend-memfd" }, - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -23390,7 +23620,7 @@ "type": "int" } ], - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -23398,7 +23628,7 @@ "arguments": { "typename": "max-x86_64-cpu" }, - "id": "libvirt-40" + "id": "libvirt-41" } =20 { @@ -25056,12 +25286,12 @@ "type": "bool" } ], - "id": "libvirt-40" + "id": "libvirt-41" } =20 { "execute": "query-machines", - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -25526,7 +25756,7 @@ "default-ram-id": "pc.ram" } ], - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -25534,7 +25764,7 @@ "arguments": { "typename": "none-machine" }, - "id": "libvirt-42" + "id": "libvirt-43" } =20 { @@ -25637,12 +25867,12 @@ "type": "child" } ], - "id": "libvirt-42" + "id": "libvirt-43" } =20 { "execute": "query-cpu-definitions", - "id": "libvirt-43" + "id": "libvirt-44" } =20 { @@ -27699,12 +27929,12 @@ "deprecated": false } ], - "id": "libvirt-43" + "id": "libvirt-44" } =20 { "execute": "query-tpm-models", - "id": "libvirt-44" + "id": "libvirt-45" } =20 { @@ -27712,12 +27942,12 @@ "tpm-crb", "tpm-tis" ], - "id": "libvirt-44" + "id": "libvirt-45" } =20 { "execute": "query-tpm-types", - "id": "libvirt-45" + "id": "libvirt-46" } =20 { @@ -27725,12 +27955,12 @@ "passthrough", "emulator" ], - "id": "libvirt-45" + "id": "libvirt-46" } =20 { "execute": "query-command-line-options", - "id": "libvirt-46" + "id": "libvirt-47" } =20 { @@ -29062,12 +29292,12 @@ "option": "drive" } ], - "id": "libvirt-46" + "id": "libvirt-47" } =20 { "execute": "query-migrate-capabilities", - "id": "libvirt-47" + "id": "libvirt-48" } =20 { @@ -29149,16 +29379,16 @@ "capability": "background-snapshot" } ], - "id": "libvirt-47" + "id": "libvirt-48" } =20 { "execute": "query-sev-capabilities", - "id": "libvirt-48" + "id": "libvirt-49" } =20 { - "id": "libvirt-48", + "id": "libvirt-49", "error": { "class": "GenericError", "desc": "Failed to open /dev/sev: No such file or directory" @@ -29173,7 +29403,7 @@ "name": "host" } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -29496,7 +29726,7 @@ } } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -29510,7 +29740,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { @@ -29833,7 +30063,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.replies b/tests/q= emucapabilitiesdata/caps_6.2.0.x86_64.replies index 29b8e4e8d2..8a574c893b 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.replies @@ -26405,12 +26405,242 @@ "id": "libvirt-37" } =20 +{ + "execute": "device-list-properties", + "arguments": { + "typename": "virtio-mem-pci" + }, + "id": "libvirt-38" +} + +{ + "return": [ + { + "name": "failover_pair_id", + "type": "str" + }, + { + "name": "romfile", + "type": "str" + }, + { + "default-value": -1, + "name": "addr", + "description": "Slot and optional function number, example: 06.0 or = 06", + "type": "int32" + }, + { + "default-value": 4294967295, + "name": "romsize", + "type": "uint32" + }, + { + "default-value": true, + "name": "x-pcie-lnksta-dllla", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 1, + "name": "rombar", + "type": "uint32" + }, + { + "default-value": true, + "name": "x-pcie-extcap-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 0, + "name": "acpi-index", + "type": "uint32" + }, + { + "default-value": false, + "name": "multifunction", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "migrate-extra", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "ats", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-ignore-backend-features", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-pm-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "aer", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-flr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-lnkctl-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-ats-page-aligned", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "page-per-vq", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-deverr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "virtio-pci-bus-master-bug-migration", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "modern-pio-notify", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-disable-pcie", + "description": "on/off", + "type": "bool" + }, + { + "default-value": "auto", + "name": "disable-legacy", + "description": "on/off/auto", + "type": "OnOffAuto" + }, + { + "default-value": false, + "name": "disable-modern", + "type": "bool" + }, + { + "default-value": 0, + "name": "memaddr", + "type": "uint64" + }, + { + "default-value": true, + "name": "indirect_desc", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "iommu_platform", + "description": "on/off", + "type": "bool" + }, + { + "name": "memdev", + "type": "link" + }, + { + "default-value": true, + "name": "use-disabled-flag", + "type": "bool" + }, + { + "default-value": true, + "name": "event_idx", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 0, + "name": "node", + "type": "uint32" + }, + { + "default-value": false, + "name": "x-disable-legacy-check", + "type": "bool" + }, + { + "default-value": true, + "name": "any_layout", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "notify_on_empty", + "description": "on/off", + "type": "bool" + }, + { + "name": "requested-size", + "type": "size" + }, + { + "name": "block-size", + "type": "size" + }, + { + "default-value": true, + "name": "use-started", + "type": "bool" + }, + { + "default-value": false, + "name": "packed", + "description": "on/off", + "type": "bool" + }, + { + "name": "size", + "type": "size" + }, + { + "name": "virtio-backend", + "type": "child" + } + ], + "id": "libvirt-38" +} + { "execute": "qom-list-properties", "arguments": { "typename": "memory-backend-file" }, - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -26489,7 +26719,7 @@ "type": "bool" } ], - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -26497,7 +26727,7 @@ "arguments": { "typename": "memory-backend-memfd" }, - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -26571,7 +26801,7 @@ "type": "int" } ], - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -26579,7 +26809,7 @@ "arguments": { "typename": "max-x86_64-cpu" }, - "id": "libvirt-40" + "id": "libvirt-41" } =20 { @@ -28319,12 +28549,12 @@ "type": "bool" } ], - "id": "libvirt-40" + "id": "libvirt-41" } =20 { "execute": "query-machines", - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -28807,7 +29037,7 @@ "default-ram-id": "pc.ram" } ], - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -28815,7 +29045,7 @@ "arguments": { "typename": "none-machine" }, - "id": "libvirt-42" + "id": "libvirt-43" } =20 { @@ -28918,12 +29148,12 @@ "type": "child" } ], - "id": "libvirt-42" + "id": "libvirt-43" } =20 { "execute": "query-cpu-definitions", - "id": "libvirt-43" + "id": "libvirt-44" } =20 { @@ -30992,12 +31222,12 @@ "deprecated": false } ], - "id": "libvirt-43" + "id": "libvirt-44" } =20 { "execute": "query-tpm-models", - "id": "libvirt-44" + "id": "libvirt-45" } =20 { @@ -31005,12 +31235,12 @@ "tpm-crb", "tpm-tis" ], - "id": "libvirt-44" + "id": "libvirt-45" } =20 { "execute": "query-tpm-types", - "id": "libvirt-45" + "id": "libvirt-46" } =20 { @@ -31018,12 +31248,12 @@ "passthrough", "emulator" ], - "id": "libvirt-45" + "id": "libvirt-46" } =20 { "execute": "query-command-line-options", - "id": "libvirt-46" + "id": "libvirt-47" } =20 { @@ -32355,12 +32585,12 @@ "option": "drive" } ], - "id": "libvirt-46" + "id": "libvirt-47" } =20 { "execute": "query-migrate-capabilities", - "id": "libvirt-47" + "id": "libvirt-48" } =20 { @@ -32442,16 +32672,16 @@ "capability": "background-snapshot" } ], - "id": "libvirt-47" + "id": "libvirt-48" } =20 { "execute": "query-sev-capabilities", - "id": "libvirt-48" + "id": "libvirt-49" } =20 { - "id": "libvirt-48", + "id": "libvirt-49", "error": { "class": "GenericError", "desc": "SEV: Failed to open /dev/sev: No such file or directory" @@ -32466,7 +32696,7 @@ "name": "host" } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -32799,7 +33029,7 @@ } } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -32813,7 +33043,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { @@ -33146,7 +33376,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.replies b/tests/q= emucapabilitiesdata/caps_7.0.0.x86_64.replies index 90735073e5..3d92303f79 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.replies @@ -26526,12 +26526,253 @@ "id": "libvirt-37" } =20 +{ + "execute": "device-list-properties", + "arguments": { + "typename": "virtio-mem-pci" + }, + "id": "libvirt-38" +} + +{ + "return": [ + { + "name": "failover_pair_id", + "type": "str" + }, + { + "name": "romfile", + "type": "str" + }, + { + "default-value": -1, + "name": "addr", + "description": "Slot and optional function number, example: 06.0 or = 06", + "type": "int32" + }, + { + "default-value": 4294967295, + "name": "romsize", + "type": "uint32" + }, + { + "default-value": true, + "name": "x-pcie-lnksta-dllla", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 1, + "name": "rombar", + "type": "uint32" + }, + { + "default-value": true, + "name": "x-pcie-extcap-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 0, + "name": "acpi-index", + "type": "uint32" + }, + { + "default-value": false, + "name": "multifunction", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "migrate-extra", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "ats", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-ignore-backend-features", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-pm-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "aer", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-flr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-lnkctl-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-ats-page-aligned", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "page-per-vq", + "description": "on/off", + "type": "bool" + }, + { + "default-value": true, + "name": "x-pcie-deverr-init", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "virtio-pci-bus-master-bug-migration", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "modern-pio-notify", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "x-disable-pcie", + "description": "on/off", + "type": "bool" + }, + { + "default-value": "auto", + "name": "disable-legacy", + "description": "on/off/auto", + "type": "OnOffAuto" + }, + { + "default-value": false, + "name": "disable-modern", + "type": "bool" + }, + { + "default-value": 0, + "name": "memaddr", + "type": "uint64" + }, + { + "default-value": true, + "name": "indirect_desc", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "iommu_platform", + "description": "on/off", + "type": "bool" + }, + { + "name": "memdev", + "type": "link" + }, + { + "default-value": true, + "name": "use-disabled-flag", + "type": "bool" + }, + { + "default-value": true, + "name": "event_idx", + "description": "on/off", + "type": "bool" + }, + { + "default-value": 0, + "name": "node", + "type": "uint32" + }, + { + "default-value": false, + "name": "x-disable-legacy-check", + "type": "bool" + }, + { + "default-value": true, + "name": "any_layout", + "description": "on/off", + "type": "bool" + }, + { + "name": "requested-size", + "type": "size" + }, + { + "default-value": true, + "name": "notify_on_empty", + "description": "on/off", + "type": "bool" + }, + { + "default-value": false, + "name": "packed", + "description": "on/off", + "type": "bool" + }, + { + "name": "block-size", + "type": "size" + }, + { + "default-value": false, + "name": "prealloc", + "type": "bool" + }, + { + "default-value": true, + "name": "use-started", + "type": "bool" + }, + { + "default-value": "auto", + "name": "unplugged-inaccessible", + "description": "on/off/auto", + "type": "OnOffAuto" + }, + { + "name": "size", + "type": "size" + }, + { + "name": "virtio-backend", + "type": "child" + } + ], + "id": "libvirt-38" +} + { "execute": "qom-list-properties", "arguments": { "typename": "memory-backend-file" }, - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -26610,7 +26851,7 @@ "type": "bool" } ], - "id": "libvirt-38" + "id": "libvirt-39" } =20 { @@ -26618,7 +26859,7 @@ "arguments": { "typename": "memory-backend-memfd" }, - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -26692,7 +26933,7 @@ "type": "int" } ], - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -26700,7 +26941,7 @@ "arguments": { "typename": "max-x86_64-cpu" }, - "id": "libvirt-40" + "id": "libvirt-41" } =20 { @@ -28440,12 +28681,12 @@ "type": "bool" } ], - "id": "libvirt-40" + "id": "libvirt-41" } =20 { "execute": "query-machines", - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -28946,7 +29187,7 @@ "default-ram-id": "pc.ram" } ], - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -28954,7 +29195,7 @@ "arguments": { "typename": "none-machine" }, - "id": "libvirt-42" + "id": "libvirt-43" } =20 { @@ -29057,12 +29298,12 @@ "type": "child" } ], - "id": "libvirt-42" + "id": "libvirt-43" } =20 { "execute": "query-cpu-definitions", - "id": "libvirt-43" + "id": "libvirt-44" } =20 { @@ -31131,12 +31372,12 @@ "deprecated": false } ], - "id": "libvirt-43" + "id": "libvirt-44" } =20 { "execute": "query-tpm-models", - "id": "libvirt-44" + "id": "libvirt-45" } =20 { @@ -31144,12 +31385,12 @@ "tpm-crb", "tpm-tis" ], - "id": "libvirt-44" + "id": "libvirt-45" } =20 { "execute": "query-tpm-types", - "id": "libvirt-45" + "id": "libvirt-46" } =20 { @@ -31157,12 +31398,12 @@ "passthrough", "emulator" ], - "id": "libvirt-45" + "id": "libvirt-46" } =20 { "execute": "query-command-line-options", - "id": "libvirt-46" + "id": "libvirt-47" } =20 { @@ -32498,12 +32739,12 @@ "option": "drive" } ], - "id": "libvirt-46" + "id": "libvirt-47" } =20 { "execute": "query-migrate-capabilities", - "id": "libvirt-47" + "id": "libvirt-48" } =20 { @@ -32585,16 +32826,16 @@ "capability": "background-snapshot" } ], - "id": "libvirt-47" + "id": "libvirt-48" } =20 { "execute": "query-sev-capabilities", - "id": "libvirt-48" + "id": "libvirt-49" } =20 { - "id": "libvirt-48", + "id": "libvirt-49", "error": { "class": "GenericError", "desc": "SEV: Failed to open /dev/sev: No such file or directory" @@ -32609,7 +32850,7 @@ "name": "host" } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -32942,7 +33183,7 @@ } } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -32956,7 +33197,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { @@ -33289,7 +33530,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =20 { diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_7.0.0.x86_64.xml index 6b80e7817e..b3c885dc9c 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml @@ -242,6 +242,7 @@ + 6002050 0 43100243 --=20 2.34.1 From nobody Mon Apr 29 05:44:13 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=1642599164; cv=none; d=zohomail.com; s=zohoarc; b=XK6hO8ojibpWh2H1ul1SHsKQ0YRteiwwWtfSqzq7M/5y9YoEQ43JQ0GNuEptfvVYXjbBLE3j1KqjwmoUgDcWHLsyuPd7EBBTW2sTO30mISwBtIvfYM31xbC/khK0XinVst5YZZezszBWDp7dldyUisFiIKr/m9jghT4lAIxtcWE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642599164; h=Content-Type:Content-Transfer-Encoding:Cc: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=dygKYcL4BKM+NcZIZhyBCxQxdNgNh5fb9BnAuVWxW6o=; b=fy2uQCSEn5sa8WV3nFw7XBIncCxNNIMWiUTDiv79zw9CEA4OAwOMowAYUkk+/R0a/JoFAK5A+hNgImriJpDoFX3xnnG2ID0OUMnfEMvEyisSHS6t2/GiVgs+QBL50yN06oTxBjvgsLZCuLrLewh35phlhGccVyKgf0YlFZwQ33M= 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 16425991647291006.8367624992043; Wed, 19 Jan 2022 05:32:44 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-96-GMhIWG9bP5KP2-Ypsj9lSw-1; Wed, 19 Jan 2022 08:32:40 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A1721006ADB; Wed, 19 Jan 2022 13:32:32 +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 477C284A0F; Wed, 19 Jan 2022 13:32:32 +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 14C261806D2D; Wed, 19 Jan 2022 13:32:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20JDWTSF009034 for ; Wed, 19 Jan 2022 08:32:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7AD847DE4D; Wed, 19 Jan 2022 13:32:29 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF36A7E205; Wed, 19 Jan 2022 13:32:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642599163; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=dygKYcL4BKM+NcZIZhyBCxQxdNgNh5fb9BnAuVWxW6o=; b=IA436aD/oHPm5yRKx293ROOihmSitsnzG7ghCVaIfoU2mwZdeGmc97zgiXBH0RLZhPwicM BL3rTLkdwKBJ5C/Uv+eqzA2evJO7CPohmnNqkFZ8aBeFQNT01WJqcZvCBPDXD7uSLvdkKL qmjcevkSemYSvN0w+5BOV20ADEqTrws= X-MC-Unique: GMhIWG9bP5KP2-Ypsj9lSw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 5/5] qemu: Allow prealloc for virtio-mem-pci Date: Wed, 19 Jan 2022 14:32:18 +0100 Message-Id: <1e3fbd519b1cb13b72c3ea1fbff88b7c1ef5eb63.1642598968.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: david@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.79 on 10.5.11.13 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) X-ZM-MESSAGEID: 1642600066496100001 Content-Type: text/plain; charset="utf-8" There are a some scenarios in which we want to prealloc guest memory (e.g. when requested in domain XML, when using hugepages, etc.). With 'regular' models (like 'dimm', 'nvdimm' or 'virtio-pmem') or regular guest memory it is corresponding memory-backend-* object that ends up with .prealloc attribute set. And that's desired because neither of those devices can change its size on the fly. However, with virtio-mem model things are a bit different. While one can set .prealloc attribute on corresponding memory-backend-* object it doesn't make much sense, because virtio-mem can inflate/deflate on the fly, i.e. change how big of a portion of the memory-backend-* object is exposed to the guest. For instance, from a say 4GiB module only a half can be exposed to the guest. Therefore, it doesn't make much sense to preallocate whole 4GiB and keep them allocated. But we still want the part exposed to the guest preallocated (when conditions described at the beginning are met). Having said that, with new enough QEMU the virtio-mem-pci device gained new attribute ".prealloc" which instructs the device to talk to the memory backend object and allocate only the requested portion of memory. Now, that our algorithm for setting .prealloc was isolated in a single function, the function can be called when constructing cmd line for virtio-mem-pci device. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 42 +++++++++++++------ src/qemu/qemu_command.h | 4 +- src/qemu/qemu_hotplug.c | 2 +- ...mory-hotplug-virtio-mem.x86_64-latest.args | 2 +- 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9ab2b25fe2..c145f6242f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3690,10 +3690,14 @@ qemuBuildMemoryGetPagesize(virQEMUDriverConfig *cfg, if (useHugepage) prealloc =3D true; =20 - *pagesizeRet =3D pagesize; - *needHugepageRet =3D needHugepage; - *useHugepageRet =3D useHugepage; - *preallocRet =3D prealloc; + if (pagesizeRet) + *pagesizeRet =3D pagesize; + if (needHugepageRet) + *needHugepageRet =3D needHugepage; + if (useHugepageRet) + *useHugepageRet =3D useHugepage; + if (preallocRet) + *preallocRet =3D prealloc; =20 return 0; } @@ -3869,14 +3873,18 @@ qemuBuildMemoryBackendProps(virJSONValue **backendP= rops, return -1; =20 if (mem->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM) { - /* Explicitly disable prealloc for virtio-mem as it's not supported - * currently. Warn users if their config would result in prealloc.= */ - if (priv->memPrealloc || prealloc) { - VIR_WARN("Memory preallocation is unsupported for virtio-mem m= emory devices"); + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MEM_PC= I_PREALLOC)) { + /* Explicitly disable prealloc for virtio-mem if it isn't supp= orted. + * Warn users if their config would result in prealloc. */ + if (priv->memPrealloc || prealloc) { + VIR_WARN("Memory preallocation is unsupported for virtio-m= em memory devices"); + } + + if (priv->memPrealloc && + virJSONValueObjectAppendBoolean(props, "prealloc", 0) < 0) + return -1; } - if (priv->memPrealloc && - virJSONValueObjectAppendBoolean(props, "prealloc", 0) < 0) - return -1; + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MEMORY_BACKEND_RESERV= E) && virJSONValueObjectAppendBoolean(props, "reserve", 0) < 0) return -1; @@ -4029,7 +4037,9 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd, =20 =20 virJSONValue * -qemuBuildMemoryDeviceProps(const virDomainDef *def, +qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, + qemuDomainObjPrivate *priv, + const virDomainDef *def, const virDomainMemoryDef *mem) { g_autoptr(virJSONValue) props =3D NULL; @@ -4037,6 +4047,7 @@ qemuBuildMemoryDeviceProps(const virDomainDef *def, g_autofree char *uuidstr =3D NULL; virTristateBool unarmed =3D VIR_TRISTATE_BOOL_ABSENT; g_autofree char *memdev =3D NULL; + bool prealloc =3D false; =20 if (!mem->info.alias) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -4060,6 +4071,10 @@ qemuBuildMemoryDeviceProps(const virDomainDef *def, =20 case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: device =3D "virtio-mem-pci"; + + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI= _PREALLOC) && + qemuBuildMemoryGetPagesize(cfg, def, mem, NULL, NULL, NULL, &p= realloc) < 0) + return NULL; break; =20 case VIR_DOMAIN_MEMORY_MODEL_NONE: @@ -4087,6 +4102,7 @@ qemuBuildMemoryDeviceProps(const virDomainDef *def, "S:uuid", uuidstr, "T:unarmed", unarmed, "s:memdev", memdev, + "B:prealloc", prealloc, "s:id", mem->info.alias, NULL) < 0) return NULL; @@ -7798,7 +7814,7 @@ qemuBuildMemoryDeviceCommandLine(virCommand *cmd, if (qemuBuildMemoryDimmBackendStr(cmd, def->mems[i], def, cfg, pri= v) < 0) return -1; =20 - if (!(props =3D qemuBuildMemoryDeviceProps(def, def->mems[i]))) + if (!(props =3D qemuBuildMemoryDeviceProps(cfg, priv, def, def->me= ms[i]))) return -1; =20 if (qemuBuildDeviceCommandlineFromJSON(cmd, props, priv->qemuCaps)= < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index dd981e333f..ba175aff9c 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -153,7 +153,9 @@ int qemuBuildMemoryBackendProps(virJSONValue **backendP= rops, bool systemMemory); =20 virJSONValue * -qemuBuildMemoryDeviceProps(const virDomainDef *def, +qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, + qemuDomainObjPrivate *priv, + const virDomainDef *def, const virDomainMemoryDef *mem); =20 /* Current, best practice */ diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f3ec24635d..efc6db8455 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2399,7 +2399,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver, =20 objalias =3D g_strdup_printf("mem%s", mem->info.alias); =20 - if (!(devprops =3D qemuBuildMemoryDeviceProps(vm->def, mem))) + if (!(devprops =3D qemuBuildMemoryDeviceProps(cfg, priv, vm->def, mem)= )) goto cleanup; =20 if (qemuBuildMemoryBackendProps(&props, objalias, cfg, 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 1d83ec88a8..77dbc0c89c 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args @@ -21,7 +21,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -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"}' \ --device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"request= ed-size":1073741824,"memdev":"memvirtiomem1","id":"virtiomem1","bus":"pci.0= ","addr":"0x3"}' \ +-device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"request= ed-size":1073741824,"memdev":"memvirtiomem1","prealloc":true,"id":"virtiome= m1","bus":"pci.0","addr":"0x3"}' \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ --=20 2.34.1