From: Nathan Fontenot <nfont@austin.ibm.com>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH] Update smt_enabled=X handling for cores with more than two threads
Date: Wed, 12 May 2010 09:50:41 -0500 [thread overview]
Message-ID: <4BEAC041.4000404@austin.ibm.com> (raw)
This patch updates the handling of the smt-enabled=X boot option to handle
settings on systems with more than two threads per core. This change involves
moving all of the handling of the boot option to the check_smt_enabled()
routine and the calling of this routine in setup_system() until after the
smp_setup_cpu_maps() call. This is done so that we can use the
threads_per_core variable when validating the smt boot option specified.
Signed-off-by: Nathan Fontenot<nfont@austin.ibm.com>
---
arch/powerpc/kernel/setup_64.c | 61 ++++++++++++++++++++---------------
arch/powerpc/platforms/pseries/smp.c | 11 ++++--
2 files changed, 42 insertions(+), 30 deletions(-)
Index: powerpc/arch/powerpc/kernel/setup_64.c
===================================================================
--- powerpc.orig/arch/powerpc/kernel/setup_64.c 2010-05-12 08:33:38.000000000 -0500
+++ powerpc/arch/powerpc/kernel/setup_64.c 2010-05-12 08:48:10.000000000 -0500
@@ -95,7 +95,7 @@
#ifdef CONFIG_SMP
-static int smt_enabled_cmdline;
+static char *smt_enabled_cmdline;
/* Look for ibm,smt-enabled OF option */
static void check_smt_enabled(void)
@@ -103,37 +103,46 @@
struct device_node *dn;
const char *smt_option;
- /* Allow the command line to overrule the OF option */
- if (smt_enabled_cmdline)
- return;
-
- dn = of_find_node_by_path("/options");
+ /* Default to enabling all threads */
+ smt_enabled_at_boot = threads_per_core;
- if (dn) {
- smt_option = of_get_property(dn, "ibm,smt-enabled", NULL);
+ /* Allow the command line to overrule the OF option */
+ if (smt_enabled_cmdline) {
+ if (!strcmp(smt_enabled_cmdline, "on"))
+ smt_enabled_at_boot = threads_per_core;
+ else if (!strcmp(smt_enabled_cmdline, "off"))
+ smt_enabled_at_boot = 0;
+ else {
+ long smt;
+ int rc;
+
+ rc = strict_strtol(smt_enabled_cmdline, 10,&smt);
+ if (!rc)
+ smt_enabled_at_boot =
+ min(threads_per_core, (int)smt);
+ }
+ } else {
+ dn = of_find_node_by_path("/options");
+ if (dn) {
+ smt_option = of_get_property(dn, "ibm,smt-enabled",
+ NULL);
+
+ if (smt_option) {
+ if (!strcmp(smt_option, "on"))
+ smt_enabled_at_boot = threads_per_core;
+ else if (!strcmp(smt_option, "off"))
+ smt_enabled_at_boot = 0;
+ }
- if (smt_option) {
- if (!strcmp(smt_option, "on"))
- smt_enabled_at_boot = 1;
- else if (!strcmp(smt_option, "off"))
- smt_enabled_at_boot = 0;
- }
- }
+ of_node_put(dn);
+ }
+ }
}
/* Look for smt-enabled= cmdline option */
static int __init early_smt_enabled(char *p)
{
- smt_enabled_cmdline = 1;
-
- if (!p)
- return 0;
-
- if (!strcmp(p, "on") || !strcmp(p, "1"))
- smt_enabled_at_boot = 1;
- else if (!strcmp(p, "off") || !strcmp(p, "0"))
- smt_enabled_at_boot = 0;
-
+ smt_enabled_cmdline = p;
return 0;
}
early_param("smt-enabled", early_smt_enabled);
@@ -390,8 +399,8 @@
*/
xmon_setup();
- check_smt_enabled();
smp_setup_cpu_maps();
+ check_smt_enabled();
#ifdef CONFIG_SMP
/* Release secondary cpus out of their spinloops at 0x60 now that
Index: powerpc/arch/powerpc/platforms/pseries/smp.c
===================================================================
--- powerpc.orig/arch/powerpc/platforms/pseries/smp.c 2010-05-12 08:33:38.000000000 -0500
+++ powerpc/arch/powerpc/platforms/pseries/smp.c 2010-05-12 08:36:09.000000000 -0500
@@ -154,10 +154,13 @@
/* Special case - we inhibit secondary thread startup
* during boot if the user requests it.
*/
- if (system_state< SYSTEM_RUNNING&&
- cpu_has_feature(CPU_FTR_SMT)&&
- !smt_enabled_at_boot&& cpu_thread_in_core(nr) != 0)
- return 0;
+ if (system_state< SYSTEM_RUNNING&& cpu_has_feature(CPU_FTR_SMT)) {
+ if (!smt_enabled_at_boot&& cpu_thread_in_core(nr) != 0)
+ return 0;
+ if (smt_enabled_at_boot
+ && cpu_thread_in_core(nr)>= smt_enabled_at_boot)
+ return 0;
+ }
return 1;
}
reply other threads:[~2010-05-12 14:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4BEAC041.4000404@austin.ibm.com \
--to=nfont@austin.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.