From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
x86@kernel.org, Like Xu <likexu@tencent.com>
Subject: Re: [PATCH] x86: events: Do not return bogus capabilities if PMU is broken
Date: Wed, 1 Jun 2022 13:24:37 +0200 [thread overview]
Message-ID: <bb40cfa3-0125-c733-e4fd-da861c068f2c@redhat.com> (raw)
In-Reply-To: <YpdIgm8c5YEFLCCH@worktop.programming.kicks-ass.net>
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
prev parent reply other threads:[~2022-06-01 11:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-01 9:42 [PATCH] x86: events: Do not return bogus capabilities if PMU is broken Paolo Bonzini
2022-06-01 11:07 ` Peter Zijlstra
2022-06-01 11:24 ` Paolo Bonzini [this message]
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=bb40cfa3-0125-c733-e4fd-da861c068f2c@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=likexu@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/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