From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Wentao Liang <vulab@iscas.ac.cn>,
peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
namhyung@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
irogers@google.com, adrian.hunter@intel.com, tglx@linutronix.de,
bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
hpa@zytor.com
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] perf/x86/intel/uncore: Add error handling for uncore_msr_box_ctl()
Date: Tue, 1 Apr 2025 11:43:39 -0400 [thread overview]
Message-ID: <dbf181f0-076f-43e8-aa09-88a8a13ae307@linux.intel.com> (raw)
In-Reply-To: <20250401141741.2705-1-vulab@iscas.ac.cn>
On 2025-04-01 10:17 a.m., Wentao Liang wrote:
> In mtl_uncore_msr_init_box(), the return value of uncore_msr_box_ctl()
> needs to be checked before being used as the parameter of wrmsrl().
> A proper implementation can be found in ivbep_uncore_msr_init_box().
>
> Add error handling for uncore_msr_box_ctl() to ensure the MSR write
> operation is only performed when a valid MSR address is returned.
>
> Fixes: c828441f21dd ("perf/x86/intel/uncore: Add Meteor Lake support")
> Cc: stable@vger.kernel.org # v6.3+
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Thanks,
Kan> ---
> arch/x86/events/intel/uncore_snb.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c
> index 3934e1e4e3b1..84070388f495 100644
> --- a/arch/x86/events/intel/uncore_snb.c
> +++ b/arch/x86/events/intel/uncore_snb.c
> @@ -691,7 +691,10 @@ static struct intel_uncore_type mtl_uncore_hac_cbox = {
>
> static void mtl_uncore_msr_init_box(struct intel_uncore_box *box)
> {
> - wrmsrl(uncore_msr_box_ctl(box), SNB_UNC_GLOBAL_CTL_EN);
> + unsigned int msr = uncore_msr_box_ctl(box);
> +
> + if (msr)
> + wrmsrl(msr, SNB_UNC_GLOBAL_CTL_EN);
> }
>
> static struct intel_uncore_ops mtl_uncore_msr_ops = {
next prev parent reply other threads:[~2025-04-01 15:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 14:17 [PATCH] perf/x86/intel/uncore: Add error handling for uncore_msr_box_ctl() Wentao Liang
2025-04-01 15:43 ` Liang, Kan [this message]
2025-04-01 18:24 ` Ingo Molnar
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=dbf181f0-076f-43e8-aa09-88a8a13ae307@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--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=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=vulab@iscas.ac.cn \
--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