From nobody Sun Feb 8 23:05:53 2026 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=1605512651; cv=none; d=zohomail.com; s=zohoarc; b=IpRrHiz0UzcmP5InGLZ+nHNA7Q5/yPfrb5qyZbrNiOx7Ooi7lkYN2xtpP9vOABrZVZcgOG983JWwMFkwMCVNeuunBe/3WXviELkWFYH9uenoV0RrHDlvRcn9XNS+l8DexEfNzzM+6AmzCyIwenBcvMpxmR8BZLNbspA01Szemt8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605512651; 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=TrogYxQW3JYUbnzhuscJ9c4Ogh3CpKe3MaDbd6P0XR0=; b=PdvsYbNIRWodnZC0FkqpBvXb9KrXia0dsdh/dh1XUMQBGFW5aM4f6K3as5p64lqmWZBBQCyGX2X2+smbSzzfpFVz+WC2TNKaIlPzneCu/eyqNNTx73xVo/zvucmy0IQSXXTsSzQrzUtHi71aIjJfxATbl6FO6Fs22+u0RDUU+Io= 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 1605512651881600.5553328551807; Sun, 15 Nov 2020 23:44: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-404-D7bxo2bPMC6rpGwbuqln6A-1; Mon, 16 Nov 2020 02:44:08 -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 8CA081009443; Mon, 16 Nov 2020 07:44:03 +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 6DE0C5B4CC; Mon, 16 Nov 2020 07:44:03 +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 3A58958124; Mon, 16 Nov 2020 07:44:03 +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 0AG7hrpC032566 for ; Mon, 16 Nov 2020 02:43:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 23E975B4A9; Mon, 16 Nov 2020 07:43:53 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 989595B4BB for ; Mon, 16 Nov 2020 07:43:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605512650; 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=TrogYxQW3JYUbnzhuscJ9c4Ogh3CpKe3MaDbd6P0XR0=; b=iGkrsfuOA29ac+EKc/WSugHcKSdg1m7FVqDWuv7tpqt77E7UH9pTR1WhWDnMCCfDdgMOJ5 QbHSr9sdrofy36nLhPJv9T99GDGSuzm2HVidF9Ph8wWcZ7SV/v0HoDmMFtiKz/IcYi+fMd jHHmpFisvxXEW+iajjPMrsdg/7YbrZk= X-MC-Unique: D7bxo2bPMC6rpGwbuqln6A-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/5] qemu: Don't cache domCaps in virQEMUDriverGetDomainCapabilities() Date: Mon, 16 Nov 2020 08:43:43 +0100 Message-Id: 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 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) Content-Type: text/plain; charset="utf-8" Currently, whenever a domain capabilities is needed (fortunately, after cleanup done by previous commits it is now only in virConnectGetDomainCapabilities()), the object is stored in a cache. But there is no invalidation mechanism for the cache (except the implicit one - the cache is part of qemuCaps and thus share its lifetime, but that is not enough). Therefore, if something changes - for instance new firmware files are installed, or old are removed these changes are not reflected in the virConnectGetDomainCapabilities() output. Originally, the caching was there because domCaps were used during device XML validation and they were used a lot from our test suite. But this is no longer the case. And therefore, we don't need the cache and can construct fresh domCaps on each virConnectGetDomainCapabilities() call. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1807198 Signed-off-by: Michal Privoznik --- src/qemu/qemu_conf.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 2fb2f021c2..518f82deaa 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1422,11 +1422,8 @@ virCapsPtr virQEMUDriverGetCapabilities(virQEMUDrive= rPtr driver, /** * virQEMUDriverGetDomainCapabilities: * - * Get a reference to the virDomainCapsPtr instance from the virQEMUCapsPtr - * domCapsCache. If there's no domcaps in the cache, create a new instance, - * add it to the cache, and return a reference. - * - * The caller must release the reference with virObjetUnref + * Get a reference to the virDomainCapsPtr instance. The caller + * must release the reference with virObjetUnref(). * * Returns: a reference to a virDomainCapsPtr instance or NULL */ @@ -1438,15 +1435,19 @@ virQEMUDriverGetDomainCapabilities(virQEMUDriverPtr= driver, virDomainVirtType virttype) { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + g_autoptr(virDomainCaps) domCaps =3D NULL; + const char *path =3D virQEMUCapsGetBinary(qemuCaps); =20 - return virQEMUCapsGetDomainCapsCache(qemuCaps, - machine, - arch, - virttype, - driver->hostarch, - driver->privileged, - cfg->firmwares, - cfg->nfirmwares); + if (!(domCaps =3D virDomainCapsNew(path, machine, arch, virttype))) + return NULL; + + if (virQEMUCapsFillDomainCaps(qemuCaps, driver->hostarch, + domCaps, driver->privileged, + cfg->firmwares, + cfg->nfirmwares) < 0) + return NULL; + + return g_steal_pointer(&domCaps); } =20 =20 --=20 2.26.2