linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] arm64: kexec/kdump fixes for v10
@ 2015-10-20  7:58 AKASHI Takahiro
  2015-10-20  7:58 ` [PATCH 1/2] fixup! arm64: kdump: implement machine_crash_shutdown() AKASHI Takahiro
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: AKASHI Takahiro @ 2015-10-20  7:58 UTC (permalink / raw)
  To: linux-arm-kernel

These patches should be applied on top of Geoff's kexec/kdump patch[1],
v10, to fix some issues. I should have merged it before the submission
but I missed the timing. Sorry.

Please go ahead and review v10 since these patches don't change any
main logic of kexec/kdump. I will merge them in the next submission.

Patch 1 fixes a cpuidle issue reported by James[2].

Patch 2 allows kdump to start a crash kernel even with a kvm guest still
running. (I accidentally dropped this hack when rebasing my part.)

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/379268.html
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/376460.html

AKASHI Takahiro (2):
  fixup! arm64: kdump: implement machine_crash_shutdown()
  fixup! arm64: kvm: allows kvm cpu hotplug

 arch/arm/kvm/arm.c                |   25 +++++++++++++++++++++----
 arch/arm64/kernel/machine_kexec.c |    2 +-
 2 files changed, 22 insertions(+), 5 deletions(-)

-- 
1.7.9.5

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

* [PATCH 1/2] fixup! arm64: kdump: implement machine_crash_shutdown()
  2015-10-20  7:58 [PATCH 0/2] arm64: kexec/kdump fixes for v10 AKASHI Takahiro
@ 2015-10-20  7:58 ` AKASHI Takahiro
  2015-10-20  7:58 ` [PATCH 2/2] fixup! arm64: kvm: allows kvm cpu hotplug AKASHI Takahiro
  2015-10-20 19:05 ` [PATCH 0/2] arm64: kexec/kdump fixes for v10 Geoff Levand
  2 siblings, 0 replies; 5+ messages in thread
From: AKASHI Takahiro @ 2015-10-20  7:58 UTC (permalink / raw)
  To: linux-arm-kernel

Without this patch, crash dump kernel won't be able to boot if a kvm
guest is running at crash. This is because we don't have any chance
to reset EL2 mode at crash and so "switch to EL2" in cpu_reset fails.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 arch/arm64/kernel/machine_kexec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c
index 0edb7ee..d14dd05 100644
--- a/arch/arm64/kernel/machine_kexec.c
+++ b/arch/arm64/kernel/machine_kexec.c
@@ -271,7 +271,7 @@ static void soft_restart(unsigned long addr)
 {
 	setup_mm_for_reboot();
 	cpu_soft_restart(virt_to_phys(cpu_reset), addr,
-		is_hyp_mode_available());
+		(in_crash_kexec ? 0 : is_hyp_mode_available()));
 
 	BUG(); /* Should never get here. */
 }
-- 
1.7.9.5

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

* [PATCH 2/2] fixup! arm64: kvm: allows kvm cpu hotplug
  2015-10-20  7:58 [PATCH 0/2] arm64: kexec/kdump fixes for v10 AKASHI Takahiro
  2015-10-20  7:58 ` [PATCH 1/2] fixup! arm64: kdump: implement machine_crash_shutdown() AKASHI Takahiro
@ 2015-10-20  7:58 ` AKASHI Takahiro
  2015-10-20 16:22   ` James Morse
  2015-10-20 19:05 ` [PATCH 0/2] arm64: kexec/kdump fixes for v10 Geoff Levand
  2 siblings, 1 reply; 5+ messages in thread
From: AKASHI Takahiro @ 2015-10-20  7:58 UTC (permalink / raw)
  To: linux-arm-kernel

Without this patch, kvm cannot start a guest when cpuidle is enabled
if the hardware does not retain cpu state (EL2) in idle state.

This patch re-initailizes EL2 state at CPU_PM_EXIT by calling
kvm_arch_hardware_enable() if and only if kvm has been initialized
before CPU_PM_ENTER, that is, if any vcpus have been created.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 arch/arm/kvm/arm.c |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 0871809..fbff638 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -60,6 +60,8 @@ static atomic64_t kvm_vmid_gen = ATOMIC64_INIT(1);
 static u8 kvm_next_vmid;
 static DEFINE_SPINLOCK(kvm_vmid_lock);
 
