Re: [PATCH v7 3/8] powerpc/smp: Export cpu_coregroup_mask()

From: Christophe Leroy
Date: Tue Aug 26 2025 - 01:20:51 EST




Le 26/08/2025 à 06:13, K Prateek Nayak a écrit :
Deine cpu_coregroup_mask() to export the per-cpu cpu_corgrp_map when
coregroups are supported(). When has_coregroup_support() returns false,
cpu_coregroup_mask() returns the mask used by the PKG domain.

Since this will only be used after CONFIG_SCHED_MC is added for PowerPC,
no functional changes are intended at this point.

Signed-off-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
---
arch/powerpc/include/asm/smp.h | 2 ++
arch/powerpc/kernel/smp.c | 8 ++++++++
2 files changed, 10 insertions(+)

diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index b77927ccb0ab..86de4d0dd0aa 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -148,6 +148,8 @@ static inline const struct cpumask *cpu_smt_mask(int cpu)
}
#endif /* CONFIG_SCHED_SMT */
+extern const struct cpumask *cpu_coregroup_mask(int cpu);

'extern' keyword is pointless for function prototypes, remove it.

See report from checkpatch:

$ ./scripts/checkpatch.pl --strict -g a064a30c52a5
CHECK: extern prototypes should be avoided in .h files
#28: FILE: arch/powerpc/include/asm/smp.h:151:
+extern const struct cpumask *cpu_coregroup_mask(int cpu);

total: 0 errors, 0 warnings, 1 checks, 22 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

Commit a064a30c52a5 ("powerpc/smp: Export cpu_coregroup_mask()") has style problems, please review.

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.



+
/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
*
* Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 4f48262658cc..e623f2864dc4 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1059,6 +1059,14 @@ static bool has_coregroup_support(void)
return coregroup_enabled;
}
+const struct cpumask *cpu_coregroup_mask(int cpu)
+{
+ if (has_coregroup_support())
+ return per_cpu(cpu_corgrp_map, cpu);
+
+ return cpu_node_mask(cpu);
+}
+
static const struct cpumask *cpu_mc_mask(struct sched_domain_topology_level *tl, int cpu)
{
return cpu_corgrp_mask(cpu);