From: Sean Christopherson <seanjc@google.com>
To: Cody Yao-oc <CodyYao-oc@zhaoxin.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@redhat.com, namhyung@kernel.org, tglx@linutronix.de,
bp@alien8.de, hpa@zytor.com, x86@kernel.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/perf: Fixed obtaining address error about performance monitor MSR on old Inel CPU.
Date: Fri, 4 Jun 2021 16:48:00 +0000 [thread overview]
Message-ID: <YLpZQCyZWjnD/1ZP@google.com> (raw)
In-Reply-To: <20210604055438.17705-1-CodyYao-oc@zhaoxin.com>
On Fri, Jun 04, 2021, Cody Yao-oc wrote:
> From: CodyYao-oc <CodyYao-oc@zhaoxin.com>
>
> Fix "obtain wrong msr address" bug in function nmi_perfctr_msr_to_bit
> and nmi_eventsel_msr_to_bit. In X86_VENDOR_INTEL switch branch, if all
> of the check conditions are not met, code flow will slip to
> X86_VENDOR_ZHAOXIN branch which may lead to incorrect information.
>
> Therefore, "fallthrough" should be changed to "break" to avoid it.
This should explicitly state that using fallthrough instead of break was
completely unintentional, assuming that's indeed the case.
Fixes: 3a4ac121c2ca ("x86/perf: Add hardware performance events support for Zhaoxin CPU.")
> Signed-off-by: CodyYao-oc <CodyYao-oc@zhaoxin.com>
> ---
> arch/x86/kernel/cpu/perfctr-watchdog.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
> index 3ef5868ac588..7aecb2fc3186 100644
> --- a/arch/x86/kernel/cpu/perfctr-watchdog.c
> +++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
> @@ -63,7 +63,7 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr)
> case 15:
> return msr - MSR_P4_BPU_PERFCTR0;
> }
> - fallthrough;
> + break;
> case X86_VENDOR_ZHAOXIN:
> case X86_VENDOR_CENTAUR:
> return msr - MSR_ARCH_PERFMON_PERFCTR0;
> @@ -96,7 +96,7 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
> case 15:
> return msr - MSR_P4_BSU_ESCR0;
> }
> - fallthrough;
> + break;
> case X86_VENDOR_ZHAOXIN:
> case X86_VENDOR_CENTAUR:
> return msr - MSR_ARCH_PERFMON_EVENTSEL0;
> --
> 2.17.1
>
next prev parent reply other threads:[~2021-06-04 16:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 5:54 [PATCH] x86/perf: Fixed obtaining address error about performance monitor MSR on old Inel CPU Cody Yao-oc
2021-06-04 16:48 ` Sean Christopherson [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-06-07 2:53 Cody Yao-oc
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=YLpZQCyZWjnD/1ZP@google.com \
--to=seanjc@google.com \
--cc=CodyYao-oc@zhaoxin.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--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