From: Wei Liu <wei.liu@kernel.org>
To: Dexuan Cui <decui@microsoft.com>
Cc: bp@alien8.de, haiyangz@microsoft.com, hpa@zytor.com,
kys@microsoft.com, linux-hyperv@vger.kernel.org,
linux-kernel@vger.kernel.org, mingo@redhat.com,
sthemmin@microsoft.com, tglx@linutronix.de, x86@kernel.org,
mikelley@microsoft.com, vkuznets@redhat.com, wei.liu@kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] x86/hyperv: Suspend/resume the VP assist page for hibernation
Date: Tue, 21 Apr 2020 10:07:23 +0100 [thread overview]
Message-ID: <20200421090723.wfv24b54uvft5d4m@debian> (raw)
In-Reply-To: <1587437171-2472-1-git-send-email-decui@microsoft.com>
On Mon, Apr 20, 2020 at 07:46:11PM -0700, Dexuan Cui wrote:
> Unlike the other CPUs, CPU0 is never offlined during hibernation, so in the
> resume path, the "new" kernel's VP assist page is not suspended (i.e. not
> disabled), and later when we jump to the "old" kernel, the page is not
> properly re-enabled for CPU0 with the allocated page from the old kernel.
>
> So far, the VP assist page is used by hv_apic_eoi_write(), and is also
> used in the case of nested virtualization (running KVM atop Hyper-V).
>
> For hv_apic_eoi_write(), when the page is not properly re-enabled,
> hvp->apic_assist is always 0, so the HV_X64_MSR_EOI MSR is always written.
> This is not ideal with respect to performance, but Hyper-V can still
> correctly handle this according to the Hyper-V spec; nevertheless, Linux
> still must update the Hyper-V hypervisor with the correct VP assist page
> to prevent Hyper-V from writing to the stale page, which causes guest
> memory corruption and consequently may have caused the hangs and triple
> faults seen during non-boot CPUs resume.
>
> Fix the issue by calling hv_cpu_die()/hv_cpu_init() in the syscore ops.
> Without the fix, hibernation can fail at a rate of 1/300 ~ 1/500.
> With the fix, hibernation can pass a long-haul test of 2000 runs.
>
> In the case of nested virtualization, disabling/reenabling the assist
> page upon hibernation may be unsafe if there are active L2 guests.
> It looks KVM should be enhanced to abort the hibernation request if
> there is any active L2 guest.
>
> Fixes: 05bd330a7fd8 ("x86/hyperv: Suspend/resume the hypercall page for hibernation")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
Applied to hyperv-fixes. Thanks.
prev parent reply other threads:[~2020-04-21 9:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-21 2:46 [PATCH v2] x86/hyperv: Suspend/resume the VP assist page for hibernation Dexuan Cui
2020-04-21 9:07 ` Wei Liu [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=20200421090723.wfv24b54uvft5d4m@debian \
--to=wei.liu@kernel.org \
--cc=bp@alien8.de \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikelley@microsoft.com \
--cc=mingo@redhat.com \
--cc=stable@vger.kernel.org \
--cc=sthemmin@microsoft.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.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