public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/8] arm64/kexec: Add checks for KVM
Date: Thu, 29 Jan 2015 18:47:47 +0000	[thread overview]
Message-ID: <20150129184747.GV17721@leverpostej> (raw)
In-Reply-To: <54CA12A1.8090508@arm.com>

On Thu, Jan 29, 2015 at 10:59:45AM +0000, Marc Zyngier wrote:
> 
> On 29/01/15 09:57, AKASHI Takahiro wrote:
> > Hello,
> > 
> > On 01/27/2015 04:19 AM, Mark Rutland wrote:
> >> On Sat, Jan 17, 2015 at 12:23:34AM +0000, Geoff Levand wrote:
> >>> Add runtime checks that fail the arm64 kexec syscall for situations that would
> >>> result in system instability do to problems in the KVM kernel support.
> >>> These checks should be removed when the KVM problems are resolved fixed.
> >>>
> >>> Signed-off-by: Geoff Levand <geoff@infradead.org>
> >>> ---
> >>>   arch/arm64/kernel/machine_kexec.c | 10 ++++++++++
> >>>   1 file changed, 10 insertions(+)
> >>>
> >>> diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c
> >>> index 3d84759..a36459d 100644
> >>> --- a/arch/arm64/kernel/machine_kexec.c
> >>> +++ b/arch/arm64/kernel/machine_kexec.c
> >>> @@ -16,6 +16,9 @@
> >>>   #include <asm/cacheflush.h>
> >>>   #include <asm/system_misc.h>
> >>>
> >>> +/* TODO: Remove this include when KVM can support a kexec reboot. */
> >>> +#include <asm/virt.h>
> >>> +
> >>>   /* Global variables for the relocate_kernel routine. */
> >>>   extern const unsigned char relocate_new_kernel[];
> >>>   extern const unsigned long relocate_new_kernel_size;
> >>> @@ -100,6 +103,13 @@ int machine_kexec_prepare(struct kimage *image)
> >>>
> >>>   	kexec_image_info(image);
> >>>
> >>> +	/* TODO: Remove this message when KVM can support a kexec reboot. */
> >>> +	if (IS_ENABLED(CONFIG_KVM) && is_hyp_mode_available()) {
> >>> +		pr_err("%s: Your kernel is configured with KVM support (CONFIG_KVM=y) which currently does not allow for kexec re-boot.\n",
> >>> +			__func__);
> >>> +		return -ENOSYS;
> >>> +	}
> >>
> >> If you really don't want to implement KVM teardown, surely this should
> >> be at the start of the series, so we don't have a point in the middle
> >> where things may explode in this case?
> > 
> > I'm going to fix this KVM issue (teardown) in cooperation with Geoff.
> > 
> > Looking into kvm init code, kvm_arch_init() in particular,
> > I guess that teardown function (kvm_arch_exit()) should do
> >    (reverting kvm_timer_hyp_init() per cpu)
> > - stop arch timer
> 
> No need, there shouldn't be any guest running at that point.
> 
> >    (reverting cpu_init_hyp_mode() per cpu)
> > - flush TLB
> > - jump into identical mapping (using boot_hyp_pgd?)
> > - disable MMU?
> 
> Yes, and for that, you need to go back to an idmap
> 
> > - restore vbar_el2 to __hyp_stub_vectors (or NULL?)
> 
> It doesn't matter, you want to stay in HYP for the next kernel.

Well, it depends on how the teardown is implemented. I'd imagined we'd
have KVM tear itself down (restoring the hyp stub) as part of shut down.
Later kexec/soft_restart would call the stub to get back to EL2.

That way kexec doesn't need to know anything about KVM, and it has one
path that works regardless of whether KVM is compiled into the kernel.

Mark.

  reply	other threads:[~2015-01-29 18:47 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1415926876.git.geoff@infradead.orgg>
2015-01-17  0:23 ` [PATCH 0/8] arm64 kexec kernel patches V7 Geoff Levand
2015-01-17  0:23   ` [PATCH 8/8] arm64/kexec: Enable kexec in the arm64 defconfig Geoff Levand
2015-01-17  0:23   ` [PATCH 2/8] arm64: Convert hcalls to use ISS field Geoff Levand
2015-01-26 18:26     ` Catalin Marinas
2015-01-30 23:31       ` Geoff Levand
2015-02-02 16:04         ` Catalin Marinas
2015-01-30 23:33     ` [PATCH v2 " Geoff Levand
2015-02-19 20:57       ` Christoffer Dall
2015-02-25 22:09         ` Geoff Levand
2015-03-02 22:13           ` Christoffer Dall
2015-03-02 23:22             ` Geoff Levand
2015-03-03 21:47               ` Christopher Covington
2015-03-03 22:35                 ` Geoff Levand
2015-01-17  0:23   ` [PATCH 5/8] arm64/kexec: Add core kexec support Geoff Levand
2015-01-26 19:16     ` Mark Rutland
2015-01-17  0:23   ` [PATCH 7/8] arm64/kexec: Add checks for KVM Geoff Levand
2015-01-26 19:19     ` Mark Rutland
2015-01-26 20:39       ` Christoffer Dall
2015-01-26 20:58         ` Geoff Levand
2015-01-26 21:00       ` Geoff Levand
2015-01-29  9:36       ` AKASHI Takahiro
2015-01-29  9:57       ` AKASHI Takahiro
2015-01-29 10:59         ` Marc Zyngier
2015-01-29 18:47           ` Mark Rutland [this message]
2015-01-30  6:10             ` AKASHI Takahiro
2015-01-30 12:14               ` Mark Rutland
2015-01-30 19:48               ` Geoff Levand
2015-02-02  8:18                 ` AKASHI Takahiro
2015-02-06  0:11                   ` Geoff Levand
2015-02-06  4:18                     ` AKASHI Takahiro
2015-02-06  7:06                       ` Geoff Levand
2015-01-17  0:23   ` [PATCH 4/8] arm64: Add EL2 switch to soft_restart Geoff Levand
2015-01-26 19:02     ` Mark Rutland
2015-01-26 21:48       ` Geoff Levand
2015-01-27 16:46         ` Mark Rutland
2015-01-27 18:34           ` Geoff Levand
2015-01-27 17:57     ` Catalin Marinas
2015-01-30 21:47       ` Geoff Levand
2015-01-17  0:23   ` [PATCH 1/8] arm64: Move proc-macros.S to include/asm Geoff Levand
2015-01-26 17:45     ` Catalin Marinas
2015-01-27 19:33     ` [PATCH V2 1/8] arm64: Fold proc-macros.S into assembler.h Geoff Levand
2015-01-17  0:23   ` [PATCH 3/8] arm64: Add new hcall HVC_CALL_FUNC Geoff Levand
2015-01-27 17:39     ` Catalin Marinas
2015-01-27 18:00       ` Mark Rutland
2015-01-30 21:52       ` Geoff Levand
2015-01-17  0:23   ` [PATCH 6/8] arm64/kexec: Add pr_devel output Geoff Levand
2015-01-26 17:44   ` [PATCH 0/8] arm64 kexec kernel patches V7 Catalin Marinas
2015-01-26 18:37     ` Grant Likely
2015-01-26 18:55     ` Mark Rutland
2015-01-26 20:57     ` 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=20150129184747.GV17721@leverpostej \
    --to=mark.rutland@arm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox