* [PATCH] powerpc/kexec: Fix build failure on 32-bit SMP
@ 2011-04-25 1:04 Ben Hutchings
2011-04-26 18:25 ` Paul Gortmaker
0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2011-04-25 1:04 UTC (permalink / raw)
To: Paul Gortmaker, Benjamin Herrenschmidt; +Cc: linuxppc-dev
Commit b987812b3fcaf70fdf0037589e5d2f5f2453e6ce left
crash_kexec_wait_realmode() undefined for UP.
Commit 7c7a81b53e581d727d069cc45df5510516faac31 defined it for UP but
left it undefined for 32-bit SMP.
Seems like people are getting confused by nested #ifdef's, so move the
definitions of crash_kexec_wait_realmode() after the #ifdef CONFIG_SMP
section.
Compile-tested with 32-bit UP, 32-bit SMP and 64-bit SMP configurations.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -162,34 +162,6 @@
/* Leave the IPI callback set */
}
=20
-/* wait for all the CPUs to hit real mode but timeout if they don't come i=
n */
-#ifdef CONFIG_PPC_STD_MMU_64
-static void crash_kexec_wait_realmode(int cpu)
-{
- unsigned int msecs;
- int i;
-
- msecs =3D 10000;
- for (i=3D0; i < NR_CPUS && msecs > 0; i++) {
- if (i =3D=3D cpu)
- continue;
-
- while (paca[i].kexec_state < KEXEC_STATE_REAL_MODE) {
- barrier();
- if (!cpu_possible(i)) {
- break;
- }
- if (!cpu_online(i)) {
- break;
- }
- msecs--;
- mdelay(1);
- }
- }
- mb();
-}
-#endif /* CONFIG_PPC_STD_MMU_64 */
-
/*
* This function will be called by secondary cpus or by kexec cpu
* if soft-reset is activated to stop some CPUs.
@@ -234,7 +206,6 @@
}
=20
#else /* ! CONFIG_SMP */
-static inline void crash_kexec_wait_realmode(int cpu) {}
=20
static void crash_kexec_prepare_cpus(int cpu)
{
@@ -257,6 +228,36 @@
}
#endif /* CONFIG_SMP */
=20
+/* wait for all the CPUs to hit real mode but timeout if they don't come i=
n */
+#if defined(CONFIG_SMP) && defined(CONFIG_PPC_STD_MMU_64)
+static void crash_kexec_wait_realmode(int cpu)
+{
+ unsigned int msecs;
+ int i;
+
+ msecs =3D 10000;
+ for (i=3D0; i < NR_CPUS && msecs > 0; i++) {
+ if (i =3D=3D cpu)
+ continue;
+
+ while (paca[i].kexec_state < KEXEC_STATE_REAL_MODE) {
+ barrier();
+ if (!cpu_possible(i)) {
+ break;
+ }
+ if (!cpu_online(i)) {
+ break;
+ }
+ msecs--;
+ mdelay(1);
+ }
+ }
+ mb();
+}
+#else
+static inline void crash_kexec_wait_realmode(int cpu) {}
+#endif /* CONFIG_SMP && CONFIG_PPC_STD_MMU_64 */
+
/*
* Register a function to be called on shutdown. Only use this if you
* can't reset your device in the second kernel.
--=20
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc/kexec: Fix build failure on 32-bit SMP
2011-04-25 1:04 [PATCH] powerpc/kexec: Fix build failure on 32-bit SMP Ben Hutchings
@ 2011-04-26 18:25 ` Paul Gortmaker
0 siblings, 0 replies; 2+ messages in thread
From: Paul Gortmaker @ 2011-04-26 18:25 UTC (permalink / raw)
To: Ben Hutchings; +Cc: linuxppc-dev
On 11-04-24 09:04 PM, Ben Hutchings wrote:
> Commit b987812b3fcaf70fdf0037589e5d2f5f2453e6ce left
> crash_kexec_wait_realmode() undefined for UP.
>
> Commit 7c7a81b53e581d727d069cc45df5510516faac31 defined it for UP but
> left it undefined for 32-bit SMP.
Crap, I'd originally tested it for 32-SMP too, but not retested after
fixing the UP regression. I'm resolving to not touch this file again. :)
>
> Seems like people are getting confused by nested #ifdef's, so move the
So true.
> definitions of crash_kexec_wait_realmode() after the #ifdef CONFIG_SMP
> section.
I probably should have done this from the get-go as well. Oh well.
At least we are progressing towards a more readable file.
>
> Compile-tested with 32-bit UP, 32-bit SMP and 64-bit SMP configurations.
Since it seems I always get bit by the one combo I skip testing on,
I also tested 64-bit UP as well - just to be extra sure. Thanks for
fixing my brown paper bag moment.
>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Tested-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Paul.
> ---
> --- a/arch/powerpc/kernel/crash.c
> +++ b/arch/powerpc/kernel/crash.c
> @@ -162,34 +162,6 @@
> /* Leave the IPI callback set */
> }
>
> -/* wait for all the CPUs to hit real mode but timeout if they don't come in */
> -#ifdef CONFIG_PPC_STD_MMU_64
> -static void crash_kexec_wait_realmode(int cpu)
> -{
> - unsigned int msecs;
> - int i;
> -
> - msecs = 10000;
> - for (i=0; i < NR_CPUS && msecs > 0; i++) {
> - if (i == cpu)
> - continue;
> -
> - while (paca[i].kexec_state < KEXEC_STATE_REAL_MODE) {
> - barrier();
> - if (!cpu_possible(i)) {
> - break;
> - }
> - if (!cpu_online(i)) {
> - break;
> - }
> - msecs--;
> - mdelay(1);
> - }
> - }
> - mb();
> -}
> -#endif /* CONFIG_PPC_STD_MMU_64 */
> -
> /*
> * This function will be called by secondary cpus or by kexec cpu
> * if soft-reset is activated to stop some CPUs.
> @@ -234,7 +206,6 @@
> }
>
> #else /* ! CONFIG_SMP */
> -static inline void crash_kexec_wait_realmode(int cpu) {}
>
> static void crash_kexec_prepare_cpus(int cpu)
> {
> @@ -257,6 +228,36 @@
> }
> #endif /* CONFIG_SMP */
>
> +/* wait for all the CPUs to hit real mode but timeout if they don't come in */
> +#if defined(CONFIG_SMP) && defined(CONFIG_PPC_STD_MMU_64)
> +static void crash_kexec_wait_realmode(int cpu)
> +{
> + unsigned int msecs;
> + int i;
> +
> + msecs = 10000;
> + for (i=0; i < NR_CPUS && msecs > 0; i++) {
> + if (i == cpu)
> + continue;
> +
> + while (paca[i].kexec_state < KEXEC_STATE_REAL_MODE) {
> + barrier();
> + if (!cpu_possible(i)) {
> + break;
> + }
> + if (!cpu_online(i)) {
> + break;
> + }
> + msecs--;
> + mdelay(1);
> + }
> + }
> + mb();
> +}
> +#else
> +static inline void crash_kexec_wait_realmode(int cpu) {}
> +#endif /* CONFIG_SMP && CONFIG_PPC_STD_MMU_64 */
> +
> /*
> * Register a function to be called on shutdown. Only use this if you
> * can't reset your device in the second kernel.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-26 18:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-25 1:04 [PATCH] powerpc/kexec: Fix build failure on 32-bit SMP Ben Hutchings
2011-04-26 18:25 ` Paul Gortmaker
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).