All of lore.kernel.org
 help / color / mirror / Atom feed
From: geoff@infradead.org (Geoff Levand)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v19 01/13] arm64: Add cpus_are_stuck_in_kernel
Date: Thu, 16 Jun 2016 23:48:27 +0000	[thread overview]
Message-ID: <b8820595fdc768f4d321fb9eeb178a0b0c1cf3f7.1466120418.git.geoff@infradead.org> (raw)
In-Reply-To: <cover.1466120418.git.geoff@infradead.org>

From: James Morse <james.morse@arm.com>

kernel/smp.c has a fancy counter that keeps track of the number of CPUs
it marked as not-present and left in cpu_park_loop(). If there are any
CPUs spinning in here, kexec will release them once the memory is re-used
by the new kernel.

Provide a function to expose whether this counter is non-zero, so we can
use this when loading a new kexec image, and when calling machine_kexec().

Signed-off-by: James Morse <james.morse@arm.com>
[Split off from a larger patch]
Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 arch/arm64/include/asm/smp.h | 10 ++++++++++
 arch/arm64/kernel/smp.c      |  5 +++++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index 433e504..38712f4 100644
--- a/arch/arm64/include/asm/smp.h
+++ b/arch/arm64/include/asm/smp.h
@@ -124,6 +124,16 @@ static inline void cpu_panic_kernel(void)
 	cpu_park_loop();
 }
 
+/*
+ * If a secondary CPU fails to come online, (e.g. due to mismatched features),
+ * it will try to call cpu_die(). If this fails, it updates
+ * cpus_stuck_in_kernel and sits in cpu_park_loop().
+ *
+ * Kexec checks this counter and refuses to load/kexec if it is non-zero, as
+ * cpu_park_loop() would be overwritten releasing the parked cpus.
+ */
+bool cpus_are_stuck_in_kernel(void);
+
 #endif /* ifndef __ASSEMBLY__ */
 
 #endif /* ifndef __ASM_SMP_H */
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 678e084..d0bcd55 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -909,3 +909,8 @@ int setup_profiling_timer(unsigned int multiplier)
 {
 	return -EINVAL;
 }
+
+bool cpus_are_stuck_in_kernel(void)
+{
+	return !!cpus_stuck_in_kernel;
+}
-- 
2.5.0

WARNING: multiple messages have this Message-ID (diff)
From: Geoff Levand <geoff@infradead.org>
To: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	marc.zyngier@arm.com, kexec@lists.infradead.org,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	James Morse <james.morse@arm.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v19 01/13] arm64: Add cpus_are_stuck_in_kernel
Date: Thu, 16 Jun 2016 23:48:27 +0000	[thread overview]
Message-ID: <b8820595fdc768f4d321fb9eeb178a0b0c1cf3f7.1466120418.git.geoff@infradead.org> (raw)
In-Reply-To: <cover.1466120418.git.geoff@infradead.org>

From: James Morse <james.morse@arm.com>

kernel/smp.c has a fancy counter that keeps track of the number of CPUs
it marked as not-present and left in cpu_park_loop(). If there are any
CPUs spinning in here, kexec will release them once the memory is re-used
by the new kernel.

Provide a function to expose whether this counter is non-zero, so we can
use this when loading a new kexec image, and when calling machine_kexec().

Signed-off-by: James Morse <james.morse@arm.com>
[Split off from a larger patch]
Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 arch/arm64/include/asm/smp.h | 10 ++++++++++
 arch/arm64/kernel/smp.c      |  5 +++++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index 433e504..38712f4 100644
--- a/arch/arm64/include/asm/smp.h
+++ b/arch/arm64/include/asm/smp.h
@@ -124,6 +124,16 @@ static inline void cpu_panic_kernel(void)
 	cpu_park_loop();
 }
 
+/*
+ * If a secondary CPU fails to come online, (e.g. due to mismatched features),
+ * it will try to call cpu_die(). If this fails, it updates
+ * cpus_stuck_in_kernel and sits in cpu_park_loop().
+ *
+ * Kexec checks this counter and refuses to load/kexec if it is non-zero, as
+ * cpu_park_loop() would be overwritten releasing the parked cpus.
+ */
+bool cpus_are_stuck_in_kernel(void);
+
 #endif /* ifndef __ASSEMBLY__ */
 
 #endif /* ifndef __ASM_SMP_H */
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 678e084..d0bcd55 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -909,3 +909,8 @@ int setup_profiling_timer(unsigned int multiplier)
 {
 	return -EINVAL;
 }
