linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: socfpga: add smp_ops.cpu_kill to make kexec/kdump available
@ 2015-05-29  5:38 Hiraku Toyooka
  2015-05-29  8:33 ` Russell King - ARM Linux
  0 siblings, 1 reply; 5+ messages in thread
From: Hiraku Toyooka @ 2015-05-29  5:38 UTC (permalink / raw)
  To: dinguyen, linux; +Cc: linux-kernel, linux-arm-kernel

Kexec_load syscall in ARM checks that machine-specific code
has the smp_ops.cpu_kill() before loading kernel image.
This patch adds the cpu_kill(), as a result, kexec reboot and
kernel crash dump become available in mach-socfpga.

Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-socfpga/platsmp.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
index c64d89b..a8f0f84 100644
--- a/arch/arm/mach-socfpga/platsmp.c
+++ b/arch/arm/mach-socfpga/platsmp.c
@@ -95,11 +95,22 @@ static void socfpga_cpu_die(unsigned int cpu)
 		cpu_do_idle();
 }
 
+/*
+ * We need a dummy function so that platform_can_cpu_hotplug() knows
+ * we support CPU hotplug. However, the function does not need to do
+ * anything, because CPUs going offline just do WFI.
+ */
+static int socfpga_cpu_kill(unsigned int cpu)
+{
+	return 1;
+}
+
 struct smp_operations socfpga_smp_ops __initdata = {
 	.smp_init_cpus		= socfpga_smp_init_cpus,
 	.smp_prepare_cpus	= socfpga_smp_prepare_cpus,
 	.smp_boot_secondary	= socfpga_boot_secondary,
 #ifdef CONFIG_HOTPLUG_CPU
 	.cpu_die		= socfpga_cpu_die,
+	.cpu_kill		= socfpga_cpu_kill,
 #endif
 };


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: socfpga: add smp_ops.cpu_kill to make kexec/kdump available
  2015-05-29  5:38 [PATCH] ARM: socfpga: add smp_ops.cpu_kill to make kexec/kdump available Hiraku Toyooka
@ 2015-05-29  8:33 ` Russell King - ARM Linux
       [not found]   ` <XNM1$3$0$0$$3$3$3$A$0000051U556d3fe3@hitachi.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux @ 2015-05-29  8:33 UTC (permalink / raw)
  To: Hiraku Toyooka; +Cc: dinguyen, linux-kernel, linux-arm-kernel

On Fri, May 29, 2015 at 02:38:44PM +0900, Hiraku Toyooka wrote:
> Kexec_load syscall in ARM checks that machine-specific code
> has the smp_ops.cpu_kill() before loading kernel image.
> This patch adds the cpu_kill(), as a result, kexec reboot and
> kernel crash dump become available in mach-socfpga.

Please look at the kexec'd kernel's boot messages.  You will probably
notice that the kexec'd kernel is unable to start the secondary CPUs,
and probably causes them to crash.

As socfpga does not appear to be able to do anything with the secondary
CPUs other than park them in a WFI loop in the _existing_ kernel, when
that existing kernel gets overwritten by the kexec kernel and an interrupt
sent to the CPU, that secondary CPU could very well start executing code
it's not meant to.

So no, this is a bad idea.

Unless secondary CPUs can actually be taken offline, features like kexec
can't be supported on the platform.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: socfpga: add smp_ops.cpu_kill to make kexec/kdump available
       [not found]   ` <XNM1$3$0$0$$3$3$3$A$0000051U556d3fe3@hitachi.com>
@ 2015-06-02  8:38     ` Russell King - ARM Linux
  2015-06-02 23:40       ` Hiraku Toyooka
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux @ 2015-06-02  8:38 UTC (permalink / raw)
  To: hiraku.toyooka.gu; +Cc: dinguyen, linux-kernel, linux-arm-kernel

