lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 16 Apr 2013 07:44:12 -0500
From:	Robin Holt <holt@....com>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	Robin Holt <holt@....com>, Ingo Molnar <mingo@...hat.com>,
	Russ Anderson <rja@....com>, Shawn Guo <shawn.guo@...aro.org>,
	Oleg Nesterov <oleg@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Joe Perches <joe@...ches.com>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Michel Lespinasse <walken@...gle.com>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <peterz@...radead.org>,
	"rusty@...tcorp.com.au" <rusty@...tcorp.com.au>,
	Tejun Heo <tj@...nel.org>,
	the arch/x86 maintainers <x86@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [Patch -v4 4/4] Make reboot_cpuid a kernel parameter. other
 cpus.

On Tue, Apr 16, 2013 at 05:05:45AM -0700, H. Peter Anvin wrote:
> Why not just support the existing syntax everywhere?

I have not given it much consideration, but IIRC, the other arches that
were using reboot= were only looking for an 'h' or something like that.

I will consider making the syntax parse reboot=s#### when I get to
the office.

Robin
> 
> Robin Holt <holt@....com> wrote:
> 
> >Moving the reboot=s<##> parameter for x86 to a kernel parameter
> >proper.  I did not find any other arch that was specifying the
> >reboot cpu.
> >
> >I left a compatibility mode in there.  The new parameter always
> >takes precedence.  I also fixed up the current code to support
> >up to cpuid's up to the current max of 4096.
> >
> >Signed-off-by: Robin Holt <holt@....com>
> >To: Ingo Molnar <mingo@...hat.com>
> >To: Russ Anderson <rja@....com>
> >Cc: Shawn Guo <shawn.guo@...aro.org>
> >Cc: Oleg Nesterov <oleg@...hat.com>
> >Cc: Andrew Morton <akpm@...ux-foundation.org>
> >Cc: "H. Peter Anvin" <hpa@...or.com>
> >Cc: Lai Jiangshan <laijs@...fujitsu.com>
> >Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> >Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
> >Cc: Michel Lespinasse <walken@...gle.com>
> >Cc: Oleg Nesterov <oleg@...hat.com>
> >Cc: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
> >Cc: Paul Mackerras <paulus@...ba.org>
> >Cc: Peter Zijlstra <peterz@...radead.org>
> >Cc: Robin Holt <holt@....com>
> >Cc: "rusty@...tcorp.com.au" <rusty@...tcorp.com.au>
> >Cc: Tejun Heo <tj@...nel.org>
> >Cc: the arch/x86 maintainers <x86@...nel.org>
> >Cc: Thomas Gleixner <tglx@...utronix.de>
> >
> >---
> >
> >Changes since -v3
> >- Added a reboot=s#### compatibility mode for x86.
> >
> > Documentation/kernel-parameters.txt |  2 ++
> >arch/x86/kernel/reboot.c            | 39
> >+++++++++++++------------------------
> > kernel/reboot.c                     |  8 +++++++-
> > 3 files changed, 22 insertions(+), 27 deletions(-)
> >
> >diff --git a/Documentation/kernel-parameters.txt
> >b/Documentation/kernel-parameters.txt
> >index 4609e81..11ebb48 100644
> >--- a/Documentation/kernel-parameters.txt
> >+++ b/Documentation/kernel-parameters.txt
> >@@ -2597,6 +2597,8 @@ bytes respectively. Such letter suffixes can also
> >be entirely omitted.
> > 			Format: <reboot_mode>[,<reboot_mode2>[,...]]
> > 			See arch/*/kernel/reboot.c or arch/*/kernel/process.c
> > 
> >+	reboot_cpuid=	[KNL] cpuid to use for reboot/halt, etc operations.
> >+
> > 	relax_domain_level=
> > 			[KNL, SMP] Set scheduler's default relax_domain_level.
> > 			See Documentation/cgroups/cpusets.txt.
> >diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
> >index 76fa1e9..cdcf28f 100644
> >--- a/arch/x86/kernel/reboot.c
> >+++ b/arch/x86/kernel/reboot.c
> >@@ -49,10 +49,6 @@ int reboot_force;
> >  */
> > static int reboot_default = 1;
> > 
> >-#ifdef CONFIG_SMP
> >-static int reboot_cpu = -1;
> >-#endif
> >-
> > /*
> >  * This is set if we need to go through the 'emergency' path.
> >  * When machine_emergency_restart() is called, we may be on
> >@@ -63,6 +59,8 @@ static int reboot_emergency;
> >/* This is set by the PCI code if either type 1 or type 2 PCI is
> >detected */
> > bool port_cf9_safe = false;
> > 
> >+extern int reboot_cpuid;
> >+
> > /*
> >* reboot=b[ios] | s[mp] | t[riple] | k[bd] | e[fi] [, [w]arm | [c]old]
> >| p[ci]
> >  * warm   Don't set the cold reboot flag
> >@@ -97,10 +95,14 @@ static int __init reboot_setup(char *str)
> > 
> > #ifdef CONFIG_SMP
> > 		case 's':
> >-			if (isdigit(*(str+1))) {
> >-				reboot_cpu = (int) (*(str+1) - '0');
> >-				if (isdigit(*(str+2)))
> >-					reboot_cpu = reboot_cpu*10 + (int)(*(str+2) - '0');
> >+			if (reboot_cpuid < 0) {
> >+				int coffset;
> >+
> >+				reboot_cpuid = 0;
> >+				for (coffset = 1; isdigit(*(str + coffset)); coffset++) {
> >+					reboot_cpuid *= 10;
> >+					reboot_cpuid += (int)(*(str+2) - '0');
> >+				}
> > 			}
> > 			/*
> > 			 * We will leave sorting out the final value
> >@@ -615,25 +617,10 @@ void native_machine_shutdown(void)
> > 	/* Stop the cpus and apics */
> > #ifdef CONFIG_SMP
> > 
> >-	/* The boot cpu is always logical cpu 0 */
> >-	int reboot_cpu_id = 0;
> >-
> >-	/* See if there has been given a command line override */
> >-	if ((reboot_cpu != -1) && (reboot_cpu < nr_cpu_ids) &&
> >-		cpu_online(reboot_cpu))
> >-		reboot_cpu_id = reboot_cpu;
> >-
> >-	/* Make certain the cpu I'm about to reboot on is online */
> >-	if (!cpu_online(reboot_cpu_id))
> >-		reboot_cpu_id = smp_processor_id();
> >-
> >-	/* Make certain I only run on the appropriate processor */
> >-	set_cpus_allowed_ptr(current, cpumask_of(reboot_cpu_id));
> >-
> > 	/*
> >-	 * O.K Now that I'm on the appropriate processor, stop all of the
> >-	 * others. Also disable the local irq to not receive the per-cpu
> >-	 * timer interrupt which may trigger scheduler's load balance.
> >+	 * Stop all of the others. Also disable the local irq to
> >+	 * not receive the per-cpu timer interrupt which may trigger
> >+	 * scheduler's load balance.
> > 	 */
> > 	local_irq_disable();
> > 	stop_other_cpus();
> >diff --git a/kernel/reboot.c b/kernel/reboot.c
> >index 8cfef20..b2ef798 100644
> >--- a/kernel/reboot.c
> >+++ b/kernel/reboot.c
> >@@ -10,6 +10,7 @@
> > #include <linux/kexec.h>
> > #include <linux/kmod.h>
> > #include <linux/kmsg_dump.h>
> >+#include <linux/moduleparam.h>
> > #include <linux/reboot.h>
> > #include <linux/suspend.h>
> > #include <linux/syscalls.h>
> >@@ -69,13 +70,18 @@ int unregister_reboot_notifier(struct
> >notifier_block *nb)
> > }
> > EXPORT_SYMBOL(unregister_reboot_notifier);
> > 
> >+int reboot_cpuid = -1;
> >+core_param(reboot_cpuid, reboot_cpuid, int, 0644);
> >+
> > void migrate_to_reboot_cpu(void)
> > {
> > 	/* The boot cpu is always logical cpu 0 */
> >-	int reboot_cpu_id = 0;
> >+	int reboot_cpu_id = reboot_cpuid;
> > 
> > 	/* Make certain the cpu I'm about to reboot on is online */
> > 	if (!cpu_online(reboot_cpu_id))
> >+		reboot_cpu_id = 0;
> >+	if (!cpu_online(reboot_cpu_id))
> > 		reboot_cpu_id = smp_processor_id();
> > 
> > 	/* Prevent races with other tasks migrating this task. */
> 
> -- 
> Sent from my mobile phone. Please excuse brevity and lack of formatting.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists