From nobody Mon Feb 9 13:57:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599808045; cv=none; d=zohomail.com; s=zohoarc; b=V2+7dpN+ls7RqkpAxHBms1/YbEX0Iga1IOH1Lt7+UpRdoVifL/OgogdEhLczMD883r/T/29m9hCeQQDttsZdi2tgBR2ZD5v7PT/mIVEOhRMvQsDoNAsESZYCmkEnh+wCE8l22IZIM61b7g6DKYtic+reBHa/1FmchL3e5u2aTvo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599808045; 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=rAv9qDouKzgQ2RAzWu7onGatVkFQtGn72LSAL1tQiWI=; b=d0IDLSewVwAmgL2ac759niYOTgSKshhQcl4WVQoJT3YLVVAq/9MSf+yq3W6I+uIa/R4MG7jNH+3qlXY1FiycJaNZ4UvgEOV72TPpuGjHZnXp72808/b1rRiWz+VoiQLT5LHuI+J3VGuYw6TGzB7P7/NA4f9bnWeLgeDpjanfMUg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599808045149585.7854158530879; Fri, 11 Sep 2020 00:07:25 -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-246-tF4DaVVJPoiEjOvCWEJNlw-1; Fri, 11 Sep 2020 03:07:21 -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 5225F393B7; Fri, 11 Sep 2020 07:07:16 +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 796E31A835; Fri, 11 Sep 2020 07:07:15 +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 9010092300; Fri, 11 Sep 2020 07:07:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08B76lbv006896 for ; Fri, 11 Sep 2020 03:06:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id EBADB2144B2F; Fri, 11 Sep 2020 07:06:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6F132166B27 for ; Fri, 11 Sep 2020 07:06:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8DEC3101AA41 for ; Fri, 11 Sep 2020 07:06:44 +0000 (UTC) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-292-YGHzj8_JNh-vgHPt2rc_9w-1; Fri, 11 Sep 2020 03:06:42 -0400 Received: by mail-pg1-f193.google.com with SMTP id f2so3956955pgd.3 for ; Fri, 11 Sep 2020 00:06:41 -0700 (PDT) Received: from t440p.suse.asia (60-251-47-115.HINET-IP.hinet.net. [60.251.47.115]) by smtp.gmail.com with ESMTPSA id a19sm1252037pfn.10.2020.09.11.00.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2020 00:06:39 -0700 (PDT) X-MC-Unique: tF4DaVVJPoiEjOvCWEJNlw-1 X-MC-Unique: YGHzj8_JNh-vgHPt2rc_9w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rAv9qDouKzgQ2RAzWu7onGatVkFQtGn72LSAL1tQiWI=; b=kUbxq00w46KR+zvQkvjRhWjNX6GhWlZStTOXdJ2tUf6YD+VwMCkhrn+qwY6MwUNhhy TBBR5iw/nZz8byUkk9Phw9w9BxNY8viU5FaMWeU7Iahz5HAan69ht+OhAG78S81B0kDB v2mPMkcFMNvAcRx5fMw4ybILQ8cIu+oGKNU2biLUH5vS8ay9upoHBZx9IpuzThkHyK/H rkIaGgs+7C3ZY0TV/ZjD1wptt2vXkDKrYY93ktqPNEzH2GbRJNJDvdrs+Lqk1lq+znW8 6JAwLr0nTrW7uBtJaMn+f+iLTu20blY3GnICAqfuUHi0VYLjk4rJqJo8EawvRxAgIdwd X20g== X-Gm-Message-State: AOAM5339c0udy489wcfilxZwMXxDA3p7NVmLhGlnEcilfpQPRdVOgoyG JPyauUvClEjtFnUu+/O2/++JSn+m9WUo4Q== X-Google-Smtp-Source: ABdhPJwxZna9loNs7zj3yW3EK6ZSSDNthlweJIBN4Aq36I55ARKniQl0ELIPm2D3l6hAOcGg8aIBmg== X-Received: by 2002:a17:902:9b95:: with SMTP id y21mr654586plp.97.1599807999942; Fri, 11 Sep 2020 00:06:39 -0700 (PDT) From: Lin Ma X-Google-Original-From: Lin Ma To: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/12] qemu: Return perf status that affect next boot for shutoff domains Date: Fri, 11 Sep 2020 15:06:09 +0800 Message-Id: <20200911070619.12325-3-lma@suse.de> In-Reply-To: <20200911070619.12325-1-lma@suse.de> References: <20200911070619.12325-1-lma@suse.de> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Lin Ma 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" While we set up perf events for a shutoff domain and check the settings, All of perf events are reported as 'disabled', unless we add --config, This is redundant for a shutoff domain. # virsh domstate $GUEST shut off # virsh perf --domain $GUEST cmt : disabled mbmt : disabled mbml : disabled ...... # virsh perf --domain $GUEST --enable mbmt mbmt : enabled # virsh perf --domain $GUEST cmt : disabled mbmt : disabled mbml : disabled ...... Use virDomainObjGetOneDefState instead of virDomainObjGetOneDef to fix the issue. After patch, The perf event status of a shutoff domain is reported correctly: # virsh domstate $GUEST shut off # virsh perf --domain $GUEST cmt : disabled mbmt : disabled mbml : disabled ...... # virsh perf --domain $GUEST --enable mbmt mbmt : enabled # virsh perf --domain $GUEST cmt : disabled mbmt : enabled mbml : disabled ...... Signed-off-by: Lin Ma Reviewed-by: Erik Skultety Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index bd287f259e..717afcd34d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9109,6 +9109,7 @@ qemuDomainGetPerfEvents(virDomainPtr dom, int npar =3D 0; size_t i; int ret =3D -1; + bool live =3D false; =20 virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG | @@ -9123,7 +9124,7 @@ qemuDomainGetPerfEvents(virDomainPtr dom, if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) goto cleanup; =20 - if (!(def =3D virDomainObjGetOneDef(vm, flags))) + if (!(def =3D virDomainObjGetOneDefState(vm, flags, &live))) goto endjob; =20 priv =3D vm->privateData; @@ -9131,7 +9132,7 @@ qemuDomainGetPerfEvents(virDomainPtr dom, for (i =3D 0; i < VIR_PERF_EVENT_LAST; i++) { bool perf_enabled; =20 - if (flags & VIR_DOMAIN_AFFECT_CONFIG) + if ((flags & VIR_DOMAIN_AFFECT_CONFIG) || !live) perf_enabled =3D def->perf.events[i] =3D=3D VIR_TRISTATE_BOOL_= YES; else perf_enabled =3D virPerfEventIsEnabled(priv->perf, i); --=20 2.26.0