On Tue, Jun 02, 2015 at 02:32:19PM +0900, hiraku.toyooka.gu@hitachi.com wrote:
> Before kexec soft reboot, secondary CPU's IRQs except for per-cpu twd are
> migrated from a CPU going offline to CPU0 by migrate_irqs(). The twd is
> stopped by twd_timer_cpu_notify(). As a result, secondary CPU has no
> interrupt source before entering WFI loop.

I wasn't thinking of SPIs and PPIs, but SGIs - the IPI interrupts coming
from the boot CPU.

> After staring kexec'd kernel, all interrupts are sent to CPU0 by default
> and CPU0 resets the secondary CPUs in socfpga_boot_secondary().
> I think it's the reason why kexec in socfpga succeeds.

If you have a way to reset CPU0, why are you not using this for hotplug
when a CPU is hot-unplugged?

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: socfpga: add smp_ops.cpu_kill to make kexec/kdump available
  2015-06-02  8:38     ` Russell King - ARM Linux
@ 2015-06-02 23:40       ` Hiraku Toyooka
  2015-06-02 23:52         ` Russell King - ARM Linux
  0 siblings, 1 reply; 5+ messages in thread
From: Hiraku Toyooka @ 2015-06-02 23:40 UTC (permalink / raw)
  To: Russell King - ARM Linux; +Cc: dinguyen, linux-kernel, linux-arm-kernel

Hello, Russell,

On 2015/06/02 17:38, Russell King - ARM Linux wrote:
 > I wasn't thinking of SPIs and PPIs, but SGIs - the IPI interrupts coming
 > from the boot CPU.

All tasks in a CPU going offline are migrated to other CPUs(finally
CPU0) and the rq is marked with offline before the CPU entering WFI
loop. So IPI is not sent to the secondary CPU.

 > If you have a way to reset CPU0, why are you not using this for hotplug
 > when a CPU is hot-unplugged?

I think you mean "way to reset CPU1". If so, the reason is an increase
in power consumption in usual hotplug. This is discussed before between
Alan Tull and you. (https://lkml.org/lkml/2014/9/25/37)

Best regards,
Hiraku Toyooka

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: socfpga: add smp_ops.cpu_kill to make kexec/kdump available
  2015-06-02 23:40       ` Hiraku Toyooka
@ 2015-06-02 23:52         ` Russell King - ARM Linux
  0 siblings, 0 replies; 5+ messages in thread
From: Russell King - ARM Linux @ 2015-06-02 23:52 UTC (permalink / raw)
  To: Hiraku Toyooka; +Cc: dinguyen, linux-kernel, linux-arm-kernel

On Wed, Jun 03, 2015 at 08:40:51AM +0900, Hiraku Toyooka wrote:
> Hello, Russell,
> 
> On 2015/06/02 17:38, Russell King - ARM Linux wrote:
> > I wasn't thinking of SPIs and PPIs, but SGIs - the IPI interrupts coming
> > from the boot CPU.
> 
> All tasks in a CPU going offline are migrated to other CPUs(finally
> CPU0) and the rq is marked with offline before the CPU entering WFI
> loop. So IPI is not sent to the secondary CPU.
> 
> > If you have a way to reset CPU0, why are you not using this for hotplug
> > when a CPU is hot-unplugged?
> 
> I think you mean "way to reset CPU1". If so, the reason is an increase
> in power consumption in usual hotplug. This is discussed before between
> Alan Tull and you. (https://lkml.org/lkml/2014/9/25/37)

Please put a comment in your hotplug code describing this, so I'm
not likely to ask again (and I don't have to remember that I've
asked the question.)  Thanks.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-02 23:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-29  5:38 [PATCH] ARM: socfpga: add smp_ops.cpu_kill to make kexec/kdump available Hiraku Toyooka
2015-05-29  8:33 ` Russell King - ARM Linux
     [not found]   ` <XNM1$3$0$0$$3$3$3$A$0000051U556d3fe3@hitachi.com>
2015-06-02  8:38     ` Russell King - ARM Linux
2015-06-02 23:40       ` Hiraku Toyooka
2015-06-02 23:52         ` Russell King - ARM Linux

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).