lkml.org 
[lkml]   [2022]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] x86: events: Do not return bogus capabilities if PMU is broken
From
On 6/1/22 13:07, Peter Zijlstra wrote:
> On Wed, Jun 01, 2022 at 05:42:56AM -0400, Paolo Bonzini wrote:
>> From: Like Xu <likexu@tencent.com>
>>
>> If the PMU is broken due to firmware issues, check_hw_exists() will return
>> false but perf_get_x86_pmu_capability() will still return data from x86_pmu.
>> Likewise if some of the hotplug callbacks cannot be installed the contents
>> of x86_pmu will not be reverted.
>>
>> Handle the failure in both cases by clearing x86_pmu if init_hw_perf_events()
>> or reverts to software events only.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> No SoB from Like,

And hardly any code from him either except for a single memset, :) but
I'll add

Signed-off-by: Like Xu <likexu@tencent.com>
Co-developed-by: Like Xu <likexu@tencent.com>

(I have hooks that notice this when pushing, but they don't help with
git-send-email...).


>> @@ -2982,6 +2985,11 @@ unsigned long perf_misc_flags(struct pt_regs *regs)
>>
>> void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap)
>> {
>> + if (!x86_pmu.name) {
>
> We have x86_pmu_initialized(), the implementation is a bit daft, but
> might as well use it here too, no?

Yes, thanks.

Paolo

\
 
 \ /
  Last update: 2022-06-01 13:25    [W:0.067 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site