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

2016-02-19 Thread Niklas Söderlund
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 
> 0104
>
> 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 
> ---
> 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.98] PM: Syncing filesystems ... done.
[  349.99] Freezing user space processes ... (elapsed 0.005 seconds) done.
[  350.00] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) 
done.
[  350.01] PM: suspend of devices complete after 1.098 msecs
[  350.02] PM: late suspend of devices complete after 0.671 msecs
[  350.02] PM: noirq suspend of devices complete after 0.671 msecs
[  350.03] Disabling non-boot CPUs ...
[  350.03] 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


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

2016-02-19 Thread Geert Uytterhoeven
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 0104

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 
---
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(+)

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