From: Kevin Wolf <kwolf@redhat.com>
To: Shaoqin Huang <shahuang@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
qemu-arm@nongnu.org, "Eric Auger" <eauger@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org, armbru@redhat.com
Subject: Re: [PATCH v8] arm/kvm: Enable support for KVM_ARM_VCPU_PMU_V3_FILTER
Date: Tue, 2 Apr 2024 15:01:50 +0200 [thread overview]
Message-ID: <ZgwBvuCrTwKmA0IK@redhat.com> (raw)
In-Reply-To: <46f0c5ab-dee7-4cd4-844d-c418818e187c@redhat.com>
Am 29.03.2024 um 04:45 hat Shaoqin Huang geschrieben:
> Hi Daniel,
>
> On 3/25/24 16:55, Daniel P. Berrangé wrote:
> > On Mon, Mar 25, 2024 at 01:35:58PM +0800, Shaoqin Huang wrote:
> > > Hi Daniel,
> > >
> > > Thanks for your reviewing. I see your comments in the v7.
> > >
> > > I have some doubts about what you said about the QAPI. Do you want me to
> > > convert the current design into the QAPI parsing like the
> > > IOThreadVirtQueueMapping? And we need to add new json definition in the
> > > qapi/ directory?
>
> I have defined the QAPI for kvm-pmu-filter like below:
>
> +##
> +# @FilterAction:
> +#
> +# The Filter Action
> +#
> +# @a: Allow
> +#
> +# @d: Disallow
> +#
> +# Since: 9.0
> +##
> +{ 'enum': 'FilterAction',
> + 'data': [ 'a', 'd' ] }
> +
> +##
> +# @SingleFilter:
> +#
> +# Lazy
> +#
> +# @action: the action
> +#
> +# @start: the start
> +#
> +# @end: the end
> +#
> +# Since: 9.0
> +##
> +
> +{ 'struct': 'SingleFilter',
> + 'data': { 'action': 'FilterAction', 'start': 'int', 'end': 'int' } }
> +
> +##
> +# @KVMPMUFilter:
> +#
> +# Lazy
> +#
> +# @filter: the filter
> +#
> +# Since: 9.0
> +##
> +
> +{ 'struct': 'KVMPMUFilter',
> + 'data': { 'filter': ['SingleFilter'] }}
>
> And I guess I can use it by adding code like below:
>
> --- a/hw/core/qdev-properties-system.c
> +++ b/hw/core/qdev-properties-system.c
> @@ -1206,3 +1206,35 @@ const PropertyInfo qdev_prop_iothread_vq_mapping_list
> = {
> .set = set_iothread_vq_mapping_list,
> .release = release_iothread_vq_mapping_list,
> };
> +
> +/* --- kvm-pmu-filter ---*/
> +
> +static void get_kvm_pmu_filter(Object *obj, Visitor *v,
> + const char *name, void *opaque, Error **errp)
> +{
> + KVMPMUFilter **prop_ptr = object_field_prop_ptr(obj, opaque);
> +
> + visit_type_KVMPMUFilter(v, name, prop_ptr, errp);
> +}
> +
> +static void set_kvm_pmu_filter(Object *obj, Visitor *v,
> + const char *name, void *opaque, Error **errp)
> +{
> + KVMPMUFilter **prop_ptr = object_field_prop_ptr(obj, opaque);
> + KVMPMUFilter *list;
> +
> + printf("running the %s\n", __func__);
> + if (!visit_type_KVMPMUFilter(v, name, &list, errp)) {
> + return;
> + }
> +
> + printf("The name is %s\n", name);
> + *prop_ptr = list;
> +}
> +
> +const PropertyInfo qdev_prop_kvm_pmu_filter = {
> + .name = "KVMPMUFilter",
> + .description = "der der",
> + .get = get_kvm_pmu_filter,
> + .set = set_kvm_pmu_filter,
> +};
>
> +#define DEFINE_PROP_KVM_PMU_FILTER(_name, _state, _field) \
> + DEFINE_PROP(_name, _state, _field, qdev_prop_kvm_pmu_filter, \
> + KVMPMUFilter *)
>
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -2439,6 +2441,7 @@ static Property arm_cpu_properties[] = {
> mp_affinity, ARM64_AFFINITY_INVALID),
> DEFINE_PROP_INT32("node-id", ARMCPU, node_id, CPU_UNSET_NUMA_NODE_ID),
> DEFINE_PROP_INT32("core-count", ARMCPU, core_count, -1),
> + DEFINE_PROP_KVM_PMU_FILTER("kvm-pmu-filter", ARMCPU, kvm_pmu_filter),
> DEFINE_PROP_END_OF_LIST()
> };
>
> And I guess I can use the new json format input like below:
>
> qemu-system-aarch64 \
> -cpu host, '{"filter": [{"action": "a", "start": 0x10, "end": "0x11"}]}'
>
> But it doesn't work. It seems like because the -cpu option doesn't
> support json format parameter.
>
> Maybe I'm wrong. So I want to double check with if the -cpu option
> support json format nowadays?
As far as I can see, -cpu doesn't support JSON yet. But even if it did,
your command line would be invalid because the 'host,' part isn't JSON.
> If the -cpu option doesn't support json format, how I can use the QAPI
> for kvm-pmu-filter property?
This would probably mean QAPIfying all CPUs first, which sounds like a
major effort.
Kevin
next prev parent reply other threads:[~2024-04-02 13:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-12 7:48 [PATCH v8] arm/kvm: Enable support for KVM_ARM_VCPU_PMU_V3_FILTER Shaoqin Huang
2024-03-19 15:23 ` Eric Auger
2024-04-09 2:43 ` Shaoqin Huang
2024-03-22 14:53 ` Daniel P. Berrangé
2024-03-25 5:35 ` Shaoqin Huang
2024-03-25 8:55 ` Daniel P. Berrangé
2024-03-29 3:45 ` Shaoqin Huang
2024-04-02 13:01 ` Kevin Wolf [this message]
2024-04-09 1:57 ` Shaoqin Huang
2024-04-15 17:31 ` Daniel P. Berrangé
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=ZgwBvuCrTwKmA0IK@redhat.com \
--to=kwolf@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eauger@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shahuang@redhat.com \
--cc=thuth@redhat.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).