+static DEFINE_PER_CPU(unsigned char, kvm_arm_hardware_enabled);
+
 static void kvm_arm_set_running_vcpu(struct kvm_vcpu *vcpu)
 {
 	BUG_ON(preemptible());
@@ -955,12 +957,27 @@ static int hyp_init_cpu_pm_notifier(struct notifier_block *self,
 				    unsigned long cmd,
 				    void *v)
 {
-	if (cmd == CPU_PM_EXIT && kvm_arm_get_running_vcpu()) {
-		kvm_arch_hardware_enable();
+	switch (cmd) {
+	case CPU_PM_ENTER:
+		if (__hyp_get_vectors() != hyp_default_vectors)
+			__this_cpu_write(kvm_arm_hardware_enabled, 1);
+		else
+			__this_cpu_write(kvm_arm_hardware_enabled, 0);
+		/*
+		 * don't call kvm_arch_hardware_disable() in case of
+		 * CPU_PM_ENTER because it does't actually save any state.
+		 */
+
+		return NOTIFY_OK;
+	case CPU_PM_EXIT:
+		if (__this_cpu_read(kvm_arm_hardware_enabled))
+			kvm_arch_hardware_enable();
+
 		return NOTIFY_OK;
-	}
 
-	return NOTIFY_DONE;
+	default:
+		return NOTIFY_DONE;
+	}
 }
 
 static struct notifier_block hyp_init_cpu_pm_nb = {
-- 
1.7.9.5

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

* [PATCH 2/2] fixup! arm64: kvm: allows kvm cpu hotplug
  2015-10-20  7:58 ` [PATCH 2/2] fixup! arm64: kvm: allows kvm cpu hotplug AKASHI Takahiro
@ 2015-10-20 16:22   ` James Morse
  0 siblings, 0 replies; 5+ messages in thread
From: James Morse @ 2015-10-20 16:22 UTC (permalink / raw)
  To: linux-arm-kernel

On 20/10/15 08:58, AKASHI Takahiro wrote:
> Without this patch, kvm cannot start a guest when cpuidle is enabled
> if the hardware does not retain cpu state (EL2) in idle state.
> 
> This patch re-initailizes EL2 state at CPU_PM_EXIT by calling
> kvm_arch_hardware_enable() if and only if kvm has been initialized
> before CPU_PM_ENTER, that is, if any vcpus have been created.
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

This solves my issue with the v5 version here [0].
Tested-By: James Morse <james.morse@arm.com>


Thanks!

James

[0] https://lists.linaro.org/pipermail/linaro-kernel/2015-May/021575.html

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

* [PATCH 0/2] arm64: kexec/kdump fixes for v10
  2015-10-20  7:58 [PATCH 0/2] arm64: kexec/kdump fixes for v10 AKASHI Takahiro
  2015-10-20  7:58 ` [PATCH 1/2] fixup! arm64: kdump: implement machine_crash_shutdown() AKASHI Takahiro
  2015-10-20  7:58 ` [PATCH 2/2] fixup! arm64: kvm: allows kvm cpu hotplug AKASHI Takahiro
@ 2015-10-20 19:05 ` Geoff Levand
  2 siblings, 0 replies; 5+ messages in thread
From: Geoff Levand @ 2015-10-20 19:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, 2015-10-20 at 16:58 +0900, AKASHI Takahiro wrote:
> These patches should be applied on top of Geoff's kexec/kdump patch[1],
> v10, to fix some issues.

I folded these fixes into my series as v10.1.

-Geoff


The following changes since commit 7379047d5585187d1288486d4627873170d0005a:

  Linux 4.3-rc6 (2015-10-18 16:08:42 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/geoff/linux-kexec.git kexec-v10.1

for you to fetch changes up to 5d4425b5ada84207b18a598f2199a67bc94fb141:

  arm64: kdump: relax BUG_ON() if more than one cpus are still active (2015-10-20 09:59:53 -0700)

----------------------------------------------------------------

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

end of thread, other threads:[~2015-10-20 19:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-20  7:58 [PATCH 0/2] arm64: kexec/kdump fixes for v10 AKASHI Takahiro
2015-10-20  7:58 ` [PATCH 1/2] fixup! arm64: kdump: implement machine_crash_shutdown() AKASHI Takahiro
2015-10-20  7:58 ` [PATCH 2/2] fixup! arm64: kvm: allows kvm cpu hotplug AKASHI Takahiro
2015-10-20 16:22   ` James Morse
2015-10-20 19:05 ` [PATCH 0/2] arm64: kexec/kdump fixes for v10 Geoff Levand

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