+
+bool cpus_are_stuck_in_kernel(void)
+{
+	return !!cpus_stuck_in_kernel;
+}
-- 
2.5.0



_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2016-06-16 23:48 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-16 23:48 [PATCH v19 00/13] arm64 kexec kernel patches Geoff Levand
2016-06-16 23:48 ` Geoff Levand
2016-06-16 23:48 ` [PATCH v19 05/13] arm64/kexec: Add pr_debug output Geoff Levand
2016-06-16 23:48   ` Geoff Levand
2016-06-20 16:06   ` James Morse
2016-06-20 16:06     ` James Morse
2016-06-20 16:50     ` Geoff Levand
2016-06-20 16:50       ` Geoff Levand
2016-06-16 23:48 ` [PATCH v19 02/13] arm64: Add back cpu reset routines Geoff Levand
2016-06-16 23:48   ` Geoff Levand
2016-06-16 23:48 ` [PATCH v19 04/13] arm64/kexec: Enable kexec in the arm64 defconfig Geoff Levand
2016-06-16 23:48   ` Geoff Levand
2016-06-16 23:48 ` Geoff Levand [this message]
2016-06-16 23:48   ` [PATCH v19 01/13] arm64: Add cpus_are_stuck_in_kernel Geoff Levand
2016-06-16 23:48 ` [PATCH v19 03/13] arm64/kexec: Add core kexec support Geoff Levand
2016-06-16 23:48   ` Geoff Levand
2016-06-20 15:36   ` James Morse
2016-06-20 15:36     ` James Morse
2016-06-20 16:49     ` Geoff Levand
2016-06-20 16:49       ` Geoff Levand
2016-06-16 23:48 ` [PATCH v19 11/13] arm64: kdump: enable kdump in the arm64 defconfig Geoff Levand
2016-06-16 23:48   ` Geoff Levand
2016-06-16 23:48 ` [PATCH v19 13/13] Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec Geoff Levand
2016-06-16 23:48   ` Geoff Levand
2016-06-16 23:48 ` [PATCH v19 12/13] arm64: kdump: update a kernel doc Geoff Levand
2016-06-16 23:48   ` Geoff Levand
2016-06-16 23:48 ` [PATCH v19 10/13] arm64: kdump: add VMCOREINFO's for user-space coredump tools Geoff Levand
2016-06-16 23:48   ` Geoff Levand
2016-06-20  5:32   ` Pratyush Anand
2016-06-20  5:32     ` Pratyush Anand
2016-06-22  5:59     ` AKASHI Takahiro
2016-06-22  5:59       ` AKASHI Takahiro
2016-06-23  7:14       ` Pratyush Anand
2016-06-23  7:14         ` Pratyush Anand
2016-06-23  8:42         ` AKASHI Takahiro
2016-06-23  8:42           ` AKASHI Takahiro
2016-06-23 15:46           ` Pratyush Anand
2016-06-23 15:46             ` Pratyush Anand
2016-06-30  0:44             ` AKASHI Takahiro
2016-06-30  0:44               ` AKASHI Takahiro
2016-06-16 23:48 ` [PATCH v19 07/13] arm64: limit memory regions based on DT property, usable-memory Geoff Levand
2016-06-16 23:48   ` Geoff Levand
2016-06-16 23:48 ` [PATCH v19 08/13] arm64: kdump: implement machine_crash_shutdown() Geoff Levand
2016-06-16 23:48   ` Geoff Levand
2016-06-16 23:48 ` [PATCH v19 06/13] arm64: kdump: reserve memory for crash dump kernel Geoff Levand
2016-06-16 23:48   ` Geoff Levand
2016-06-20 16:07   ` James Morse
2016-06-20 16:07     ` James Morse
2016-06-21  1:23     ` AKASHI Takahiro
2016-06-21  1:23       ` AKASHI Takahiro
2016-06-16 23:48 ` [PATCH v19 09/13] arm64: kdump: add kdump support Geoff Levand
2016-06-16 23:48   ` Geoff Levand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8820595fdc768f4d321fb9eeb178a0b0c1cf3f7.1466120418.git.geoff@infradead.org \
    --to=geoff@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.