From nobody Wed May 15 05:59:11 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=1607947751; cv=none; d=zohomail.com; s=zohoarc; b=A1EMkAz5pSszUCpDi/RJ+0joR9NfrfyVfqobxtRPuw4CNVF8wLjh8gDzEFCln4oBCwjXnV5m/EqJewS4pD8RooI1Wk1U1jKHb+/koe8SZNicDo6oIKZk1cuRIyH4NgyxpOGict3MNtLoROUqb8ytUd6AMJxicCto4mhsE59kf94= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607947751; 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=usOO+5CBKV2U0d28iTlGMrTPYjuw1OkCNvT+0Oiu9Eo=; b=DyssS6qfwQ9EOpO+6RoDu3PZ/lw932akiXG5xsxH5IpnthEyA9f1rVeIZ2QN9NwmxZ5YwXdMCY/MunvJxXJ8L5n7BwEO7hA71YzG2fzZx6ZRxdI8BE4CjItig3CZisAjg+klO4o4aVCdhido3C4qqIkG3udVvsSv24VGOFo6Qis= 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 1607947751893281.1703564827367; Mon, 14 Dec 2020 04:09:11 -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-98-w_RqdJwnNDCRD2Hvnjnuig-1; Mon, 14 Dec 2020 07:09:08 -0500 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 5145A180A086; Mon, 14 Dec 2020 12:09:02 +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 A2D4D1975F; Mon, 14 Dec 2020 12:09:01 +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 4F56D4BB7B; Mon, 14 Dec 2020 12:08:59 +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 0BEC8wdt002030 for ; Mon, 14 Dec 2020 07:08:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5C06A1975F; Mon, 14 Dec 2020 12:08:58 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1AC91C930 for ; Mon, 14 Dec 2020 12:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607947750; 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=usOO+5CBKV2U0d28iTlGMrTPYjuw1OkCNvT+0Oiu9Eo=; b=LNIrZ9rWVvZy7m7uGh6Ex47t0T85+46gphEKbdg0RIKe7o6Z+K/AQXLXM5acVdbmrBewPb F16l0qX9CylaFl/sB9BZm6LF0B924Na0LzfzPX814Mnj3ZF0WT+NuN7VROP3tddXMNXRVK U0QuKmXprfrKq3UX+CZKW2burOjPkKY= X-MC-Unique: w_RqdJwnNDCRD2Hvnjnuig-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu: Relax validation for mem->access if guest has no NUMA Date: Mon, 14 Dec 2020 13:08:43 +0100 Message-Id: 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 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 v6.8.0-27-g88957116c9 and friends I've switched the way the default RAM is specified for QEMU (from plain -m to memory-backend-*). This means, that even if a guest doesn't have any NUMA nodes configured we can use memory-backend-* attributes to translate user config requests. For instance, we can allow memory to be shared ( under ). But what my original commits are missing is allowing such configuration in our validator. Fixes: 88957116c9d3cb4705380c3702c9d4315fb500bb Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1839034#c12 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_validate.c | 10 +++-- .../hugepages-memaccess3.x86_64-latest.args | 39 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/hugepages-memaccess3.x86_64-late= st.args diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index bf8127a575..eadf3af8b3 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -754,6 +754,9 @@ static int qemuValidateDomainDefMemory(const virDomainDef *def, virQEMUCapsPtr qemuCaps) { + const char *defaultRAMid =3D virQEMUCapsGetMachineDefaultRAMid(qemuCap= s, + def->virt= Type, + def->os.m= achine); const long system_page_size =3D virGetSystemPageSizeKB(); const virDomainMemtune *mem =3D &def->mem; =20 @@ -781,9 +784,10 @@ qemuValidateDomainDefMemory(const virDomainDef *def, return -1; } =20 - /* We can't guarantee any other mem.access - * if no guest NUMA nodes are defined. */ - if (mem->hugepages[0].size !=3D system_page_size && + /* We can't guarantee any other mem.access if no guest NUMA + * nodes are defined, unless defaultRAMid is provided. */ + if (!defaultRAMid && + mem->hugepages[0].size !=3D system_page_size && virDomainNumaGetNodeCount(def->numa) =3D=3D 0 && mem->access !=3D VIR_DOMAIN_MEMORY_ACCESS_DEFAULT && mem->access !=3D VIR_DOMAIN_MEMORY_ACCESS_PRIVATE) { diff --git a/tests/qemuxml2argvdata/hugepages-memaccess3.x86_64-latest.args= b/tests/qemuxml2argvdata/hugepages-memaccess3.x86_64-latest.args new file mode 100644 index 0000000000..6033950eab --- /dev/null +++ b/tests/qemuxml2argvdata/hugepages-memaccess3.x86_64-latest.args @@ -0,0 +1,39 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-fedora \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-fedora/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-fedora/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-fedora/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dfedora,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-fedora/master-key.aes \ +-machine pc-i440fx-2.9,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,\ +memory-backend=3Dpc.ram \ +-cpu EPYC-Rome,x2apic=3Don,tsc-deadline=3Don,hypervisor=3Don,tsc-adjust=3D= on,stibp=3Don,\ +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 \ +-overcommit mem-lock=3Doff \ +-smp 4,sockets=3D4,cores=3D1,threads=3D1 \ +-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot menu=3Don,strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 9b853c6d59..96a2b95331 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1145,6 +1145,7 @@ mymain(void) DO_TEST_PARSE_ERROR("hugepages-memaccess3", QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); + DO_TEST_CAPS_LATEST("hugepages-memaccess3"); DO_TEST_CAPS_LATEST("hugepages-nvdimm"); DO_TEST("nosharepages", QEMU_CAPS_MEM_MERGE); DO_TEST("disk-cdrom", NONE); --=20 2.26.2