From nobody Wed May 8 23:40:58 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=1636467234; cv=none; d=zohomail.com; s=zohoarc; b=Bv8CKczgu5SQNMJ8Ru1KKbHHk7U6BUKs3yb3Xi5uPWhslb08ilAzN4d7TlNvZDxEtPO5Ntix8RKVCjHpOEO5ilMKG9exG5tijXOpOyydn2Id9Ozu4J8ZQ9H56cJ5/jeMe7GzhzCJ5Vv4Ek/kKORk1sr8bWaD6Hswjh5KNdJSluA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636467234; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=fMndECwZwWuO5JVGebfzXdsVPIt5usJvPRYfmlkISn0=; b=NeOwr7yTyK9ggJYJ4qvHexY/9vGIh+OmDkdwXKhyL3/w0kgAfZPCluQsbO+/EEe2uWjY2eAoBB3mPKBSnBx1g0XgLpR4J8qUTYaonGnROie7uOXkBM/M4z2rLvIXtwoj9S/8lHvS4Y0Dz6O0lMip/fvPpseEj1KPkNWAyVp8osg= 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 1636467234740836.3650055061981; Tue, 9 Nov 2021 06:13:54 -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-322-j39-z26gOXWb6XUKlyFfBg-1; Tue, 09 Nov 2021 09:13:50 -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 EE122804140; Tue, 9 Nov 2021 14:13: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 7E40067843; Tue, 9 Nov 2021 14:13:42 +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 A5840181A1CF; Tue, 9 Nov 2021 14:13:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1A9EDcTD011216 for ; Tue, 9 Nov 2021 09:13:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id DDC4117155; Tue, 9 Nov 2021 14:13:38 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.195.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55832794A0 for ; Tue, 9 Nov 2021 14:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636467233; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fMndECwZwWuO5JVGebfzXdsVPIt5usJvPRYfmlkISn0=; b=R4zVpfoOuxzygI0N82hwXx5WX7UYrzNFfx59afczrU+HpuW8Kr2N1592RG6gKYRi0g/p8n mfKzaSBa25/+HGnBEW6UUFduVdo11uwj5BuUlLYkkjD9M6cSNz84ezBFvft9dAY1SiMwkO S1Lfw2Sc0ucLlydPbxtWAuyf/v2HtOg= X-MC-Unique: j39-z26gOXWb6XUKlyFfBg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu_command: do not use host-nodes for system memory Date: Tue, 9 Nov 2021 15:13:23 +0100 Message-Id: <1c6dc7e39470720b192665c81d94d9499e32fa09.1636467145.git.phrdina@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 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: 1636467235330100001 Content-Type: text/plain; charset="utf-8" Commit 88957116c9d3cb4705380c3702c9d4315fb500bb switched to use memory-backend-* for regular VM memory as well. That change indirectly started using 'host-nodes' for system memory which results in QEMU calling mbind() to bind the system memory to specific NUMA node if the VM XML contains the configuration similar to this: ... ... Once the VM was started with that configuration it was no longer possible to change the memory NUMA nodeset. Fixes: 677c90cc1d1fcb3aba09b5d4f0f8f83099911775 Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 3 +- .../numatune-system-memory.x86_64-latest.args | 32 +++++++++++++++++++ .../numatune-system-memory.xml | 24 ++++++++++++++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/numatune-system-memory.x86_64-la= test.args create mode 100644 tests/qemuxml2argvdata/numatune-system-memory.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 483041f584..9bd7258b1d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3631,7 +3631,8 @@ qemuBuildMemoryBackendProps(virJSONValue **backendPro= ps, /* If mode is "restrictive", we should only use cgroups setting allowe= d memory * nodes, and skip passing the host-nodes and policy parameters to QEM= U command * line which means we will use system default memory policy. */ - if (nodemask && mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { + if (!systemMemory && nodemask && + mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { if (!virNumaNodesetIsAvailable(nodemask)) return -1; if (virJSONValueObjectAdd(props, diff --git a/tests/qemuxml2argvdata/numatune-system-memory.x86_64-latest.ar= gs b/tests/qemuxml2argvdata/numatune-system-memory.x86_64-latest.args new file mode 100644 index 0000000000..aee9b2ce76 --- /dev/null +++ b/tests/qemuxml2argvdata/numatune-system-memory.x86_64-latest.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/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 '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ +-overcommit mem-lock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-audiodev id=3Daudio1,driver=3Dnone \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/numatune-system-memory.xml b/tests/qemu= xml2argvdata/numatune-system-memory.xml new file mode 100644 index 0000000000..833303fe36 --- /dev/null +++ b/tests/qemuxml2argvdata/numatune-system-memory.xml @@ -0,0 +1,24 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 2 + + + + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a0498a0d92..161e7efa62 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2063,6 +2063,7 @@ mymain(void) DO_TEST_CAPS_LATEST("numatune-memnode"); DO_TEST_PARSE_ERROR_NOCAPS("numatune-memnode-invalid-mode"); DO_TEST_CAPS_LATEST("numatune-memnode-restrictive-mode"); + DO_TEST_CAPS_LATEST("numatune-system-memory"); =20 DO_TEST("numatune-memnode-no-memory", QEMU_CAPS_NUMA, --=20 2.31.1