[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4a8beb6d-1589-7f53-881f-8faaeb52f7ba@gmail.com>
Date: Tue, 8 Feb 2022 18:10:23 +0800
From: Like Xu <like.xu.linux@...il.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Jim Mattson <jmattson@...gle.com>
Subject: Re: [PATCH kvm/queue v2 3/3] KVM: x86/pmu: Setup the
{inte|amd}_event_mapping[] when hardware_setup
On 1/2/2022 8:28 pm, Paolo Bonzini wrote:
> On 1/17/22 09:53, Like Xu wrote:
>> +
>> + for (i = 0; i < PERF_COUNT_HW_MAX; i++) {
>> + config = perf_get_hw_event_config(i) & 0xFFFFULL;
>> +
>> + kernel_hw_events[i] = (struct kvm_event_hw_type_mapping){
>> + .eventsel = config & ARCH_PERFMON_EVENTSEL_EVENT,
>> + .unit_mask = (config & ARCH_PERFMON_EVENTSEL_UMASK) >> 8,
>> + .event_type = i,
>> + };
>
> Should event_type be PERF_COUNT_HW_MAX if config is zero?
Emm, we do not assume that the hardware event encoded with "eventsel=0 &&
unit_mask=0"
(in this case, config is zero) are illegal.
If perf core puts this encoded event into "enum perf_hw_id" table as this part
is out of the scope of
KVM, we have to setup with a valid event_type value instead of PERF_COUNT_HW_MAX.
In this proposal, the returned perf_hw_id from kvm_x86_ops.pmu_ops->pmc_perf_hw_id()
is only valid and used if "pmc->eventsel & 0xFFFFULL" is non-zero, otherwise the
reprogram_gp_counter() will fall back to use PERF_TYPE_RAW type.
Please let me know if you need more clarification on this change.
>
> Thanks,
>
> Paolo
>
Powered by blists - more mailing lists