linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mingo@kernel.org (Ingo Molnar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
Date: Wed, 8 May 2013 12:39:56 +0200	[thread overview]
Message-ID: <20130508103956.GA7677@gmail.com> (raw)
In-Reply-To: <1367937595-32241-12-git-send-email-holt@sgi.com>


* Robin Holt <holt@sgi.com> wrote:

> Merge together the unicore32, arm, and x86 reboot= command line
> parameter handling.

The series still has this CONFIG_X86 dependency that I inquired about 
previously:

> +static int __init reboot_setup(char *str)
> +{
> +	for (;;) {
> +		/*
> +		 * Having anything passed on the command line via
> +		 * reboot= will cause us to disable DMI checking
> +		 * below.
> +		 */
> +		reboot_default = 0;
> +
> +		switch (*str) {
> +#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
> +		case 'w':
> +			reboot_mode = REBOOT_WARM;
> +			break;
> +
> +		case 'c':
> +			reboot_mode = REBOOT_COLD;
> +			break;
> +
> +#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');
> +			}
> +			/*
> +			 * We will leave sorting out the final value
> +			 * when we are ready to reboot, since we might not
> +			 * have detected BSP APIC ID or smp_num_cpu
> +			 */
> +			break;
> +#endif /* CONFIG_SMP */
> +
> +#else
> +		case 's':
> +			reboot_mode = REBOOT_WARM;
> +		case 'h':
> +			reboot_mode = REBOOT_COLD;
> +		case 'g':
> +			reboot_mode = REBOOT_GPIO;
> +#endif
> +
> +		case 'b':
> +		case 'a':
> +		case 'k':
> +		case 't':
> +		case 'e':
> +		case 'p':
> +			reboot_type = *str;
> +			break;
> +
> +		case 'f':
> +			reboot_force = 1;
> +			break;
> +		}
> +
> +		str = strchr(str, ',');
> +		if (str)
> +			str++;
> +		else
> +			break;
> +	}
> +	return 1;

To explain my concern more verbosely, if we cannot make it 'obviously 
generic' then there's no point in moving it to kernel/reboot.c ...

And yes, I realize that there's an option clash between architectures - 
see below for potential solutions to that.

To generalize it, firstly here's a summary of the existing reboot option 
mappings:

 x86-only:  w, c, s
 non-x86:         s, h, g
 generic:                  b, a, k, t, e, p, f


it appears that 'w', 'c', 'h', and 'g' could be made generic straight 
away.

Which leaves 's' as the only truly problematic option:

 - it means REBOOT_WARM on some non-x86 platform(s?)
 - while it means the SMP-cpu on x86.

Stupid question: which non-x86 platform(s) use 's'?

I think we should either change that platform to have 'w' as the warm 
reboot (and hope that no-one actually relies on the old 's' option: it's a 
truly rare option) - or change the x86 mapping from 's' to 'S' and 
generalize and unify it thusly.

Another cleanliness problem is the duality of reboot_mode and reboot_type. 
We should pick one and use it everywhere consistently.

[ Once these problems are solved and there's no objections from others to 
  this approach, I'd be willing to apply, test and push this series to 
  Linus. ]

Thanks,

	Ingo

  reply	other threads:[~2013-05-08 10:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-07 14:39 [PATCH -v8 00/11] Shutdown from reboot_cpuid without stopping other cpus Robin Holt
2013-05-07 14:39 ` [PATCH -v8 01/11] CPU hotplug: Provide a generic helper to disable/enable CPU hotplug Robin Holt
2013-05-09 22:01   ` Andrew Morton
2013-05-10 11:11     ` Rafael J. Wysocki
2013-05-10 17:03       ` Andrew Morton
2013-05-11  4:16         ` Robin Holt
2013-05-11  9:13           ` Srivatsa S. Bhat
2013-05-11  9:49             ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 02/11] Migrate shutdown/reboot to boot cpu Robin Holt
2013-05-07 14:39 ` [PATCH -v8 03/11] Remove -stable friendly PF_THREAD_BOUND define Robin Holt
2013-05-07 14:39 ` [PATCH -v8 04/11] Move shutdown/reboot related functions to kernel/reboot.c Robin Holt
2013-05-07 14:39 ` [PATCH -v8 05/11] checkpatch.pl the new kernel/reboot.c file Robin Holt
2013-05-07 14:39 ` [PATCH -v8 06/11] x86, prepare reboot_mode for moving to generic kernel code Robin Holt
2013-05-07 14:39 ` [PATCH -v8 07/11] unicore32, " Robin Holt
2013-05-07 14:39 ` [PATCH -v8 08/11] arm, Remove unused restart_mode fields from some arm subarchs Robin Holt
2013-05-07 14:39 ` [PATCH -v8 09/11] arm, prepare reboot_mode for moving to generic kernel code Robin Holt
2013-05-07 14:39 ` [PATCH -v8 10/11] arm, change reboot_mode to use enum reboot_mode Robin Holt
2013-05-07 14:39 ` [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel Robin Holt
2013-05-08 10:39   ` Ingo Molnar [this message]
2013-05-08 18:20     ` Russell King - ARM Linux
2013-05-08 18:33       ` H. Peter Anvin
2013-05-09 11:20         ` Robin Holt
2013-05-09 13:01           ` Robin Holt
2013-05-09 13:36             ` Russell King - ARM Linux
2013-05-09 15:59               ` Robin Holt
2013-05-08 18:23   ` Russell King - ARM Linux
2013-05-09 11:29     ` Robin Holt
2013-05-08 20:50   ` Andrew Morton
2013-05-09 11:29     ` Robin Holt

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=20130508103956.GA7677@gmail.com \
    --to=mingo@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).