From nobody Thu Mar 28 21:54:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1589295216; cv=none; d=zohomail.com; s=zohoarc; b=J96N328CmieUg5lEYFWneghTDxId59Ch1+kyhyTjXIocdf/WCOwOhLjqkHtaEvh34vA44YHG9ykCCc2ShYVvT4HwV/H3i/8y7mL4e+toBSRVKXgfjTxGNMivONnKQtAdW+Z+OhQvcBBckx4JYYO+Ay9geBnIWReB3UWdIHANWPQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589295216; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5uLbo0AGWh3e+rEAcoKJzY89YpR/nyFJzfoMrGnIzqM=; b=lxG7Ic8oPVn9uDJS4m9mJk304eg0pj+MhYSfw5aZMPOw4CS11uC10BEZz7S7EvPvZ73ntIccoQWJFDHZgLZ4fR9uSMpfBa/fTEKUk+NFr6ttrJF1VPvHJtUZEMpe0gkrxOCpws5UEyBZg2qwBNSB+lFEw/7xES6XC0zFHFgZt6w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1589295216795188.965768783484; Tue, 12 May 2020 07:53:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-290-jkM6phzWPmuvH0p6ONUiIA-1; Tue, 12 May 2020 10:53:32 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 86410835B43; Tue, 12 May 2020 14:53:26 +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 5F8C434201; Tue, 12 May 2020 14:53:26 +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 2E8854E989; Tue, 12 May 2020 14:53:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04CEqsgP020971 for ; Tue, 12 May 2020 10:52:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6A2639323; Tue, 12 May 2020 14:52:54 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85EBE2E189 for ; Tue, 12 May 2020 14:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589295215; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5uLbo0AGWh3e+rEAcoKJzY89YpR/nyFJzfoMrGnIzqM=; b=C+G2hXrSsGuQzi3LAcgPVWAvTWqDrlA9H8oAPLQSeUz6H5lNNlcgRlkCj/aHwmTj9KWgjf gUR+nKN4QHQdgsGQTzRFIdd5T1NKTLQq/1+Z6rRct3Tc5kFqqgTS/iWlfL75tQeDxxoL9c ZjyTjaAWPnF2SE8D8RdyFghMi5/S0V4= X-MC-Unique: jkM6phzWPmuvH0p6ONUiIA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] qemu: Switch to new -numa memdev= Date: Tue, 12 May 2020 16:52:46 +0200 Message-Id: <7104eacff7eb78bc12f9a7d48a4c00f82b6793ab.1589294644.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 v4.1.0-rc0~9^2~25 QEMU deprecated -numa mem=3D in favor of -numa memdev=3D + -object memory-backend-*. However, the problem is these two are incompatible. A domain started with older cmd line can't be migrated to the newer one and vice versa. That is why libvirt hasn't switched to the new cmd line, until now. Starting with this commit, the new cmd line is used and this fact is then recorded in domain private data object under priv->forceNewNuma. This means, that the status XML and migration cookie have it too and thus can instruct the other daemon which cmd line to generate. Unfortunately, migration from newer to older style will fail. I'm saving the explicit check for a separate commit. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1783355 Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 20 ++--- src/qemu/qemu_domain.c | 38 +++++++++- src/qemu/qemu_domain.h | 3 + src/qemu/qemu_migration.c | 5 +- src/qemu/qemu_migration_cookie.c | 73 +++++++++++++++++++ src/qemu/qemu_migration_cookie.h | 12 +++ src/qemu/qemu_process.c | 25 ++++++- .../qemustatusxml2xmldata/backup-pull-in.xml | 1 + .../blockjob-blockdev-in.xml | 1 + .../blockjob-mirror-in.xml | 1 + .../disk-secinfo-upgrade-in.xml | 1 + .../disk-secinfo-upgrade-out.xml | 1 + .../migration-in-params-in.xml | 1 + .../migration-out-nbd-in.xml | 1 + .../migration-out-nbd-out.xml | 1 + .../migration-out-nbd-tls-in.xml | 1 + .../migration-out-nbd-tls-out.xml | 1 + .../migration-out-params-in.xml | 1 + tests/qemustatusxml2xmldata/modern-in.xml | 1 + .../qemustatusxml2xmldata/vcpus-multi-in.xml | 1 + .../hugepages-numa-default-2M.args | 10 ++- .../hugepages-numa-default-dimm.args | 8 +- .../hugepages-numa-default.args | 6 +- .../memory-hotplug-dimm-addr.args | 3 +- .../qemuxml2argvdata/memory-hotplug-dimm.args | 3 +- ...y-hotplug-nvdimm-access.x86_64-latest.args | 3 +- ...ry-hotplug-nvdimm-align.x86_64-latest.args | 3 +- ...ry-hotplug-nvdimm-label.x86_64-latest.args | 3 +- ...ory-hotplug-nvdimm-pmem.x86_64-latest.args | 3 +- ...ory-hotplug-nvdimm-ppc64.ppc64-latest.args | 3 +- ...hotplug-nvdimm-readonly.x86_64-latest.args | 3 +- .../memory-hotplug-nvdimm.x86_64-latest.args | 3 +- .../numatune-auto-prefer.args | 4 +- .../qemuxml2argvdata/pages-dimm-discard.args | 3 +- .../pages-discard-hugepages.args | 11 ++- tests/qemuxml2argvdata/pages-discard.args | 12 ++- 36 files changed, 225 insertions(+), 45 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2d8a6fb0dd..3316aae419 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7028,8 +7028,6 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, char *tmpmask =3D NULL; char *next =3D NULL; virBufferPtr nodeBackends =3D NULL; - bool needBackend =3D false; - int rc; int ret =3D -1; size_t ncells =3D virDomainNumaGetNodeCount(def->numa); =20 @@ -7039,23 +7037,21 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, if (VIR_ALLOC_N(nodeBackends, ncells) < 0) goto cleanup; =20 - /* using of -numa memdev=3D cannot be combined with -numa mem=3D, thus= we - * need to check which approach to use */ + /* Using of -numa memdev=3D cannot be combined with -numa mem=3D. + * However, as of QEMU 4.1.0 using the latter is deprecated + * and the former is preferred. */ for (i =3D 0; i < ncells; i++) { if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) || virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE) || virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD)) { =20 - if ((rc =3D qemuBuildMemoryCellBackendStr(def, cfg, i, priv, - &nodeBackends[i])) < 0) + if (qemuBuildMemoryCellBackendStr(def, cfg, i, priv, + &nodeBackends[i]) < 0) goto cleanup; - - if (rc =3D=3D 0) - needBackend =3D true; } } =20 - if (!needBackend && + if (priv->forceNewNuma =3D=3D VIR_TRISTATE_BOOL_NO && qemuBuildMemPathStr(def, cmd, priv) < 0) goto cleanup; =20 @@ -7064,7 +7060,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, if (!(cpumask =3D virBitmapFormat(virDomainNumaGetNodeCpumask(def-= >numa, i)))) goto cleanup; =20 - if (needBackend) { + if (priv->forceNewNuma =3D=3D VIR_TRISTATE_BOOL_YES) { virCommandAddArg(cmd, "-object"); virCommandAddArgBuffer(cmd, &nodeBackends[i]); } @@ -7079,7 +7075,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, virBufferAdd(&buf, tmpmask, -1); } =20 - if (needBackend) + if (priv->forceNewNuma =3D=3D VIR_TRISTATE_BOOL_YES) virBufferAsprintf(&buf, ",memdev=3Dram-node%zu", i); else virBufferAsprintf(&buf, ",mem=3D%llu", diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a1b250fd0b..4751685452 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2283,6 +2283,7 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr= priv) VIR_FREE(priv->channelTargetDir); =20 priv->memPrealloc =3D false; + priv->forceNewNuma =3D VIR_TRISTATE_BOOL_ABSENT; =20 /* remove automatic pinning data */ virBitmapFree(priv->autoNodeset); @@ -2802,6 +2803,15 @@ qemuDomainObjPrivateXMLFormatAllowReboot(virBufferPt= r buf, } =20 =20 +static void +qemuDomainObjPrivateXMLFormatForceNewNuma(virBufferPtr buf, + virTristateBool forceNewNuma) +{ + virBufferAsprintf(buf, "\n", + virTristateBoolTypeToString(forceNewNuma)); +} + + static void qemuDomainObjPrivateXMLFormatPR(virBufferPtr buf, qemuDomainObjPrivatePtr priv) @@ -3086,6 +3096,8 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, if (priv->memPrealloc) virBufferAddLit(buf, "\n"); =20 + qemuDomainObjPrivateXMLFormatForceNewNuma(buf, priv->forceNewNuma); + if (qemuDomainObjPrivateXMLFormatBlockjobs(buf, vm) < 0) return -1; =20 @@ -3552,6 +3564,26 @@ qemuDomainObjPrivateXMLParseAllowReboot(xmlXPathCont= extPtr ctxt, } =20 =20 +static int +qemuDomainObjPrivateXMLParseForceNewNuma(xmlXPathContextPtr ctxt, + virTristateBool *forceNewNuma) +{ + int val; + g_autofree char *valStr =3D NULL; + + if ((valStr =3D virXPathString("string(./forceNewNuma/@value)", ctxt))= ) { + if ((val =3D virTristateBoolTypeFromString(valStr)) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid allowReboot value '%s'"), valStr); + return -1; + } + *forceNewNuma =3D val; + } + + return 0; +} + + static void qemuDomainObjPrivateXMLParsePR(xmlXPathContextPtr ctxt, bool *prDaemonRunning) @@ -3936,7 +3968,8 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, priv->chardevStdioLogd =3D virXPathBoolean("boolean(./chardevStdioLogd= )", ctxt) =3D=3D 1; =20 - qemuDomainObjPrivateXMLParseAllowReboot(ctxt, &priv->allowReboot); + if (qemuDomainObjPrivateXMLParseAllowReboot(ctxt, &priv->allowReboot) = < 0) + goto error; =20 qemuDomainObjPrivateXMLParsePR(ctxt, &priv->prDaemonRunning); =20 @@ -3956,6 +3989,9 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, =20 priv->memPrealloc =3D virXPathBoolean("boolean(./memPrealloc)", ctxt) = =3D=3D 1; =20 + if (qemuDomainObjPrivateXMLParseForceNewNuma(ctxt, &priv->forceNewNuma= ) < 0) + goto error; + return 0; =20 error: diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 41d3f1561d..dafb1da52f 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -418,6 +418,9 @@ struct _qemuDomainObjPrivate { /* true if global -mem-prealloc appears on cmd line */ bool memPrealloc; =20 + /* true if new -numa memdev is forced */ + virTristateBool forceNewNuma; + /* running block jobs */ virHashTablePtr blockjobs; =20 diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 02e8271e42..423713e00b 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2140,6 +2140,7 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver, cookieFlags |=3D QEMU_MIGRATION_COOKIE_CPU; =20 cookieFlags |=3D QEMU_MIGRATION_COOKIE_ALLOW_REBOOT; + cookieFlags |=3D QEMU_MIGRATION_COOKIE_PRIVATE; =20 if (!(flags & VIR_MIGRATE_OFFLINE)) cookieFlags |=3D QEMU_MIGRATION_COOKIE_CAPS; @@ -2501,7 +2502,8 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, QEMU_MIGRATION_COOKIE_CPU_HOTPLUG | QEMU_MIGRATION_COOKIE_CPU | QEMU_MIGRATION_COOKIE_ALLOW_REBOOT | - QEMU_MIGRATION_COOKIE_CAPS))) + QEMU_MIGRATION_COOKIE_CAPS | + QEMU_MIGRATION_COOKIE_PRIVATE))) goto cleanup; =20 if (!(vm =3D virDomainObjListAdd(driver->domains, *def, @@ -2556,6 +2558,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, stopProcess =3D true; =20 priv->allowReboot =3D mig->allowReboot; + priv->forceNewNuma =3D mig->priv && mig->priv->forceNewNuma; =20 if (!(incoming =3D qemuMigrationDstPrepare(vm, tunnel, protocol, listenAddress, port, diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index fb8b5bcd92..032d954dca 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -51,6 +51,7 @@ VIR_ENUM_IMPL(qemuMigrationCookieFlag, "cpu", "allowReboot", "capabilities", + "private", ); =20 =20 @@ -580,6 +581,20 @@ qemuMigrationCookieAddCaps(qemuMigrationCookiePtr mig, } =20 =20 +static void +qemuMigrationCookieAddPrivate(qemuMigrationCookiePtr mig, + qemuDomainObjPrivatePtr priv) +{ + if (!mig->priv) + mig->priv =3D g_new0(qemuMigrationCookiePrivate, 1); + + mig->priv->forceNewNuma =3D priv->forceNewNuma; + + mig->flags |=3D QEMU_MIGRATION_COOKIE_PRIVATE; +} + + + static void qemuMigrationCookieGraphicsXMLFormat(virBufferPtr buf, qemuMigrationCookieGraphicsPtr grap) @@ -770,6 +785,25 @@ qemuMigrationCookieCapsXMLFormat(virBufferPtr buf, } =20 =20 +#define FORMAT_PRIV(member) \ + virBufferAsprintf(buf, "\n"= , \ + virTristateBoolTypeToString(priv->member)) + +static void +qemuMigrationCookiePrivateXMLFormat(virBufferPtr buf, + qemuMigrationCookiePrivatePtr priv) +{ + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + + FORMAT_PRIV(forceNewNuma); + + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); +} + +#undef FORMAT_PRIV + static int qemuMigrationCookieXMLFormat(virQEMUDriverPtr driver, virQEMUCapsPtr qemuCaps, @@ -858,6 +892,9 @@ qemuMigrationCookieXMLFormat(virQEMUDriverPtr driver, if (mig->flags & QEMU_MIGRATION_COOKIE_CAPS) qemuMigrationCookieCapsXMLFormat(buf, mig->caps); =20 + if (mig->flags & QEMU_MIGRATION_COOKIE_PRIVATE) + qemuMigrationCookiePrivateXMLFormat(buf, mig->priv); + virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); return 0; @@ -1179,6 +1216,35 @@ qemuMigrationCookieCapsXMLParse(xmlXPathContextPtr c= txt) } =20 =20 +#define PARSE_PRIV(member) \ + do { \ + int val; \ + g_autofree char *valStr =3D virXPathString("string(./privateData/m= ember" \ + "[@name=3D'" #member "']/= @value)", ctxt); \ + if (valStr) { \ + if ((val =3D virTristateBoolTypeFromString(valStr)) < 0) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Malformed member '%s' value %s"), \ + #member, valStr); \ + return NULL; \ + } \ + priv->member =3D val; \ + } \ + } while (0) + +static qemuMigrationCookiePrivatePtr +qemuMigrationCookiePrivateXMLParse(xmlXPathContextPtr ctxt) +{ + g_autofree qemuMigrationCookiePrivatePtr priv =3D NULL; + + priv =3D g_new0(qemuMigrationCookiePrivate, 1); + + PARSE_PRIV(forceNewNuma); + + return g_steal_pointer(&priv); +} + + static int qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, virQEMUDriverPtr driver, @@ -1357,6 +1423,10 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr m= ig, !(mig->caps =3D qemuMigrationCookieCapsXMLParse(ctxt))) goto error; =20 + if (flags & QEMU_MIGRATION_COOKIE_PRIVATE && + !(mig->priv =3D qemuMigrationCookiePrivateXMLParse(ctxt))) + goto error; + return 0; =20 error: @@ -1446,6 +1516,9 @@ qemuMigrationBakeCookie(qemuMigrationCookiePtr mig, qemuMigrationCookieAddCaps(mig, dom, party) < 0) return -1; =20 + if (flags & QEMU_MIGRATION_COOKIE_PRIVATE) + qemuMigrationCookieAddPrivate(mig, priv); + if (!(*cookieout =3D qemuMigrationCookieXMLFormatStr(driver, priv->qem= uCaps, mig))) return -1; =20 diff --git a/src/qemu/qemu_migration_cookie.h b/src/qemu/qemu_migration_coo= kie.h index 1e88684589..e1f44682a6 100644 --- a/src/qemu/qemu_migration_cookie.h +++ b/src/qemu/qemu_migration_cookie.h @@ -33,6 +33,7 @@ typedef enum { QEMU_MIGRATION_COOKIE_FLAG_CPU, QEMU_MIGRATION_COOKIE_FLAG_ALLOW_REBOOT, QEMU_MIGRATION_COOKIE_FLAG_CAPS, + QEMU_MIGRATION_COOKIE_FLAG_PRIVATE, =20 QEMU_MIGRATION_COOKIE_FLAG_LAST } qemuMigrationCookieFlags; @@ -51,6 +52,7 @@ typedef enum { QEMU_MIGRATION_COOKIE_CPU =3D (1 << QEMU_MIGRATION_COOKIE_FLAG_CPU), QEMU_MIGRATION_COOKIE_ALLOW_REBOOT =3D (1 << QEMU_MIGRATION_COOKIE_FLA= G_ALLOW_REBOOT), QEMU_MIGRATION_COOKIE_CAPS =3D (1 << QEMU_MIGRATION_COOKIE_FLAG_CAPS), + QEMU_MIGRATION_COOKIE_PRIVATE =3D (1 << QEMU_MIGRATION_COOKIE_FLAG_PRI= VATE), } qemuMigrationCookieFeatures; =20 typedef struct _qemuMigrationCookieGraphics qemuMigrationCookieGraphics; @@ -105,6 +107,13 @@ struct _qemuMigrationCookieCaps { virBitmapPtr automatic; }; =20 + +typedef struct _qemuMigrationCookiePrivate qemuMigrationCookiePrivate; +typedef qemuMigrationCookiePrivate *qemuMigrationCookiePrivatePtr; +struct _qemuMigrationCookiePrivate { + virTristateBool forceNewNuma; +}; + typedef struct _qemuMigrationCookie qemuMigrationCookie; typedef qemuMigrationCookie *qemuMigrationCookiePtr; struct _qemuMigrationCookie { @@ -148,6 +157,9 @@ struct _qemuMigrationCookie { =20 /* If flags & QEMU_MIGRATION_COOKIE_CAPS */ qemuMigrationCookieCapsPtr caps; + + /* If flags & QEMU_MIGRATION_COOKIE_PRIVATE */ + qemuMigrationCookiePrivatePtr priv; }; =20 =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index dee3f3fb63..c84f6e2d4d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6191,6 +6191,27 @@ qemuProcessPrepareAllowReboot(virDomainObjPtr vm) } =20 =20 +static void +qemuProcessPrepareForceNewNuma(virDomainObjPtr vm, + unsigned int flags) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + virQEMUCapsPtr qemuCaps =3D priv->qemuCaps; + + if (priv->forceNewNuma !=3D VIR_TRISTATE_BOOL_ABSENT) + return; + + if (flags & VIR_QEMU_PROCESS_START_NEW && + (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD))) { + priv->forceNewNuma =3D VIR_TRISTATE_BOOL_YES; + } else { + priv->forceNewNuma =3D VIR_TRISTATE_BOOL_NO; + } +} + + /** * qemuProcessPrepareDomain: * @driver: qemu driver @@ -6244,6 +6265,7 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, priv->rememberOwner =3D cfg->rememberOwner; =20 qemuProcessPrepareAllowReboot(vm); + qemuProcessPrepareForceNewNuma(vm, flags); =20 /* * Normally PCI addresses are assigned in the virDomainCreate @@ -7972,8 +7994,9 @@ qemuProcessReconnect(void *opaque) goto error; =20 /* If we are connecting to a guest started by old libvirt there is no - * allowReboot in status XML and we need to initialize it. */ + * allowReboot or forceNewNuma in status XML and we need to initialize= it. */ qemuProcessPrepareAllowReboot(obj); + qemuProcessPrepareForceNewNuma(obj, 0); =20 if (qemuHostdevUpdateActiveDomainDevices(driver, obj->def) < 0) goto error; diff --git a/tests/qemustatusxml2xmldata/backup-pull-in.xml b/tests/qemusta= tusxml2xmldata/backup-pull-in.xml index 1db978a3ac..ce66c1e768 100644 --- a/tests/qemustatusxml2xmldata/backup-pull-in.xml +++ b/tests/qemustatusxml2xmldata/backup-pull-in.xml @@ -234,6 +234,7 @@ + diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/q= emustatusxml2xmldata/blockjob-blockdev-in.xml index cc17a17ff4..6d9baee6c3 100644 --- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml @@ -233,6 +233,7 @@ + diff --git a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml b/tests/qem= ustatusxml2xmldata/blockjob-mirror-in.xml index bcef338fda..30f72c0747 100644 --- a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml @@ -22,6 +22,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-in.xml b/test= s/qemustatusxml2xmldata/disk-secinfo-upgrade-in.xml index ce55a70637..0b7a69fc5e 100644 --- a/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-in.xml +++ b/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-in.xml @@ -257,6 +257,7 @@ + upstream diff --git a/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml b/tes= ts/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml index 5d3287606f..e0c8dd11ae 100644 --- a/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml +++ b/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml @@ -257,6 +257,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/migration-in-params-in.xml b/tests= /qemustatusxml2xmldata/migration-in-params-in.xml index fdc2d39173..c16bb62543 100644 --- a/tests/qemustatusxml2xmldata/migration-in-params-in.xml +++ b/tests/qemustatusxml2xmldata/migration-in-params-in.xml @@ -256,6 +256,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-in.xml b/tests/q= emustatusxml2xmldata/migration-out-nbd-in.xml index 636accf054..dde2b0d966 100644 --- a/tests/qemustatusxml2xmldata/migration-out-nbd-in.xml +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-in.xml @@ -259,6 +259,7 @@ + upstream diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml b/tests/= qemustatusxml2xmldata/migration-out-nbd-out.xml index 304fb1b77f..9de5d71ba0 100644 --- a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml @@ -259,6 +259,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-tls-in.xml b/tes= ts/qemustatusxml2xmldata/migration-out-nbd-tls-in.xml index 2cd6c9a5e9..0e7fc97aa8 100644 --- a/tests/qemustatusxml2xmldata/migration-out-nbd-tls-in.xml +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-tls-in.xml @@ -286,6 +286,7 @@ + upstream diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml b/te= sts/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml index d69796e029..6baeaa3dec 100644 --- a/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml @@ -288,6 +288,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/migration-out-params-in.xml b/test= s/qemustatusxml2xmldata/migration-out-params-in.xml index 1956eac120..3536fd63d2 100644 --- a/tests/qemustatusxml2xmldata/migration-out-params-in.xml +++ b/tests/qemustatusxml2xmldata/migration-out-params-in.xml @@ -270,6 +270,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxm= l2xmldata/modern-in.xml index 64d42200e4..db8d9539b0 100644 --- a/tests/qemustatusxml2xmldata/modern-in.xml +++ b/tests/qemustatusxml2xmldata/modern-in.xml @@ -260,6 +260,7 @@ + -2 diff --git a/tests/qemustatusxml2xmldata/vcpus-multi-in.xml b/tests/qemusta= tusxml2xmldata/vcpus-multi-in.xml index be48c55fe0..ca74d03012 100644 --- a/tests/qemustatusxml2xmldata/vcpus-multi-in.xml +++ b/tests/qemustatusxml2xmldata/vcpus-multi-in.xml @@ -308,6 +308,7 @@ + -2 diff --git a/tests/qemuxml2argvdata/hugepages-numa-default-2M.args b/tests/= qemuxml2argvdata/hugepages-numa-default-2M.args index bbf3c9f67a..bb64f3ea2a 100644 --- a/tests/qemuxml2argvdata/hugepages-numa-default-2M.args +++ b/tests/qemuxml2argvdata/hugepages-numa-default-2M.args @@ -14,10 +14,12 @@ QEMU_AUDIO_DRV=3Dnone \ -m 1024 \ -realtime mlock=3Doff \ -smp 2,sockets=3D2,cores=3D1,threads=3D1 \ --mem-prealloc \ --mem-path /dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu \ --numa node,nodeid=3D0,cpus=3D0,mem=3D256 \ --numa node,nodeid=3D1,cpus=3D1,mem=3D768 \ +-object memory-backend-file,id=3Dram-node0,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu,size=3D26= 8435456 \ +-numa node,nodeid=3D0,cpus=3D0,memdev=3Dram-node0 \ +-object memory-backend-file,id=3Dram-node1,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu,size=3D80= 5306368 \ +-numa node,nodeid=3D1,cpus=3D1,memdev=3Dram-node1 \ -uuid ef1bdff4-27f3-4e85-a807-5fb4d58463cc \ -display none \ -no-user-config \ diff --git a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args b/test= s/qemuxml2argvdata/hugepages-numa-default-dimm.args index e219914bc3..b20778418d 100644 --- a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args +++ b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args @@ -14,10 +14,10 @@ QEMU_AUDIO_DRV=3Dnone \ -m size=3D1048576k,slots=3D16,maxmem=3D1099511627776k \ -realtime mlock=3Doff \ -smp 2,sockets=3D2,cores=3D1,threads=3D1 \ --mem-prealloc \ --mem-path /dev/hugepages2M/libvirt/qemu/-1-fedora \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D1024 \ --object memory-backend-file,id=3Dmemdimm0,\ +-object memory-backend-file,id=3Dram-node0,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-fedora,size=3D1073741824 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ +-object memory-backend-file,id=3Dmemdimm0,prealloc=3Dyes,\ mem-path=3D/dev/hugepages1G/libvirt/qemu/-1-fedora,size=3D1073741824,\ host-nodes=3D1-3,policy=3Dbind \ -device pc-dimm,node=3D0,memdev=3Dmemdimm0,id=3Ddimm0,slot=3D0 \ diff --git a/tests/qemuxml2argvdata/hugepages-numa-default.args b/tests/qem= uxml2argvdata/hugepages-numa-default.args index 674bb517d1..95dcdebbef 100644 --- a/tests/qemuxml2argvdata/hugepages-numa-default.args +++ b/tests/qemuxml2argvdata/hugepages-numa-default.args @@ -14,9 +14,9 @@ QEMU_AUDIO_DRV=3Dnone \ -m 1024 \ -realtime mlock=3Doff \ -smp 2,sockets=3D2,cores=3D1,threads=3D1 \ --mem-prealloc \ --mem-path /dev/hugepages2M/libvirt/qemu/-1-fedora \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D1024 \ +-object memory-backend-file,id=3Dram-node0,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-fedora,size=3D1073741824 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ -uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \ -display none \ -no-user-config \ diff --git a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.args b/tests/q= emuxml2argvdata/memory-hotplug-dimm-addr.args index 9ba3f8b7a0..1a93f0a9fd 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.args +++ b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.args @@ -14,7 +14,8 @@ QEMU_AUDIO_DRV=3Dnone \ -m size=3D219136k,slots=3D16,maxmem=3D1099511627776k \ -realtime mlock=3Doff \ -smp 2,sockets=3D2,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D214 \ +-object memory-backend-ram,id=3Dram-node0,size=3D224395264 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ -object memory-backend-file,id=3Dmemdimm0,prealloc=3Dyes,\ mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,size=3D536870912,\ host-nodes=3D1-3,policy=3Dbind \ diff --git a/tests/qemuxml2argvdata/memory-hotplug-dimm.args b/tests/qemuxm= l2argvdata/memory-hotplug-dimm.args index 0ac48db399..ce39721fde 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-dimm.args +++ b/tests/qemuxml2argvdata/memory-hotplug-dimm.args @@ -14,7 +14,8 @@ QEMU_AUDIO_DRV=3Dnone \ -m size=3D219136k,slots=3D16,maxmem=3D1099511627776k \ -realtime mlock=3Doff \ -smp 2,sockets=3D2,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D214 \ +-object memory-backend-ram,id=3Dram-node0,size=3D224395264 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ -object memory-backend-ram,id=3Dmemdimm0,size=3D536870912 \ -device pc-dimm,node=3D0,memdev=3Dmemdimm0,id=3Ddimm0,slot=3D0 \ -object memory-backend-file,id=3Dmemdimm1,prealloc=3Dyes,\ diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-lat= est.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-lates= t.args index 89138f46c4..faa85355d3 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-latest.args @@ -17,7 +17,8 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -m size=3D219136k,slots=3D16,maxmem=3D1099511627776k \ -overcommit mem-lock=3Doff \ -smp 2,sockets=3D2,dies=3D1,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D214 \ +-object memory-backend-ram,id=3Dram-node0,size=3D224395264 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ -object memory-backend-file,id=3Dmemnvdimm0,prealloc=3Dyes,mem-path=3D/tmp= /nvdimm,\ share=3Dno,size=3D536870912 \ -device nvdimm,node=3D0,memdev=3Dmemnvdimm0,id=3Dnvdimm0,slot=3D0 \ diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-late= st.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.= args index 1a8e7932dc..074d8f590b 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args @@ -17,7 +17,8 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -m size=3D219136k,slots=3D16,maxmem=3D1099511627776k \ -overcommit mem-lock=3Doff \ -smp 2,sockets=3D2,dies=3D1,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D214 \ +-object memory-backend-ram,id=3Dram-node0,size=3D224395264 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ -object memory-backend-file,id=3Dmemnvdimm0,prealloc=3Dyes,mem-path=3D/tmp= /nvdimm,\ share=3Dno,size=3D536870912,align=3D2097152 \ -device nvdimm,node=3D0,memdev=3Dmemnvdimm0,id=3Dnvdimm0,slot=3D0 \ diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-late= st.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.= args index ef32c663de..522a5bd2fd 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.args @@ -17,7 +17,8 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -m size=3D219136k,slots=3D16,maxmem=3D1099511627776k \ -overcommit mem-lock=3Doff \ -smp 2,sockets=3D2,dies=3D1,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D214 \ +-object memory-backend-ram,id=3Dram-node0,size=3D224395264 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ -object memory-backend-file,id=3Dmemnvdimm0,prealloc=3Dyes,mem-path=3D/tmp= /nvdimm,\ share=3Dno,size=3D536870912 \ -device nvdimm,node=3D0,label-size=3D131072,memdev=3Dmemnvdimm0,id=3Dnvdim= m0,slot=3D0 \ diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-lates= t.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.ar= gs index 5dfba9b50a..b7dceaa3b5 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args @@ -17,7 +17,8 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -m size=3D219136k,slots=3D16,maxmem=3D1099511627776k \ -overcommit mem-lock=3Doff \ -smp 2,sockets=3D2,dies=3D1,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D214 \ +-object memory-backend-ram,id=3Dram-node0,size=3D224395264 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ -object memory-backend-file,id=3Dmemnvdimm0,prealloc=3Dyes,mem-path=3D/tmp= /nvdimm,\ share=3Dno,size=3D536870912,pmem=3Don \ -device nvdimm,node=3D0,memdev=3Dmemnvdimm0,id=3Dnvdimm0,slot=3D0 \ diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-lates= t.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.ar= gs index eff80dcf80..9ba904e667 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.args @@ -17,7 +17,8 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -m size=3D1048576k,slots=3D16,maxmem=3D1099511627776k \ -overcommit mem-lock=3Doff \ -smp 2,sockets=3D2,dies=3D1,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D1024 \ +-object memory-backend-ram,id=3Dram-node0,size=3D1073741824 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ -object memory-backend-file,id=3Dmemnvdimm0,prealloc=3Dyes,mem-path=3D/tmp= /nvdimm,\ size=3D537001984 \ -device nvdimm,node=3D0,label-size=3D131072,\ diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-l= atest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-l= atest.args index 7088a4f054..e070bd74f9 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.a= rgs +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.a= rgs @@ -17,7 +17,8 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -m size=3D219136k,slots=3D16,maxmem=3D1099511627776k \ -overcommit mem-lock=3Doff \ -smp 2,sockets=3D2,dies=3D1,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D214 \ +-object memory-backend-ram,id=3Dram-node0,size=3D224395264 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ -object memory-backend-file,id=3Dmemnvdimm0,prealloc=3Dyes,mem-path=3D/tmp= /nvdimm,\ share=3Dno,size=3D536870912 \ -device nvdimm,node=3D0,unarmed=3Don,memdev=3Dmemnvdimm0,id=3Dnvdimm0,slot= =3D0 \ diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.arg= s b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args index 60d6d207c5..893360f9e6 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args @@ -17,7 +17,8 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -m size=3D1048576k,slots=3D16,maxmem=3D1099511627776k \ -overcommit mem-lock=3Doff \ -smp 2,sockets=3D2,dies=3D1,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D1024 \ +-object memory-backend-ram,id=3Dram-node0,size=3D1073741824 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ -object memory-backend-file,id=3Dmemnvdimm0,prealloc=3Dyes,mem-path=3D/tmp= /nvdimm,\ size=3D536870912 \ -device nvdimm,node=3D0,memdev=3Dmemnvdimm0,id=3Dnvdimm0,slot=3D0 \ diff --git a/tests/qemuxml2argvdata/numatune-auto-prefer.args b/tests/qemux= ml2argvdata/numatune-auto-prefer.args index babb23b938..b60d77705d 100644 --- a/tests/qemuxml2argvdata/numatune-auto-prefer.args +++ b/tests/qemuxml2argvdata/numatune-auto-prefer.args @@ -14,7 +14,9 @@ QEMU_AUDIO_DRV=3Dnone \ -m 64 \ -realtime mlock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0,mem=3D64 \ +-object memory-backend-ram,id=3Dram-node0,size=3D67108864,host-nodes=3D0-3= ,\ +policy=3Dpreferred \ +-numa node,nodeid=3D0,cpus=3D0,memdev=3Dram-node0 \ -uuid 9f4b6512-e73a-4a25-93e8-5307802821ce \ -display none \ -no-user-config \ diff --git a/tests/qemuxml2argvdata/pages-dimm-discard.args b/tests/qemuxml= 2argvdata/pages-dimm-discard.args index 96e9ffdec3..4746ed6861 100644 --- a/tests/qemuxml2argvdata/pages-dimm-discard.args +++ b/tests/qemuxml2argvdata/pages-dimm-discard.args @@ -14,7 +14,8 @@ QEMU_AUDIO_DRV=3Dnone \ -m size=3D1048576k,slots=3D16,maxmem=3D1099511627776k \ -realtime mlock=3Doff \ -smp 2,sockets=3D2,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0-1,mem=3D1024 \ +-object memory-backend-ram,id=3Dram-node0,size=3D1073741824 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ -object memory-backend-file,id=3Dmemdimm0,prealloc=3Dyes,\ mem-path=3D/dev/hugepages1G/libvirt/qemu/-1-fedora,size=3D1073741824,\ host-nodes=3D1-3,policy=3Dbind \ diff --git a/tests/qemuxml2argvdata/pages-discard-hugepages.args b/tests/qe= muxml2argvdata/pages-discard-hugepages.args index bbf3c9f67a..a549ee4030 100644 --- a/tests/qemuxml2argvdata/pages-discard-hugepages.args +++ b/tests/qemuxml2argvdata/pages-discard-hugepages.args @@ -14,10 +14,13 @@ QEMU_AUDIO_DRV=3Dnone \ -m 1024 \ -realtime mlock=3Doff \ -smp 2,sockets=3D2,cores=3D1,threads=3D1 \ --mem-prealloc \ --mem-path /dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu \ --numa node,nodeid=3D0,cpus=3D0,mem=3D256 \ --numa node,nodeid=3D1,cpus=3D1,mem=3D768 \ +-object memory-backend-file,id=3Dram-node0,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu,size=3D26= 8435456 \ +-numa node,nodeid=3D0,cpus=3D0,memdev=3Dram-node0 \ +-object memory-backend-file,id=3Dram-node1,prealloc=3Dyes,\ +mem-path=3D/dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu,\ +discard-data=3Dyes,size=3D805306368 \ +-numa node,nodeid=3D1,cpus=3D1,memdev=3Dram-node1 \ -uuid ef1bdff4-27f3-4e85-a807-5fb4d58463cc \ -display none \ -no-user-config \ diff --git a/tests/qemuxml2argvdata/pages-discard.args b/tests/qemuxml2argv= data/pages-discard.args index b2aed77ff9..2d7fc2a50c 100644 --- a/tests/qemuxml2argvdata/pages-discard.args +++ b/tests/qemuxml2argvdata/pages-discard.args @@ -14,10 +14,14 @@ QEMU_AUDIO_DRV=3Dnone \ -m 4096 \ -realtime mlock=3Doff \ -smp 4,sockets=3D4,cores=3D1,threads=3D1 \ --numa node,nodeid=3D0,cpus=3D0,mem=3D1024 \ --numa node,nodeid=3D1,cpus=3D1,mem=3D1024 \ --numa node,nodeid=3D2,cpus=3D2,mem=3D1024 \ --numa node,nodeid=3D3,cpus=3D3,mem=3D1024 \ +-object memory-backend-ram,id=3Dram-node0,size=3D1073741824 \ +-numa node,nodeid=3D0,cpus=3D0,memdev=3Dram-node0 \ +-object memory-backend-ram,id=3Dram-node1,size=3D1073741824 \ +-numa node,nodeid=3D1,cpus=3D1,memdev=3Dram-node1 \ +-object memory-backend-ram,id=3Dram-node2,size=3D1073741824 \ +-numa node,nodeid=3D2,cpus=3D2,memdev=3Dram-node2 \ +-object memory-backend-ram,id=3Dram-node3,size=3D1073741824 \ +-numa node,nodeid=3D3,cpus=3D3,memdev=3Dram-node3 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ --=20 2.26.2 From nobody Thu Mar 28 21:54:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1589295210; cv=none; d=zohomail.com; s=zohoarc; b=WWaDPSJlrhS1OfSViXCICsai5GoXJNLlNGnpZG6kXpJi+SKkEu17Ax4tfUturvHlMMr62VpLOXYJwGxPC/0+njj3ntiHCu11VMSbcNRLl0mLJXpE8jcTmWjNgpBmjFuqVHbx2LpYmvs9F0CSDxcFj7Q2Cf3O3gbnZdX/Hp1DxmY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589295210; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hADfgwcmq7KW3+BWufe+pZaD83AV0NHC6Um3vfAMv/Q=; b=XakxReO99ZTxewglEJ2uqNE34mHK5owjnaNjIqbOyC2327KrVdVVtp+EBeeuozQnHNFF3bsc4g9YHFJIAxKK0ZR4tbdLDhfqO0rpczbF4hqorqzhY5uCptGhyAxSwbx+jhiDfd7XlDkGTpQg8eJuPX7lmUAzByXtO4NdUyS9HQM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1589295210084998.3636582963443; Tue, 12 May 2020 07:53:30 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-7ZNxFUWvMr-3VgubPs5yug-1; Tue, 12 May 2020 10:53:26 -0400 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 1AE35835B50; Tue, 12 May 2020 14:53:20 +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 EDF1E78B2E; Tue, 12 May 2020 14:53:19 +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 B73394E987; Tue, 12 May 2020 14:53:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04CEqtqV020981 for ; Tue, 12 May 2020 10:52:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 50150341FC; Tue, 12 May 2020 14:52:55 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF7232E187 for ; Tue, 12 May 2020 14:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589295208; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hADfgwcmq7KW3+BWufe+pZaD83AV0NHC6Um3vfAMv/Q=; b=ZIoYU3NIwhXxu1DmoW70K4AEC8mqY3EDM5hb02WocpWMOlEyp8Hi8kZ6Quzi1De73YO4S0 fBovN1KaMHL+o5S9DzObrGEIBvRtGqT4Qpw47cYpNNhRYUrq0ZA5CeaTkVSy58r2qA9rhB 3ffdIJ/2N0ThBH8mk8MZk3ydE2bcobQ= X-MC-Unique: 7ZNxFUWvMr-3VgubPs5yug-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] qemu: Disallow migration to older -numa if newer is used Date: Tue, 12 May 2020 16:52:47 +0200 Message-Id: <96bfc5cee0c1e124c097ff3b635690984beafdab.1589294644.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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" As advertised in the previous commit, migration from -numa memdev=3D to -numa mem=3D is not supported and results in error. Fortunately, we can check whether the destination has used the style we told it to, or if the corresponding flag in the migration cookie is missing then we know we are talking to older daemon which would have used the old approach. Anyway, let's deny migration then. Signed-off-by: Michal Privoznik --- src/qemu/qemu_migration.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 423713e00b..dde491b720 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2424,7 +2424,8 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, cookieFlags =3D 0; } else { cookieFlags =3D QEMU_MIGRATION_COOKIE_GRAPHICS | - QEMU_MIGRATION_COOKIE_CAPS; + QEMU_MIGRATION_COOKIE_CAPS | + QEMU_MIGRATION_COOKIE_PRIVATE; } =20 if (flags & VIR_MIGRATE_POSTCOPY && @@ -3549,10 +3550,18 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, cookiein, cookieinlen, cookieFlags | QEMU_MIGRATION_COOKIE_GRAPHICS | - QEMU_MIGRATION_COOKIE_CAPS); + QEMU_MIGRATION_COOKIE_CAPS | + QEMU_MIGRATION_COOKIE_PRIVATE); if (!mig) goto error; =20 + if (priv->forceNewNuma =3D=3D VIR_TRISTATE_BOOL_YES && + !(mig->priv && mig->priv->forceNewNuma =3D=3D VIR_TRISTATE_BOOL_YE= S)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("Migration to older numa unsupported")); + goto error; + } + if (qemuMigrationSrcGraphicsRelocate(driver, vm, mig, graphicsuri) < 0) VIR_WARN("unable to provide data for graphics client relocation"); =20 --=20 2.26.2