2012-05-23 17:17:18

by Pantelis Antoniou

[permalink] [raw]
Subject: [PATCH] [ARM] Unconditional call to smp_cross_call on UP crashes

omap2plus_defconfig builds with SMP & SMP_ON_UP set.
On beagle (which is UP) is_smp() returns false and we don't call
smp_init_cpus which in turn does not initialize smp_cross_call which
remains NULL.

When issuing a reboot we OOPS with a NULL dereference on stop smp_call.

Fixed by checking is_smp in smp_send_stop()
---
arch/arm/kernel/smp.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 8f46446..2a61335 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -588,6 +588,10 @@ void smp_send_stop(void)
unsigned long timeout;
struct cpumask mask;

+ /* make sure we don't bother if not SMP */
+ if (!is_smp())
+ return;
+
cpumask_copy(&mask, cpu_online_mask);
cpumask_clear_cpu(smp_processor_id(), &mask);
smp_cross_call(&mask, IPI_CPU_STOP);
--
1.7.1


2012-05-23 17:45:57

by Russ Dill

[permalink] [raw]
Subject: Re: [PATCH] [ARM] Unconditional call to smp_cross_call on UP crashes

On 05/24/2012 10:09 AM, Pantelis Antoniou wrote:
> omap2plus_defconfig builds with SMP & SMP_ON_UP set.
> On beagle (which is UP) is_smp() returns false and we don't call
> smp_init_cpus which in turn does not initialize smp_cross_call which
> remains NULL.
>
> When issuing a reboot we OOPS with a NULL dereference on stop smp_call.
>
> Fixed by checking is_smp in smp_send_stop()
> ---
> arch/arm/kernel/smp.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)

Acked-by: [email protected]

> diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
> index 8f46446..2a61335 100644
> --- a/arch/arm/kernel/smp.c
> +++ b/arch/arm/kernel/smp.c
> @@ -588,6 +588,10 @@ void smp_send_stop(void)
> unsigned long timeout;
> struct cpumask mask;
>
> + /* make sure we don't bother if not SMP */
> + if (!is_smp())
> + return;
> +
> cpumask_copy(&mask, cpu_online_mask);
> cpumask_clear_cpu(smp_processor_id(), &mask);
> smp_cross_call(&mask, IPI_CPU_STOP);

2012-05-23 18:52:58

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH] [ARM] Unconditional call to smp_cross_call on UP crashes

On Thu, May 24, 2012 at 05:09:59PM +0000, Pantelis Antoniou wrote:
> omap2plus_defconfig builds with SMP & SMP_ON_UP set.
> On beagle (which is UP) is_smp() returns false and we don't call
> smp_init_cpus which in turn does not initialize smp_cross_call which
> remains NULL.
>
> When issuing a reboot we OOPS with a NULL dereference on stop smp_call.
>
> Fixed by checking is_smp in smp_send_stop()

1. No sign-off, so this patch _can't_ be committed.

2. Poor description. You say it oopses, but you don't include the oops.
So, when I read this I've no idea exactly why this is failing. And it
_shouldn't_ fail, so I want to know what you are seeing.

2012-05-23 18:55:32

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH] [ARM] Unconditional call to smp_cross_call on UP crashes

On May 24, 2012, at 1:09 PM, Pantelis Antoniou wrote:

> omap2plus_defconfig builds with SMP & SMP_ON_UP set.
> On beagle (which is UP) is_smp() returns false and we don't call
> smp_init_cpus which in turn does not initialize smp_cross_call which
> remains NULL.
>
> When issuing a reboot we OOPS with a NULL dereference on stop smp_call.
>
> Fixed by checking is_smp in smp_send_stop()

Please also add Cc: [email protected] in the sign offs
so it's picked up in stable.

Tested-by: Matt Porter <[email protected]>

> ---
> arch/arm/kernel/smp.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
> index 8f46446..2a61335 100644
> --- a/arch/arm/kernel/smp.c
> +++ b/arch/arm/kernel/smp.c
> @@ -588,6 +588,10 @@ void smp_send_stop(void)
> unsigned long timeout;
> struct cpumask mask;
>
> + /* make sure we don't bother if not SMP */
> + if (!is_smp())
> + return;
> +
> cpumask_copy(&mask, cpu_online_mask);
> cpumask_clear_cpu(smp_processor_id(), &mask);
> smp_cross_call(&mask, IPI_CPU_STOP);
> --
> 1.7.1
>

2012-05-23 19:18:10

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH] [ARM] Unconditional call to smp_cross_call on UP crashes

On Wed, May 23, 2012 at 07:52:48PM +0100, Russell King - ARM Linux wrote:
> On Thu, May 24, 2012 at 05:09:59PM +0000, Pantelis Antoniou wrote:
> > omap2plus_defconfig builds with SMP & SMP_ON_UP set.
> > On beagle (which is UP) is_smp() returns false and we don't call
> > smp_init_cpus which in turn does not initialize smp_cross_call which
> > remains NULL.
> >
> > When issuing a reboot we OOPS with a NULL dereference on stop smp_call.
> >
> > Fixed by checking is_smp in smp_send_stop()
>
> 1. No sign-off, so this patch _can't_ be committed.
>
> 2. Poor description. You say it oopses, but you don't include the oops.
> So, when I read this I've no idea exactly why this is failing. And it
> _shouldn't_ fail, so I want to know what you are seeing.

And 3. not sent to linux-arm-kernel (please copy with patches so everyone
in the ARM community is aware of them, thanks.)