From: Shaoqin Huang <shahuang@redhat.com>
To: "Zhao Liu" <zhao1.liu@intel.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Cc: 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,
Zhenyu Wang <zhenyu.z.wang@intel.com>,
Dapeng Mi <dapeng1.mi@intel.com>
Subject: Re: [PATCH v9] arm/kvm: Enable support for KVM_ARM_VCPU_PMU_V3_FILTER
Date: Mon, 27 May 2024 14:41:01 +0800 [thread overview]
Message-ID: <d3733e25-eb1e-4c19-b77f-d68e871c9f0f@redhat.com> (raw)
In-Reply-To: <ZkG4nlwRnvz9oUXX@intel.com>
Hi Zhao,
Thanks for your proposed idea. If you are willing to take the PMU Filter
Enabling work, you can do it. I won't update this series anymore due to
the QAPI restriction. I really appreciate if you can implement that.
Thanks,
Shaoqin
On 5/13/24 14:52, Zhao Liu wrote:
> Hi Daniel,
>
>> Please describe it in terms of a QAPI definition, as that's what we're
>> striving for with all QEMU public interfaces. Once the QAPI design is
>> agreed, then the -object mapping is trivial, as -object's JSON format
>> supports arbitrary QAPI structures.
>
> Thank you for your guidance!
>
> I rethought and and modified my previous proposal:
>
> Let me show the command examples firstly:
> * Add a single event:
> (x86) -object kvm-pmu-event,id=e0,action=allow,format=x86-default,\
> select=0x3c,umask=0x00
> (arm or general) -object kvm-pmu-event,id=e1,action=deny,\
> format=raw,code=0x01
>
> * Add a counter bitmap:
> (x86) -object kvm-pmu-counter,id=cnt,action=allow,type=x86-fixed,\
> bitmap=0xffff0000
>
> * Add an event list (must use Json syntax format):
> (x86) -object '{"qom-type":"kvm-pmu-event-list","id"="filter0","action"="allow","format"="x86-default","events=[{"select"=0x3c,"umask"=0x00},{"select"=0x2e,"umask"=0x4f}]'
> (arm) -object '{"qom-type":"kvm-pmu-event-list","id"="filter1","action"="allow","format"="raw","events"=[{"code"=0x01},{"code"=0x02}]'
>
>
> The specific JSON definitions are as follows (IIUC, this is "in terms of
> a QAPI definition", right? ;-)):
> * Define PMU event and counter bitmap with JSON format:
> - basic filter action:
>
> { 'enum': 'KVMPMUFilterAction',
> 'prefix': 'KVM_PMU_FILTER_ACTION',
> 'data': ['deny', 'allow' ] }
>
> - PMU counter:
>
> { 'enum': 'KVMPMUCounterType',
> 'prefix': 'KVM_PMU_COUNTER_TYPE',
> 'data': [ 'x86-fixed' ] }
>
> { 'struct': 'KVMPMUX86FixedCounter',
> 'data': { 'bitmap': 'uint32' } }
>
> - PMU events (total 3 formats):
>
> # 3 encoding formats: "raw" is compatible with shaoqin's ARM format as
> # well as the x86 raw format, and could support other architectures in
> # the future.
> { 'enum': 'KVMPMUEventEncodeFmt',
> 'prefix': 'KVM_PMU_EVENT_ENCODE_FMT',
> 'data': ['raw', 'x86-default', 'x86-masked-entry' ] }
>
> # A general format.
> { 'struct': 'KVMPMURawEvent',
> 'data': { 'code': 'uint64' } }
>
> # x86-specific
> { 'struct': 'KVMPMUX86DefalutEvent',
> 'data': { 'select': 'uint16',
> 'umask': 'uint16' } }
>
> # another x86 specific
> { 'struct': 'KVMPMUX86MaskedEntry',
> 'data': { 'select': 'uint16',
> 'match': 'uint8',
> 'mask': 'uint8',
> 'exclude': 'bool' } }
>
> # And their list wrappers:
> { 'struct': 'KVMPMURawEventList',
> 'data': { 'events': ['KVMPMURawEvent'] } }
>
> { 'struct': 'KVMPMUX86DefalutEventList',
> 'data': { 'events': ['KVMPMUX86DefalutEvent'] } }
>
> { 'struct': 'KVMPMUX86MaskedEntryList',
> 'data': { 'events': ['KVMPMUX86MaskedEntryList'] } }
>
>
> Based on the above basic structs, we could provide 3 new more qom-types:
> - 'kvm-pmu-counter': 'KVMPMUFilterCounter'
>
> # This is a single object option to configure PMU counter
> # bitmap filter.
> { 'union': 'KVMPMUFilterCounter',
> 'base': { 'action': 'KVMPMUFilterAction',
> 'type': 'KVMPMUCounterType' },
> 'discriminator': 'type',
> 'data': { 'x86-fixed': 'KVMPMUX86FixedCounter' } }
>
>
> - 'kvm-pmu-counter': 'KVMPMUFilterCounter'
>
> # This option is used to configure a single PMU event for
> # PMU filter.
> { 'union': 'KVMPMUFilterEvent',
> 'base': { 'action': 'KVMPMUFilterAction',
> 'format': 'KVMPMUEventEncodeFmt' },
> 'discriminator': 'format',
> 'data': { 'raw': 'KVMPMURawEvent',
> 'x86-default': 'KVMPMUX86DefalutEvent',
> 'x86-masked-entry': 'KVMPMUX86MaskedEntry' } }
>
>
> - 'kvm-pmu-event-list': 'KVMPMUFilterEventList'
>
> # Used to configure multiple events.
> { 'union': 'KVMPMUFilterEventList',
> 'base': { 'action': 'KVMPMUFilterAction',
> 'format': 'KVMPMUEventEncodeFmt' },
> 'discriminator': 'format',
> 'data': { 'raw': 'KVMPMURawEventList',
> 'x86-default': 'KVMPMUX86DefalutEventList',
> 'x86-masked-entry': 'KVMPMUX86MaskedEntryList' } }
>
>
> Compared to Shaoqin's original format, kvm-pmu-event-list is not able to
> enumerate events continuously (similar to 0x00-0x30 before), and now
> user must enumerate events one by one individually.
>
> What do you think about the above 3 new commands?
>
> Thanks and Best Regards,
> Zhao
>
--
Shaoqin
next prev parent reply other threads:[~2024-05-27 6:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 2:49 [PATCH v9] arm/kvm: Enable support for KVM_ARM_VCPU_PMU_V3_FILTER Shaoqin Huang
2024-04-09 5:33 ` Thomas Huth
2024-04-09 7:47 ` Shaoqin Huang
2024-04-10 6:07 ` Thomas Huth
2024-04-16 15:17 ` Cornelia Huck
2024-04-15 17:29 ` Daniel P. Berrangé
2024-05-07 9:33 ` Shaoqin Huang
2024-05-09 9:48 ` Zhao Liu
2024-05-09 9:39 ` Daniel P. Berrangé
2024-05-13 6:52 ` Zhao Liu
2024-05-15 16:47 ` Daniel P. Berrangé
2024-05-27 6:41 ` Shaoqin Huang [this message]
2024-05-27 10:24 ` 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=d3733e25-eb1e-4c19-b77f-d68e871c9f0f@redhat.com \
--to=shahuang@redhat.com \
--cc=berrange@redhat.com \
--cc=dapeng1.mi@intel.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=thuth@redhat.com \
--cc=zhao1.liu@intel.com \
--cc=zhenyu.z.wang@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).