mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: maddy@linux.ibm.com, linuxppc-dev@lists.ozlabs.org,
	peterz@infradead.org, tim.c.chen@linux.intel.com
Cc: sshegde@linux.ibm.com, christophe.leroy@csgroup.eu,
	linux-kernel@vger.kernel.org, ritesh.list@gmail.com,
	kprateek.nayak@amd.com, yu.c.chen@intel.com,
	vineethr@linux.ibm.com, vincent.guittot@linaro.org,
	srikar@linux.ibm.com, npiggin@gmail.com, mpe@ellerman.id.au
Subject: [PATCH 4/4] powerpc/topology: Rebuild sched domains on llc_override change
Date: Mon, 12 Oct 2026 15:50:37 +0530	[thread overview]
Message-ID: <20261012102037.2477378-5-sshegde@linux.ibm.com> (raw)
In-Reply-To: <20261012102037.2477378-1-sshegde@linux.ibm.com>

On changing the llc_override, rebuild the sched domains.

For the rebuild to happen, indicate it to the scheduler that
complete rebuild of the sched domains need to happen
via arch_update_cpu_topology(). 

With this, llc_override functionality is complete.

For example, on CPU10, 
domain0/name:SMT
domain1/name:MC
domain2/name:PKG

echo 0 > /sys/kernel/debug/powerpc/llc_override
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_CPUCAPACITY SD_SHARE_LLC SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_PREFER_SIBLING

echo mc > /sys/kernel/debug/powerpc/llc_override
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_CPUCAPACITY SD_SHARE_LLC SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_LLC SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_PREFER_SIBLING

Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
---
 arch/powerpc/kernel/smp.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 4b6512d25f73..6a4ee7d3b8e5 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -37,6 +37,7 @@
 #include <linux/clockchips.h>
 #include <linux/kexec.h>
 #include <linux/debugfs.h>
+#include <linux/cpuset.h>
 
 #include <asm/ptrace.h>
 #include <linux/atomic.h>
@@ -1863,6 +1864,16 @@ void __noreturn arch_cpu_idle_dead(void)
 
 #endif
 
+int arch_update_cpu_topology(void)
+{
+	if (READ_ONCE(llc_override_changed)) {
+		WRITE_ONCE(llc_override_changed, 0);
+		return 1;
+	}
+
+	return 0;
+}
+
 static ssize_t llc_override_get(struct file *file, char __user *ubuf,
 				size_t count, loff_t *ppos)
 {
@@ -1909,10 +1920,10 @@ static ssize_t llc_override_set(struct file *file, const char __user *ubuf,
 	if (override != READ_ONCE(llc_override)) {
 		WRITE_ONCE(llc_override, override);
 		WRITE_ONCE(llc_override_changed, 1);
-		pr_info("sched LLC override set to %s\n",
+		pr_info("sched LLC override set to %s. Rebuilding sched domains\n",
 			llc_override_str[override]);
 
-		/* Will be calling rebuild sched domain in later patches */
+		rebuild_sched_domains();
 	}
 
 	mutex_unlock(&llc_override_mutex);
-- 
2.52.0


  parent reply	other threads:[~2026-10-12 10:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 10:20 [PATCH 0/4] powerpc/topology: Introduce llc_override debugfs Shrikanth Hegde
2026-10-12 10:20 ` [PATCH 1/4] powerpc/topology: Introduce llc_override debug knob Shrikanth Hegde
2026-10-12 12:14   ` Srikar Dronamraju
2026-10-12 14:10     ` Shrikanth Hegde
2026-10-12 10:20 ` [PATCH 2/4] powerpc/topology: Add docs for llc_override Shrikanth Hegde
2026-10-12 10:20 ` [PATCH 3/4] powerpc/topology: Update mc/pkg flags based on llc_override Shrikanth Hegde
2026-10-12 10:20 ` Shrikanth Hegde [this message]
2026-10-12 12:19 ` [PATCH 0/4] powerpc/topology: Introduce llc_override debugfs Srikar Dronamraju
2026-10-12 14:14   ` 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=20261012102037.2477378-5-sshegde@linux.ibm.com \
    --to=sshegde@linux.ibm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=peterz@infradead.org \
    --cc=ritesh.list@gmail.com \
    --cc=srikar@linux.ibm.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vineethr@linux.ibm.com \
    --cc=yu.c.chen@intel.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

all inboxes | Powered by JetHome®