]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
powerpc/perf: Use cpumask_intersects api for checking disable path
authorShrikanth Hegde <sshegde@linux.ibm.com>
Mon, 27 Apr 2026 04:47:14 +0000 (10:17 +0530)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Tue, 2 Jun 2026 05:54:32 +0000 (11:24 +0530)
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>
Reviewed-by: Yury Norov <ynorov@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260427044715.559137-4-sshegde@linux.ibm.com
arch/powerpc/perf/imc-pmu.c

index c1563b4eaa946be4a9a4bbbb4f11f1658fffe4cf..e3822f36c4199dd71af33542236d821a59b8a204 100644 (file)
@@ -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)) {