kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: "Markus Armbruster" <armbru@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"Shaoqin Huang" <shahuang@redhat.com>,
	"Eric Auger" <eauger@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Sebastian Ott" <sebott@redhat.com>,
	"Gavin Shan" <gshan@redhat.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org, qemu-arm@nongnu.org,
	"Dapeng Mi" <dapeng1.mi@intel.com>, "Yi Lai" <yi1.lai@intel.com>,
	"Alexander Graf" <agraf@csgraf.de>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>
Subject: Re: [PATCH 1/5] qapi/qom: Introduce kvm-pmu-filter object
Date: Sun, 27 Apr 2025 15:26:20 +0800	[thread overview]
Message-ID: <aA3cHIcKmt3vdkVk@intel.com> (raw)
In-Reply-To: <fa6f20a9-3d7a-4c2d-94e5-c20dbaf4303e@linaro.org>

Hi Philip and Markus,

Let's discuss how to handle compilation for different architectures as
well as different accelerators here.

> > And "raw" format as a lower level format can be used for other arches
> > (e.g., ARM).
> 
> Since you provide the ability to use a raw format, are we sure other
> accelerators will never be interested in such PMU filtering?
> 
> I'm pretty sure HVF could benefit of it (whether we implement it there
> is another story).

Nice to know it could benefit more cases.

> What do you think about adding this as a generic accelerator feature.

I can implement pmu-filter directly at the "accel" level.

> If a particular accel doesn't support it and we ask to filter, we simply
> report an error.

One of the main issues is how to organize the QAPI scheme:

First we have a "qapi/accelerator.json" like current implementation to
provide:

##
# = Accelerators
##

Then we should have a "qapi/accelerator-target.json" (which will follows
qapi/accelerator.json in qapi-schema.json, just like machine.json &
machine-target.json), and place all pmu-filter related things in this
file with specify the compilation condition, for example:

{ 'struct': 'KvmPmuFilterProperties',
  'data': { 'action': 'KvmPmuFilterAction',
            '*x86-fixed-counter': 'uint32',
            '*events': ['KvmPmuFilterEvent'] },
  'if': 'CONFIG_KVM' }

In the future, this could be expanded to: 'if': { 'any': [ 'CONFIG_HVF', 'CONFIG_KVM' ] }.

I understand that there is no way to specify the architecture here,
because it is not possible to specify a combination case like
"TARGET_I386 & CONFIG_KVM", "TARGET_ARM & CONFIG_KVM", "TARGET_ARM & CONFIG_HVF"
(please educate me if such "if" condition be implemented in QAPI :-)).

So, I will put the arch-specific format check in pmu-filter.c by adding
arch macros as I mentioned in this reply:

https://lore.kernel.org/qemu-devel/aA3TeaYG9mNMdEiW@intel.com/

And there'll need accel-specific format check (for example, maksed-entry
is KVM specific, and it is not defined in x86 spec). I can check the
accel-specific format in the `check` hook of
object_class_property_add_link(), which links the pmu-filter object to
accelerator.

Do you like this idea?

Thanks,
Zhao



  reply	other threads:[~2025-04-27  7:05 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09  8:26 [PATCH 0/5] accel/kvm: Support KVM PMU filter Zhao Liu
2025-04-09  8:26 ` [PATCH 1/5] qapi/qom: Introduce kvm-pmu-filter object Zhao Liu
2025-04-10 14:21   ` Markus Armbruster
2025-04-11  4:03     ` Zhao Liu
2025-04-11  4:38       ` Markus Armbruster
2025-04-11  6:34         ` Zhao Liu
2025-04-16  8:17           ` Markus Armbruster
2025-04-24  6:33             ` Zhao Liu
2025-04-25 10:35               ` Philippe Mathieu-Daudé
2025-04-27  7:26                 ` Zhao Liu [this message]
2025-04-24 12:18   ` Markus Armbruster
2025-04-24 15:34     ` Zhao Liu
2025-04-25  9:19   ` Markus Armbruster
2025-04-09  8:26 ` [PATCH 2/5] i386/kvm: Support basic KVM PMU filter Zhao Liu
2025-04-25  9:19   ` Markus Armbruster
2025-04-27  8:34     ` Zhao Liu
2025-04-28  6:12       ` Markus Armbruster
2025-04-28 14:12         ` Zhao Liu
2025-04-09  8:26 ` [PATCH 3/5] i386/kvm: Support event with select & umask format in " Zhao Liu
2025-04-25  9:33   ` Markus Armbruster
2025-04-27  6:49     ` Zhao Liu
2025-04-28  7:19       ` Markus Armbruster
2025-04-28 14:42         ` Zhao Liu
2025-04-28 16:24           ` Markus Armbruster
2025-04-29  6:24             ` Zhao Liu
2025-04-09  8:26 ` [PATCH 4/5] i386/kvm: Support event with masked entry " Zhao Liu
2025-04-25  9:37   ` Markus Armbruster
2025-04-09  8:26 ` [PATCH 5/5] i386/kvm: Support fixed counter " Zhao Liu
2025-04-24  8:17   ` Mi, Dapeng
2025-04-24 15:35     ` Zhao Liu
2025-04-25 10:32   ` Philippe Mathieu-Daudé
2025-04-27  7:35     ` Zhao Liu
2025-04-15  7:49 ` [PATCH 0/5] accel/kvm: Support " Shaoqin Huang
2025-04-15  9:59   ` Zhao Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aA3cHIcKmt3vdkVk@intel.com \
    --to=zhao1.liu@intel.com \
    --cc=agraf@csgraf.de \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dapeng1.mi@intel.com \
    --cc=eauger@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=gshan@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sebott@redhat.com \
    --cc=shahuang@redhat.com \
    --cc=thuth@redhat.com \
    --cc=yi1.lai@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).