From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: maddy@linux.ibm.com, linuxppc-dev@lists.ozlabs.org,
yury.norov@gmail.com, linux@rasmusvillemoes.dk,
linux-kernel@vger.kernel.org
Cc: sshegde@linux.ibm.com, chleroy@kernel.org
Subject: [PATCH v2 3/4] powerpc/perf: Use cpumask_intersects api for checking disable path
Date: Mon, 27 Apr 2026 10:17:14 +0530 [thread overview]
Message-ID: <20260427044715.559137-4-sshegde@linux.ibm.com> (raw)
In-Reply-To: <20260427044715.559137-1-sshegde@linux.ibm.com>
First online CPU in the node disables the nest counters by
making an OPAL call. Any other CPU in that node, will bail out.
Instead of using a temporary mask to find out if any cpu in the
node is visited or not, it is better to use the cpumask_intersects
api to achieve the same.
Similarly a temporary cpumask is used to check if a core is already part
of core_imc_cpumask. Use the same cpumask_intersects api there.
Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
---
arch/powerpc/perf/imc-pmu.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index c1563b4eaa94..e3822f36c419 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -421,7 +421,6 @@ static int ppc_nest_imc_cpu_offline(unsigned int cpu)
static int ppc_nest_imc_cpu_online(unsigned int cpu)
{
const struct cpumask *l_cpumask;
- static struct cpumask tmp_mask;
int res;
/* Get the cpumask of this node */
@@ -431,7 +430,7 @@ static int ppc_nest_imc_cpu_online(unsigned int cpu)
* If this is not the first online CPU on this node, then
* just return.
*/
- if (cpumask_and(&tmp_mask, l_cpumask, &nest_imc_cpumask))
+ if (cpumask_intersects(l_cpumask, &nest_imc_cpumask))
return 0;
/*
@@ -647,14 +646,13 @@ static bool is_core_imc_mem_inited(int cpu)
static int ppc_core_imc_cpu_online(unsigned int cpu)
{
const struct cpumask *l_cpumask;
- static struct cpumask tmp_mask;
int ret = 0;
/* Get the cpumask for this core */
l_cpumask = cpu_sibling_mask(cpu);
/* If a cpu for this core is already set, then, don't do anything */
- if (cpumask_and(&tmp_mask, l_cpumask, &core_imc_cpumask))
+ if (cpumask_intersects(l_cpumask, &core_imc_cpumask))
return 0;
if (!is_core_imc_mem_inited(cpu)) {
--
2.47.3
next prev parent reply other threads:[~2026-04-27 4:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 4:47 [PATCH v2 0/4] powerpc: A few misc cpumask changes Shrikanth Hegde
2026-04-27 4:47 ` [PATCH v2 1/4] powerpc: Use cpumask_next_wrap instead Shrikanth Hegde
2026-04-27 4:47 ` [PATCH v2 2/4] powerpc: Simplify cpumask api usage for cpuinfo display Shrikanth Hegde
2026-04-27 4:47 ` Shrikanth Hegde [this message]
2026-04-27 4:47 ` [PATCH v2 4/4] powerpc/xive: Add warning if target CPU not found Shrikanth Hegde
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=20260427044715.559137-4-sshegde@linux.ibm.com \
--to=sshegde@linux.ibm.com \
--cc=chleroy@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=yury.norov@gmail.com \
/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