From nobody Sun May 5 23:44:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1612964320; cv=none; d=zohomail.com; s=zohoarc; b=jnbdkXmYh9XHdzZ8Nd6KFkPTH4b5AsqtGaXVAX1kRc78pX0nJf/PelYQfVQmIQaZ9bbpiaw2DfSARWic883z5tX7eSkjrAWkH5uFGAx5b9mYqMw/OeQ51xrJxXEPLM+WIs0VumoOZJrg18TELS94VflAuFjbFzGgk4d0tlspWww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612964320; 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=NfSAjmLaRdtNTLZrTDWU4O1wBtpoBgnm2C/MBceR7Ac=; b=ezULogQpDoPbG+sUgsuXwH2ONJfZPCH327JwQHJPeAoR4W6sTI+b3cvCcPEb3rxPMyGKhwE6tqQ7DJ4fISStNf79Xc25nxOXHkSOlhoJD/HIqTl8UUhCaJ8jecQFpUCfhTIt/LvClkbFdTF7t1wuryQw81goXLTeMxv61W59qao= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612964320003337.64081418743035; Wed, 10 Feb 2021 05:38:40 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-513-Z88Y21-mMGqE2xKWcER6FA-1; Wed, 10 Feb 2021 08:38:36 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0047100B3B0; Wed, 10 Feb 2021 13:38: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 37C3C60C0F; Wed, 10 Feb 2021 13:38: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 39D3918095C9; Wed, 10 Feb 2021 13:38: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 11ADcPsl014571 for ; Wed, 10 Feb 2021 08:38:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 427C118AA1; Wed, 10 Feb 2021 13:38:25 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 651D31346F; Wed, 10 Feb 2021 13:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612964318; 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=NfSAjmLaRdtNTLZrTDWU4O1wBtpoBgnm2C/MBceR7Ac=; b=EGuHphC3AmybDQQ/ZcaVgVX86bKt7wrI6+WOM3xrWC2L1B+XuTkR7d372vjL8d4T+UxXa8 3maW3wJwX2U036QyjHoOPsTMYL9F011QBDTrrbhHZ4dI+/o8dBiw2ZKvJq9ySuquhspnmk BlPlhcv1owTFaNqOirUarF6sKkn0tHg= X-MC-Unique: Z88Y21-mMGqE2xKWcER6FA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v3 1/2] qemu_capabilities: Introduce QEMU_CAPS_X_USE_CANONICAL_PATH_FOR_RAMBLOCK_ID Date: Wed, 10 Feb 2021 14:38:13 +0100 Message-Id: <256a0e0127597b7b49a22f89408f952adbe25e2f.1612964123.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: imammedo@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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This capability tracks whether memory-backend-file has "x-use-canonical-path-for-ramblock-id" attribute. Introduced into QEMU by commit fa0cb34d2210cc749b9a70db99bb41c56ad20831. As of QEMU commit 8db0b20415c129cf5e577a593a4a0372d90b7cc9 the property is considered stable by qemu despite the 'x-' prefix to preserve compatibility with released qemu versions. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 6 ++++++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 + tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 + 25 files changed, 30 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ebd6607888..cd34988806 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -614,6 +614,7 @@ VIR_ENUM_IMPL(virQEMUCaps, =20 /* 390 */ "vhost-user-blk", + "memory-backend-file.x-use-canonical-path-for-ramblock-id", ); =20 =20 @@ -1682,6 +1683,11 @@ static struct virQEMUCapsStringFlags virQEMUCapsObje= ctPropsMemoryBackendFile[] =3D { "discard-data", QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD }, { "align", QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN }, { "pmem", QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM }, + /* As of QEMU commit 8db0b20415c129cf5e577a593a4a0372d90b7cc9 the + * "x-use-canonical-path-for-ramblock-id" property is considered stabl= e and + * supported. The 'x-' prefix was kept for compatibility with already + * released qemu versions. */ + { "x-use-canonical-path-for-ramblock-id", QEMU_CAPS_X_USE_CANONICAL_PA= TH_FOR_RAMBLOCK_ID }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendMe= mfd[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 8cb5673042..c422636d3a 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -594,6 +594,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ =20 /* 390 */ QEMU_CAPS_DEVICE_VHOST_USER_BLK, /* -device vhost-user-blk */ + QEMU_CAPS_X_USE_CANONICAL_PATH_FOR_RAMBLOCK_ID, /* -object memory-back= end-file,x-use-canonical-path-for-ramblock-id=3D */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_4.0.0.aarch64.xml index c28ada94fb..5e7761851f 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml @@ -181,6 +181,7 @@ + 4000000 0 61700240 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_4.0.0.ppc64.xml index a15edd87de..1d67935bd8 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml @@ -189,6 +189,7 @@ + 4000000 0 42900240 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml b/tests/qemu= capabilitiesdata/caps_4.0.0.riscv32.xml index de2b578b82..d56a19e6f9 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml @@ -182,6 +182,7 @@ + 4000000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml b/tests/qemu= capabilitiesdata/caps_4.0.0.riscv64.xml index 754ad6db53..d35cb7e2ca 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml @@ -182,6 +182,7 @@ + 4000000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_4.0.0.s390x.xml index 4a10deea01..ca9592ea11 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml @@ -145,6 +145,7 @@ + 4000000 0 39100240 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.0.0.x86_64.xml index c580d29374..9f485b317a 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml @@ -226,6 +226,7 @@ + 4000000 0 43100240 diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.1.0.x86_64.xml index 26eb3786e8..04af0a29c3 100644 --- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml @@ -233,6 +233,7 @@ + 4001000 0 43100241 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_4.2.0.aarch64.xml index 4c149e79bb..863a6e0106 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -194,6 +194,7 @@ + 4001050 0 61700242 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_4.2.0.ppc64.xml index a0019f2a20..4a079183af 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -195,6 +195,7 @@ + 4001050 0 42900242 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_4.2.0.s390x.xml index 41db85be6b..ffb6f07862 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -156,6 +156,7 @@ + 4002000 0 39100242 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.2.0.x86_64.xml index 976eaf347b..e17c7093e2 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -242,6 +242,7 @@ + 4002000 0 43100242 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_5.0.0.aarch64.xml index b9963bbd7e..3373cfc69e 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml @@ -204,6 +204,7 @@ + 5000000 0 61700241 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_5.0.0.ppc64.xml index 46edacd44b..1e4c90653c 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml @@ -213,6 +213,7 @@ + 5000000 0 42900241 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml b/tests/qemu= capabilitiesdata/caps_5.0.0.riscv64.xml index 496b75da20..7a27dd75d9 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml @@ -200,6 +200,7 @@ + 5000000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.0.0.x86_64.xml index f5bcc9ed83..9e50ede408 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -249,6 +249,7 @@ + 5000000 0 43100241 diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml b/tests/qemuca= pabilitiesdata/caps_5.1.0.sparc.xml index a293437850..704ca704e0 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml @@ -115,6 +115,7 @@ + 5001000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.1.0.x86_64.xml index f7d0be69cb..2044e197a3 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml @@ -251,6 +251,7 @@ + 5001000 0 43100242 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_5.2.0.aarch64.xml index 6b40141f15..a32f18d4f2 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml @@ -208,6 +208,7 @@ + 5002000 0 61700243 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_5.2.0.ppc64.xml index 298139cdd7..a26b19e78e 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml @@ -215,6 +215,7 @@ + 5002000 0 42900243 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml b/tests/qemu= capabilitiesdata/caps_5.2.0.riscv64.xml index 0457018c93..9eaccb2089 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml @@ -202,6 +202,7 @@ + 5002000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_5.2.0.s390x.xml index b59404230c..3891c9e0dd 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml @@ -163,6 +163,7 @@ + 5002000 0 39100243 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.2.0.x86_64.xml index 52a755ffc8..01409003d1 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml @@ -252,6 +252,7 @@ + 5002000 0 43100243 diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.0.0.x86_64.xml index fcc416206c..515a79232e 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml @@ -253,6 +253,7 @@ + 5002050 0 43100242 --=20 2.26.2 From nobody Sun May 5 23:44:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1612964337; cv=none; d=zohomail.com; s=zohoarc; b=B3d6VcPihTDrwKvFQw0vifiHEUihMjoWPVA5ftpWs0jLSiGJmnOlgZubXr1wA5y/gttCDJl5nFYTTchTkrAxFen3Hn8o47tOmK4rZKD6Ev5AtSiCTT1IpllEMMFsCP5h44dPaKFDVYg+126XzlGOguc5mSM21+rCwJNzdk0CWLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612964337; 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=ByYp9OC0obbrEtNdSsDO/4xo1P3qD58xc56/9xnniJQ=; b=YcvmoQoEVQ/wFSVjYBkwiwZ6zxxiA5qkIcSgr6Q4po3xFG3G4mJGMO1haKmmmQmiJ9tuq5E9c5k0Yq6OX4INZhbKbfUMFsiQqp0r/CXkwqN/NFL0duXeqUZr7LmlswWhjh4DxewgKztNhByQJUs95z0/2kb49fBqkcwKxLlH3Gk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161296433717540.81009681353612; Wed, 10 Feb 2021 05:38:57 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-536-SPhVPfEHM3GVM88rwS2M6Q-1; Wed, 10 Feb 2021 08:38:53 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D24AB107ACC7; Wed, 10 Feb 2021 13:38:47 +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 ABDE560BE2; Wed, 10 Feb 2021 13:38:47 +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 4A56457DFC; Wed, 10 Feb 2021 13:38:47 +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 11ADcQqH014581 for ; Wed, 10 Feb 2021 08:38:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 48A0D19809; Wed, 10 Feb 2021 13:38:26 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93D1F1346F; Wed, 10 Feb 2021 13:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612964336; 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=ByYp9OC0obbrEtNdSsDO/4xo1P3qD58xc56/9xnniJQ=; b=bsKPSWrnmvurabh8iwtFNlTHtoM2oGxs806iIjvAf4biCRaPSuHilP3GQJ6Bf8WSwJdzUa UTjiMkwEPP/gA1hWQhm5h7rf6XEvC7UesCrY9hUfqyn6ncvN53/4t+tLuIoHt/P6u36438 jWbqQDxt/qrPMZP70vypXX6nf2BaHI4= X-MC-Unique: SPhVPfEHM3GVM88rwS2M6Q-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v3 2/2] qemu: Do not Use canonical path for system memory Date: Wed, 10 Feb 2021 14:38:14 +0100 Message-Id: <2f8a9792942d596195c517c1c06f78c2e2b48bde.1612964123.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: imammedo@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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In commit 88957116c9d3cb4705380c3702c9d4315fb500bb I've adapted libvirt to QEMU's deprecation of -mem-path and -mem-prealloc and switched to memory-backend-* even for system memory. My claim was that that's what QEMU does under the hood anyway. And indeed it was: see QEMU commit 900c0ba373aada4c13d47d95330aa72ec4067ba5 and look at function create_default_memdev(). However, then commit d96c4d5f193e0e45beec80a6277728b32875bddb was merged into QEMU. While it was fixing a bug, it also changed the create_default_memdev() function in which it started turning off use of canonical path (by setting "x-use-canonical-path-for-ramblock-id" attribute to false). This wasn't documented until QEMU commit XXX. The path affects migration - the same path has to be used on the source and on the destination. Therefore, if there is old guest started with '-m X' it has "pc.ram" block which doesn't use canonical path and thus when migrating to newer QEMU which uses memory-backend-* we have to turn off the canonical path explicitly. Otherwise, "/objects/pc.ram" path would be expected by QEMU which doesn't match the source. Ideally, we would need to set it only for some machine types (4.0 and older) because newer machine types already do what we are doing. However, we treat machine types as opaque strings and therefore we don't want to parse nor inspect their versions. But then again, newer machine types already do what we are doing in this commit, so when old machine types are deprecated and removed we can remove our hack and forget it ever happened. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1912201 Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 35 ++++++++++++++++--- src/qemu/qemu_command.h | 3 +- src/qemu/qemu_hotplug.c | 2 +- .../disk-vhostuser.x86_64-latest.args | 3 +- .../hugepages-memaccess3.x86_64-latest.args | 4 +-- 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 92036d26c0..699d89de1d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2975,7 +2975,8 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendP= rops, qemuDomainObjPrivatePtr priv, const virDomainDef *def, const virDomainMemoryDef *mem, - bool force) + bool force, + bool systemMemory) { const char *backendType =3D "memory-backend-file"; virDomainNumatuneMemMode mode; @@ -2992,6 +2993,10 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backend= Props, bool needHugepage =3D !!pagesize; bool useHugepage =3D !!pagesize; int discard =3D mem->discard; + bool disableCanonicalPath =3D false; + + /* Disabling canonical path is required for migration compatibility of + * system memory objects, see below */ =20 /* The difference between @needHugepage and @useHugepage is that the l= atter * is true whenever huge page is defined for the current memory cell. @@ -3106,6 +3111,9 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendP= rops, if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0) return -1; =20 + if (systemMemory) + disableCanonicalPath =3D true; + } else if (useHugepage || mem->nvdimmPath || memAccess || def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) { =20 @@ -3148,10 +3156,29 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backen= dProps, =20 if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0) return -1; + + if (systemMemory) + disableCanonicalPath =3D true; + } else { backendType =3D "memory-backend-ram"; } =20 + /* This is a terrible hack, but unfortunately there is no better way. + * The replacement for '-m X' argument is not simple '-machine + * memory-backend' and '-object memory-backend-*,size=3DX' (which was = the + * idea). This is because of create_default_memdev() in QEMU sets + * 'x-use-canonical-path-for-ramblock-id' attribute to false and is + * documented in QEMU in qemu-options.hx under 'memory-backend'. Note + * that QEMU consideres 'x-use-canonical-path-for-ramblock-id' stable + * and supported despite the 'x-' prefix. + * See QEMU commit 8db0b20415c129cf5e577a593a4a0372d90b7cc9. + */ + if (disableCanonicalPath && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_X_USE_CANONICAL_PATH_FOR_= RAMBLOCK_ID) && + virJSONValueObjectAdd(props, "b:x-use-canonical-path-for-ramblock-= id", false, NULL) < 0) + return -1; + if (!priv->memPrealloc && virJSONValueObjectAdd(props, "B:prealloc", prealloc, NULL) < 0) return -1; @@ -3263,7 +3290,7 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def, mem.info.alias =3D alias; =20 if ((rc =3D qemuBuildMemoryBackendProps(&props, alias, cfg, - priv, def, &mem, false)) < 0) + priv, def, &mem, false, false)) = < 0) return -1; =20 if (virQEMUBuildObjectCommandlineFromJSON(buf, props) < 0) @@ -3292,7 +3319,7 @@ qemuBuildMemoryDimmBackendStr(virBufferPtr buf, alias =3D g_strdup_printf("mem%s", mem->info.alias); =20 if (qemuBuildMemoryBackendProps(&props, alias, cfg, - priv, def, mem, true) < 0) + priv, def, mem, true, false) < 0) return -1; =20 if (virQEMUBuildObjectCommandlineFromJSON(buf, props) < 0) @@ -7100,7 +7127,7 @@ qemuBuildMemCommandLineMemoryDefaultBackend(virComman= dPtr cmd, mem.info.alias =3D (char *) defaultRAMid; =20 if (qemuBuildMemoryBackendProps(&props, defaultRAMid, cfg, - priv, def, &mem, false) < 0) + priv, def, &mem, false, true) < 0) return -1; =20 if (virQEMUBuildObjectCommandlineFromJSON(&buf, props) < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index a33fbf6f4e..bdae117e02 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -161,7 +161,8 @@ int qemuBuildMemoryBackendProps(virJSONValuePtr *backen= dProps, qemuDomainObjPrivatePtr priv, const virDomainDef *def, const virDomainMemoryDef *mem, - bool force); + bool force, + bool systemMemory); =20 char * qemuBuildMemoryDeviceStr(const virDomainDef *def, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index dc2b46057c..e7863328db 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2430,7 +2430,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, goto cleanup; =20 if (qemuBuildMemoryBackendProps(&props, objalias, cfg, - priv, vm->def, mem, true) < 0) + priv, vm->def, mem, true, false) < 0) goto cleanup; =20 if (qemuProcessBuildDestroyMemoryPaths(driver, vm, mem, true) < 0) diff --git a/tests/qemuxml2argvdata/disk-vhostuser.x86_64-latest.args b/tes= ts/qemuxml2argvdata/disk-vhostuser.x86_64-latest.args index 30acd7c78b..9ee855d5c7 100644 --- a/tests/qemuxml2argvdata/disk-vhostuser.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-vhostuser.x86_64-latest.args @@ -15,7 +15,8 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dp= c.ram \ -cpu qemu64 \ -m 214 \ --object memory-backend-memfd,id=3Dpc.ram,share=3Dyes,size=3D224395264 \ +-object memory-backend-memfd,id=3Dpc.ram,share=3Dyes,\ +x-use-canonical-path-for-ramblock-id=3Dno,size=3D224395264 \ -overcommit mem-lock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ diff --git a/tests/qemuxml2argvdata/hugepages-memaccess3.x86_64-latest.args= b/tests/qemuxml2argvdata/hugepages-memaccess3.x86_64-latest.args index 6033950eab..9396441b92 100644 --- a/tests/qemuxml2argvdata/hugepages-memaccess3.x86_64-latest.args +++ b/tests/qemuxml2argvdata/hugepages-memaccess3.x86_64-latest.args @@ -19,8 +19,8 @@ arch-capabilities=3Don,ssbd=3Don,xsaves=3Don,cmp-legacy= =3Don,amd-ssbd=3Don,virt-ssbd=3Don,\ rdctl-no=3Don,skip-l1dfl-vmentry=3Don,mds-no=3Don,pschange-mc-no=3Don \ -m 4096 \ -object memory-backend-file,id=3Dpc.ram,\ -mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-fedora,share=3Dyes,prealloc=3D= yes,\ -size=3D4294967296 \ +mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-fedora,share=3Dyes,\ +x-use-canonical-path-for-ramblock-id=3Dno,prealloc=3Dyes,size=3D4294967296= \ -overcommit mem-lock=3Doff \ -smp 4,sockets=3D4,cores=3D1,threads=3D1 \ -uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \ --=20 2.26.2