From: Christoffer Dall <christoffer.dall@linaro.org>
To: James Morse <james.morse@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH] KVM: arm/arm64: Handle CPU_PM_ENTER_FAILED
Date: Tue, 23 Jan 2018 15:55:01 +0100 [thread overview]
Message-ID: <20180123145501.GM21802@cbox> (raw)
In-Reply-To: <20180122181906.29333-1-james.morse@arm.com>
On Mon, Jan 22, 2018 at 06:19:06PM +0000, James Morse wrote:
> cpu_pm_enter() calls the pm notifier chain with CPU_PM_ENTER, then if
> there is a failure: CPU_PM_ENTER_FAILED.
>
> When KVM receives CPU_PM_ENTER it calls cpu_hyp_reset() which will
> return us to the hyp-stub. If we subsequently get a CPU_PM_ENTER_FAILED,
> KVM does nothing, leaving the CPU running with the hyp-stub, at odds
> with kvm_arm_hardware_enabled.
>
> Add CPU_PM_ENTER_FAILED as a fallthrough for CPU_PM_EXIT, this reloads
> KVM based on kvm_arm_hardware_enabled. This is safe even if CPU_PM_ENTER
> never gets as far as KVM, as cpu_hyp_reinit() calls cpu_hyp_reset()
> to make sure the hyp-stub is loaded before reloading KVM.
>
> CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
> Prior to 67f691976662 ("arm64: kvm: allows kvm cpu hotplug") KVM only
> called cpu_hpy_reinit() when it got CPU_PM_EXIT, so KVM would stay
> loaded in the above scenario. But, this patch doesn't apply that far
> back as KVM moved from arch/arm to virt/kvm/arm.
Ok, but this should still be cc'ed stable with #v4.7+ then and then we'd
simply have to provide a backport for the versions where it doesn't
apply, or am I missing something?
>
> Fixes: 67f691976662 ("arm64: kvm: allows kvm cpu hotplug")
And I think this belongs in the main commit message, but I can fix that.
Speaking of which, it's probably too late to try and get this in for
v4.15, so unless there are objections, I'll just queue this for v4.16
and cc stable.
>
> virt/kvm/arm/arm.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
> index 15bf026eb182..0a1025f87909 100644
> --- a/virt/kvm/arm/arm.c
> +++ b/virt/kvm/arm/arm.c
> @@ -1246,6 +1246,7 @@ static int hyp_init_cpu_pm_notifier(struct notifier_block *self,
> cpu_hyp_reset();
>
> return NOTIFY_OK;
> + case CPU_PM_ENTER_FAILED:
> case CPU_PM_EXIT:
> if (__this_cpu_read(kvm_arm_hardware_enabled))
> /* The hardware was enabled before suspend. */
> --
> 2.15.1
>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
prev parent reply other threads:[~2018-01-23 14:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 18:19 [PATCH] KVM: arm/arm64: Handle CPU_PM_ENTER_FAILED James Morse
2018-01-23 14:55 ` Christoffer Dall [this message]
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=20180123145501.GM21802@cbox \
--to=christoffer.dall@linaro.org \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=lorenzo.pieralisi@arm.com \
--cc=marc.zyngier@arm.com \
/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