diff mbox

[RFC/RFT] ARM: shmobile: emev2: Add CPU hotplug ops

Message ID 1455877513-7680-1-git-send-email-geert+renesas@glider.be (mailing list archive)
State RFC
Delegated to: Simon Horman
Headers show

Commit Message

Geert Uytterhoeven Feb. 19, 2016, 10:25 a.m. UTC
When doing s2ram, emev2/kzm9d crashes during system suspend with

    CPU1: smp_ops.cpu_die() returned, trying to resuscitate
    Unable to handle kernel NULL pointer dereference at virtual address 00000104

As of commit d62242d7f63d6c87 ("ARM: shmobile: Remove partial CPU
Hotplug from EMEV2"), there's no longer an smp_ops.cpu_die() callback.

Add standard SCU-based hotplug callbacks like on other Cortex-A9 SoCs to
fix the crash during suspend.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This fixes the crash during the suspend phase, but I have no idea if
resume actually  works. I didn't manage to resume the machine after
enabling wake-up on ttyS0 (remote access only).

Can anyone with physical access to emev2/kzm9d please check if pressing
a button resumes the system?

Thanks!
---
 arch/arm/mach-shmobile/smp-emev2.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Niklas Söderlund Feb. 19, 2016, 1:24 p.m. UTC | #1
Hi Geert,

On 2016-02-19 11:25:13 +0100, Geert Uytterhoeven wrote:
> When doing s2ram, emev2/kzm9d crashes during system suspend with
>
>     CPU1: smp_ops.cpu_die() returned, trying to resuscitate
>     Unable to handle kernel NULL pointer dereference at virtual address 00000104
>
> As of commit d62242d7f63d6c87 ("ARM: shmobile: Remove partial CPU
> Hotplug from EMEV2"), there's no longer an smp_ops.cpu_die() callback.
>
> Add standard SCU-based hotplug callbacks like on other Cortex-A9 SoCs to
> fix the crash during suspend.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This fixes the crash during the suspend phase, but I have no idea if
> resume actually  works. I didn't manage to resume the machine after
> enabling wake-up on ttyS0 (remote access only).
>
> Can anyone with physical access to emev2/kzm9d please check if pressing
> a button resumes the system?

As discussed on IRC I tested this and it fixes the crash when suspending
to ram but unfortunately I can't get it to resume.

/ # evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio_keys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 2 (KEY_1)
    Event code 3 (KEY_2)
    Event code 4 (KEY_3)
    Event code 5 (KEY_4)
Properties:
Testing ... (interrupt to exit)
Event: time 308.056274, type 1 (EV_KEY), code 4 (KEY_3), value 1
Event: time 308.056274, -------------- SYN_REPORT ------------
Event: time 311.046234, type 1 (EV_KEY), code 4 (KEY_3), value 0
Event: time 311.046234, -------------- SYN_REPORT ------------
Event: time 324.426239, type 1 (EV_KEY), code 4 (KEY_3), value 1
Event: time 324.426239, -------------- SYN_REPORT ------------
Event: time 327.306243, type 1 (EV_KEY), code 4 (KEY_3), value 0
Event: time 327.306243, -------------- SYN_REPORT ------------
^C

/ # echo 0 > /sys/module/printk/parameters/console_suspend
/ # echo mem > /sys/power/state
[  349.980000] PM: Syncing filesystems ... done.
[  349.990000] Freezing user space processes ... (elapsed 0.005 seconds) done.
[  350.000000] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
[  350.010000] PM: suspend of devices complete after 1.098 msecs
[  350.020000] PM: late suspend of devices complete after 0.671 msecs
[  350.020000] PM: noirq suspend of devices complete after 0.671 msecs
[  350.030000] Disabling non-boot CPUs ...
[  350.030000] CPU1: shutdown


>
> Thanks!
> ---
>  arch/arm/mach-shmobile/smp-emev2.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
> index 3a732199cf5e98c0..e6e8f2298a6a4786 100644
> --- a/arch/arm/mach-shmobile/smp-emev2.c
> +++ b/arch/arm/mach-shmobile/smp-emev2.c
> @@ -53,4 +53,9 @@ static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
>  const struct smp_operations emev2_smp_ops __initconst = {
>  	.smp_prepare_cpus	= emev2_smp_prepare_cpus,
>  	.smp_boot_secondary	= emev2_boot_secondary,
> +#ifdef CONFIG_HOTPLUG_CPU
> +	.cpu_can_disable	= shmobile_smp_cpu_can_disable,
> +	.cpu_die		= shmobile_smp_scu_cpu_die,
> +	.cpu_kill		= shmobile_smp_scu_cpu_kill,
> +#endif
>  };
> --
> 1.9.1
>

--
Regards,
Niklas Söderlund
Geert Uytterhoeven Feb. 19, 2016, 1:30 p.m. UTC | #2
Hi Niklas,

On Fri, Feb 19, 2016 at 2:24 PM, Niklas Söderlund
<niklas.soderlund@ragnatech.se> wrote:
> On 2016-02-19 11:25:13 +0100, Geert Uytterhoeven wrote:
>> When doing s2ram, emev2/kzm9d crashes during system suspend with
>>
>>     CPU1: smp_ops.cpu_die() returned, trying to resuscitate
>>     Unable to handle kernel NULL pointer dereference at virtual address 00000104
>>
>> As of commit d62242d7f63d6c87 ("ARM: shmobile: Remove partial CPU
>> Hotplug from EMEV2"), there's no longer an smp_ops.cpu_die() callback.
>>
>> Add standard SCU-based hotplug callbacks like on other Cortex-A9 SoCs to
>> fix the crash during suspend.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>> This fixes the crash during the suspend phase, but I have no idea if
>> resume actually  works. I didn't manage to resume the machine after
>> enabling wake-up on ttyS0 (remote access only).
>>
>> Can anyone with physical access to emev2/kzm9d please check if pressing
>> a button resumes the system?
>
> As discussed on IRC I tested this and it fixes the crash when suspending
> to ram but unfortunately I can't get it to resume.

Thanks a lot for testing!

Let's drop this patch for now.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
diff mbox

Patch

diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index 3a732199cf5e98c0..e6e8f2298a6a4786 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -53,4 +53,9 @@  static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
 const struct smp_operations emev2_smp_ops __initconst = {
 	.smp_prepare_cpus	= emev2_smp_prepare_cpus,
 	.smp_boot_secondary	= emev2_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+	.cpu_can_disable	= shmobile_smp_cpu_can_disable,
+	.cpu_die		= shmobile_smp_scu_cpu_die,
+	.cpu_kill		= shmobile_smp_scu_cpu_kill,
+#endif
 };