From nobody Mon Feb 9 23:41:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1571737251; cv=none; d=zoho.com; s=zohoarc; b=RFIAJ/JdhshqfEw2MwjWdPiaJoB6D8mCtHuQ4Adgx3zq98AYFmIWXrpYPRvKlId9+PTWFv7c2H8Fq5JGff39gFJijSVD/wIiiLA5OXecqKbymM+iKFtXyUpxFpUepTtrDgUyhNQ/XzmsWxUDGW82NwZiyzxXE4J3oHG9pzaINVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571737251; 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=fjEAUN/wQJGcled5tkI6irGoXQgDo3bAPtn8LOdt4xE=; b=RZC6TMjVPix6D9KXmjAJE2uNLVbH5Jv7kEj+PlG+sgyfeW/VgzPMbxVuwV8vBjJ8ujPOXWSlVa6NqE7cxaXNa7wiekQXcel1OFu2og88rejuaXmlMWoTGhpGwlrlHXFC6auHo2CqYh6qO4iU0rnn9O1ZyOOkG30K3cazOOXvdk8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1571737251943142.03850004461333; Tue, 22 Oct 2019 02:40:51 -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-313-u_gtbZUkNLWxKBhoS1dKvg-1; Tue, 22 Oct 2019 05:40:49 -0400 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 91E815F3; Tue, 22 Oct 2019 09:40:44 +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 656175F7C0; Tue, 22 Oct 2019 09:40:44 +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 27FF6180BAAA; Tue, 22 Oct 2019 09:40:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9LJNbRf004322 for ; Mon, 21 Oct 2019 15:23:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0990A5D6B0; Mon, 21 Oct 2019 19:23:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 04CB55D6A5 for ; Mon, 21 Oct 2019 19:23:37 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 27EFC3086246 for ; Mon, 21 Oct 2019 19:23:28 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9LJEK0e104969 for ; Mon, 21 Oct 2019 19:23:27 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2vqu4qhqha-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Oct 2019 19:23:27 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9LJITtZ055213 for ; Mon, 21 Oct 2019 19:21:26 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2vrc0096mg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Oct 2019 19:21:26 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x9LJLQhQ013102 for ; Mon, 21 Oct 2019 19:21:26 GMT Received: from waters.dynamic.ziggo.nl (/10.175.22.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Oct 2019 12:21:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571737251; 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=fjEAUN/wQJGcled5tkI6irGoXQgDo3bAPtn8LOdt4xE=; b=Cd4jTlAC4j/t1VuF6Y2F5QfbgtpEq10Su74SEcMHR7zYmuzz1R2g5pr8xU5C/HLdkTS4+U ix5Y/GsMvmhlZhnbM1gXIfM3XI4OXnL73RQziB/V/mz+UwVtNCgS1Az3luq1vgbcFJdRNI H6pQqr3KHIICB5GOl5uP9YRrpNTvM2E= From: Wim Ten Have To: Libvirt Development List Date: Mon, 21 Oct 2019 21:21:07 +0200 Message-Id: <20191021192108.25974-4-wim.ten.have@oracle.com> In-Reply-To: <20191021192108.25974-1-wim.ten.have@oracle.com> References: <20191021192108.25974-1-wim.ten.have@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9417 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910210186 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9417 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910210186 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 21 Oct 2019 19:23:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 21 Oct 2019 19:23:33 +0000 (UTC) for IP:'156.151.31.85' DOMAIN:'userp2120.oracle.com' HELO:'userp2120.oracle.com' FROM:'wim.ten.have@oracle.com' RCPT:'' X-RedHat-Spam-Score: -102.4 (DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED, SPF_HELO_PASS, SPF_NONE, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 156.151.31.85 userp2120.oracle.com 156.151.31.85 userp2120.oracle.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Wim ten Have Subject: [libvirt] [RFC PATCH v1 3/4] qemu: driver changes adding vNUMA memory hotplug support 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 X-MC-Unique: u_gtbZUkNLWxKBhoS1dKvg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Wim ten Have Add support for hot plugging memory into vNUMA partitioned KVM guests. Hot plugging memory without a target node with result in evenly balancing the added memory along all vNUMA nodes. Signed-off-by: Wim ten Have --- src/qemu/qemu_driver.c | 59 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e64afcb8efc9..8d1f0bf13cb7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2348,9 +2348,12 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom= , unsigned long newmem, } =20 if (persistentDef) { - /* resizing memory with NUMA nodes specified doesn't work as t= here - * is no way to change the individual node sizes with this API= */ - if (virDomainNumaGetNodeCount(persistentDef->numa) > 0) { + /* Resizing memory with NUMA nodes specified doesn't work, as = there + * is no way to change the individual node sizes with this API= , but + * when vNUMA automatic partitioning is in effect resizing is = possible. + */ + if (!virDomainVnumaIsEnabled(persistentDef->numa) && + virDomainNumaGetNodeCount(persistentDef->numa) > 0) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("initial memory size of a domain with NUM= A " "nodes cannot be modified with this API")= ); @@ -2365,7 +2368,12 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom= , unsigned long newmem, goto endjob; } =20 - virDomainDefSetMemoryTotal(persistentDef, newmem); + if (virDomainDefSetNUMAMemoryTotal(persistentDef, newmem, driv= er->caps) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to distribute newly configured " + "memory across NUMA nodes")); + goto endjob; + } =20 if (persistentDef->mem.cur_balloon > newmem) persistentDef->mem.cur_balloon =3D newmem; @@ -2378,6 +2386,18 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom= , unsigned long newmem, /* resize the current memory */ unsigned long oldmax =3D 0; =20 + if ((def && + virDomainVnumaIsEnabled(def->numa) && + virDomainNumaGetNodeCount(def->numa)) || + (persistentDef && + virDomainVnumaIsEnabled(persistentDef->numa) && + virDomainNumaGetNodeCount(persistentDef->numa)) > 0) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("the current memory size of a domain with NUM= A " + "nodes cannot be modified with this API")); + goto endjob; + } + if (def) oldmax =3D virDomainDefGetMemoryTotal(def); if (persistentDef) { @@ -7820,6 +7840,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, { int ret =3D -1; const char *alias =3D NULL; + virDomainMemoryDefPtr mem; =20 switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_DISK: @@ -7895,8 +7916,34 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, case VIR_DOMAIN_DEVICE_MEMORY: /* note that qemuDomainAttachMemory always consumes dev->data.memo= ry * and dispatches DeviceAdded event on success */ - ret =3D qemuDomainAttachMemory(driver, vm, - dev->data.memory); + + mem =3D dev->data.memory; + if (mem->targetNode >=3D 0) { + ret =3D qemuDomainAttachMemory(driver, vm, + dev->data.memory); + } else { + size_t i, ncells =3D virDomainNumaGetNodeCount(vm->def->numa); + unsigned long long memsizeCell =3D dev->data.memory->size / nc= ells; + + for (i =3D 0; i < ncells; i++) { + + if (VIR_ALLOC(mem) < 0) { + ret =3D -1; + break; + } + + memcpy(mem, dev->data.memory, sizeof(virDomainMemoryDef)); + + if (dev->data.memory->sourceNodes) + virBitmapCopy(mem->sourceNodes, dev->data.memory->sour= ceNodes); + + mem->size =3D memsizeCell; + mem->targetNode =3D i; + + ret =3D qemuDomainAttachMemory(driver, vm, mem); + } + virDomainMemoryDefFree(dev->data.memory); + } dev->data.memory =3D NULL; break; =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list