All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Russell King <rmk+kernel@armlinux.org.uk>
Cc: marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org,
	dave.martin@arm.com, kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 2/2] ARM: soft-reboot into same mode that we entered the kernel
Date: Wed, 14 Dec 2016 11:56:49 +0000	[thread overview]
Message-ID: <20161214115648.GG17982@leverpostej> (raw)
In-Reply-To: <E1cH751-0003kk-Ts@rmk-PC.armlinux.org.uk>

On Wed, Dec 14, 2016 at 10:46:35AM +0000, Russell King wrote:
> When we soft-reboot (eg, kexec) from one kernel into the next, we need
> to ensure that we enter the new kernel in the same processor mode as
> when we were entered, so that (eg) the new kernel can install its own
> hypervisor - the old kernel's hypervisor will have been overwritten.
> 
> In order to do this, we need to pass a flag to cpu_reset() so it knows
> what to do, and we need to modify the kernel's own hypervisor stub to
> allow it to handle a soft-reboot.
> 
> As we are always guaranteed to install our own hypervisor if we're
> entered in HYP32 mode, and KVM will have moved itself out of the way
> on kexec/normal reboot, we can assume that our hypervisor is in place
> when we want to kexec, so changing our hypervisor API should not be a
> problem.

Just to check, does that also hold true for kdump?

I haven't gone digging yet, but it looks like KVM might still be
installed, rather than the hyp stub, and we might need some logic to
ensure that it's torn down...
 
[...]

> @@ -51,7 +52,9 @@ static void __soft_restart(void *addr)
>  
>  	/* Switch to the identity mapping. */
>  	phys_reset = (phys_reset_t)virt_to_idmap(cpu_reset);
> -	phys_reset((unsigned long)addr);
> +
> +	/* original stub should be restored by kvm */
> +	phys_reset((unsigned long)addr, is_hyp_mode_available());

... otherwise here we'd call into the KVM hyp code in a potentially
confusing manner.

Otherwise, this looks fine to me.

Thanks,
Mark.

WARNING: multiple messages have this Message-ID (diff)
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: soft-reboot into same mode that we entered the kernel
Date: Wed, 14 Dec 2016 11:56:49 +0000	[thread overview]
Message-ID: <20161214115648.GG17982@leverpostej> (raw)
In-Reply-To: <E1cH751-0003kk-Ts@rmk-PC.armlinux.org.uk>

On Wed, Dec 14, 2016 at 10:46:35AM +0000, Russell King wrote:
> When we soft-reboot (eg, kexec) from one kernel into the next, we need
> to ensure that we enter the new kernel in the same processor mode as
> when we were entered, so that (eg) the new kernel can install its own
> hypervisor - the old kernel's hypervisor will have been overwritten.
> 
> In order to do this, we need to pass a flag to cpu_reset() so it knows
> what to do, and we need to modify the kernel's own hypervisor stub to
> allow it to handle a soft-reboot.
> 
> As we are always guaranteed to install our own hypervisor if we're
> entered in HYP32 mode, and KVM will have moved itself out of the way
> on kexec/normal reboot, we can assume that our hypervisor is in place
> when we want to kexec, so changing our hypervisor API should not be a
> problem.

Just to check, does that also hold true for kdump?

I haven't gone digging yet, but it looks like KVM might still be
installed, rather than the hyp stub, and we might need some logic to
ensure that it's torn down...
 
[...]

> @@ -51,7 +52,9 @@ static void __soft_restart(void *addr)
>  
>  	/* Switch to the identity mapping. */
>  	phys_reset = (phys_reset_t)virt_to_idmap(cpu_reset);
> -	phys_reset((unsigned long)addr);
> +
> +	/* original stub should be restored by kvm */
> +	phys_reset((unsigned long)addr, is_hyp_mode_available());

... otherwise here we'd call into the KVM hyp code in a potentially
confusing manner.

Otherwise, this looks fine to me.

