[PATCH v2 2/4] powerpc/topology: Update mc/pkg flags based on llc_override
From: Shrikanth Hegde
Date: Fri Oct 23 2026 - 09:17:54 EST
Update the flags passed for building the scheduler topology based on
llc_override.
SD_SHARE_LLC is used to determine the highest domain where the LLC is.
Also when set at a particular domain, all the child domains are expected
to have it set as well.
Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
---
arch/powerpc/kernel/smp.c | 41 +++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 6b1201ea3572..ca1821dedc98 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1007,6 +1007,12 @@ static int powerpc_smt_flags(void)
*/
static __ro_after_init DEFINE_STATIC_KEY_FALSE(splpar_asym_pack);
+static int llc_override;
+enum llc_override_values {
+ LLC_OVERRIDE_MC = 1,
+ LLC_OVERRIDE_PKG = 2,
+};
+
/*
* P9 has a slightly odd architecture where pairs of cores share an L2 cache.
* This topology makes it *much* cheaper to migrate tasks between adjacent cores
@@ -1021,12 +1027,30 @@ static int powerpc_shared_cache_flags(void)
return SD_SHARE_LLC;
}
-static int powerpc_shared_proc_flags(void)
+static int powerpc_mc_flags(void)
{
+ int flags = 0;
+
if (static_branch_unlikely(&splpar_asym_pack))
- return SD_ASYM_PACKING;
+ flags |= SD_ASYM_PACKING;
- return 0;
+ if (READ_ONCE(llc_override) >= LLC_OVERRIDE_MC)
+ flags |= SD_SHARE_LLC;
+
+ return flags;
+}
+
+static int powerpc_pkg_flags(void)
+{
+ int flags = 0;
+
+ if (static_branch_unlikely(&splpar_asym_pack))
+ flags |= SD_ASYM_PACKING;
+
+ if (READ_ONCE(llc_override) >= LLC_OVERRIDE_PKG)
+ flags |= SD_SHARE_LLC;
+
+ return flags;
}
/*
@@ -1059,13 +1083,6 @@ static bool has_coregroup_support(void)
return coregroup_enabled;
}
-enum llc_override_values {
- LLC_OVERRIDE_MC = 1,
- LLC_OVERRIDE_PKG = 2,
-};
-
-static int llc_override;
-
static int __init set_llc_override(char *str)
{
if (!strcasecmp(str, "mc") && has_coregroup_support())
@@ -1759,10 +1776,10 @@ static void __init build_sched_topology(void)
if (has_coregroup_support()) {
powerpc_topology[i++] =
- SDTL_INIT(tl_mc_mask, powerpc_shared_proc_flags, MC);
+ SDTL_INIT(tl_mc_mask, powerpc_mc_flags, MC);
}
- powerpc_topology[i++] = SDTL_INIT(tl_pkg_mask, powerpc_shared_proc_flags, PKG);
+ powerpc_topology[i++] = SDTL_INIT(tl_pkg_mask, powerpc_pkg_flags, PKG);
/* There must be one trailing NULL entry left. */
BUG_ON(i >= ARRAY_SIZE(powerpc_topology) - 1);
--
2.52.0