Thanks,
Mark.

  reply	other threads:[~2016-12-14 11:56 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09 19:49 [PATCH] ARM: soft-reboot into same mode that we entered the kernel Russell King
2016-12-13 10:54 ` Mark Rutland
2016-12-13 10:54   ` Mark Rutland
2016-12-13 11:11   ` Russell King - ARM Linux
2016-12-13 11:11     ` Russell King - ARM Linux
2016-12-13 11:30     ` Mark Rutland
2016-12-13 11:30       ` Mark Rutland
2016-12-14 10:46       ` [PATCH 1/2] ARM: hyp-stub: improve ABI Russell King
2016-12-14 10:46         ` Russell King
2016-12-14 11:49         ` Mark Rutland
2016-12-14 11:49           ` Mark Rutland
2016-12-15 11:18         ` Marc Zyngier
2016-12-15 11:18           ` Marc Zyngier
2016-12-15 11:35           ` Russell King - ARM Linux
2016-12-15 11:35             ` Russell King - ARM Linux
2016-12-15 11:46             ` Marc Zyngier
2016-12-15 11:46               ` Marc Zyngier
2016-12-15 15:15               ` Russell King - ARM Linux
2016-12-15 15:15                 ` Russell King - ARM Linux
2016-12-15 15:37                 ` Marc Zyngier
2016-12-15 15:37                   ` Marc Zyngier
2016-12-15 18:57                   ` Russell King - ARM Linux
2016-12-15 18:57                     ` Russell King - ARM Linux
2016-12-17 12:07                     ` Catalin Marinas
2016-12-17 12:07                       ` Catalin Marinas
2017-01-02 12:12                       ` Russell King - ARM Linux
2017-01-02 12:12                         ` Russell King - ARM Linux
2017-01-03  9:51                     ` Christoffer Dall
2017-01-03  9:51                       ` Christoffer Dall
2017-01-09 12:26                       ` Russell King - ARM Linux
2017-01-09 12:26                         ` Russell King - ARM Linux
2017-01-09 13:26                         ` Christoffer Dall
2017-01-09 13:26                           ` Christoffer Dall
2017-01-09 14:05                           ` Russell King - ARM Linux
2017-01-09 14:05                             ` Russell King - ARM Linux
2017-01-09 14:10                             ` Russell King - ARM Linux
2017-01-09 14:10                               ` Russell King - ARM Linux
2017-01-09 14:42                             ` Russell King - ARM Linux
2017-01-09 14:42                               ` Russell King - ARM Linux
2017-01-09 14:57                               ` Christoffer Dall
2017-01-09 14:57                                 ` Christoffer Dall
2017-01-09 15:01                             ` Christoffer Dall
2017-01-09 15:01                               ` Christoffer Dall
2017-01-09 15:43                               ` Russell King - ARM Linux
2017-01-09 15:43                                 ` Russell King - ARM Linux
2017-01-09 12:54           ` Russell King - ARM Linux
2017-01-09 12:54             ` Russell King - ARM Linux
2017-01-09 13:14             ` Marc Zyngier
2017-01-09 13:14               ` Marc Zyngier
2017-01-09 13:20               ` Russell King - ARM Linux
2017-01-09 13:20                 ` Russell King - ARM Linux
2017-01-09 13:31                 ` Marc Zyngier
2017-01-09 13:31                   ` Marc Zyngier
2017-01-09 14:28             ` Catalin Marinas
2017-01-09 14:28               ` Catalin Marinas
2016-12-14 10:46       ` [PATCH 2/2] ARM: soft-reboot into same mode that we entered the kernel Russell King
2016-12-14 10:46         ` Russell King
2016-12-14 11:56         ` Mark Rutland [this message]
2016-12-14 11:56           ` Mark Rutland
2016-12-14 12:05           ` Russell King - ARM Linux
2016-12-14 12:05             ` Russell King - ARM Linux
2016-12-14 12:17             ` Mark Rutland
2016-12-14 12:17               ` Mark Rutland
2016-12-14 12:29               ` Russell King - ARM Linux
2016-12-14 12:29                 ` Russell King - ARM Linux
2016-12-14 12:40                 ` Mark Rutland
2016-12-14 12:40                   ` Mark Rutland
2016-12-14 12:46                   ` Russell King - ARM Linux
2016-12-14 12:46                     ` Russell King - ARM Linux
2016-12-14 13:42             ` Marc Zyngier
2016-12-14 13:42               ` Marc Zyngier

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=20161214115648.GG17982@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=dave.martin@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /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.