summaryrefslogtreecommitdiffstats
path: root/kernel/pid.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw@amazon.co.uk>2021-10-25 15:29:01 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2022-02-10 19:39:06 +0100
commitfcb732d8f8cf6084f8480015ad41d25fb023a4dd (patch)
tree8b064e7c68e2cd795213f6dfc7b4c59b10201cc4 /kernel/pid.c
parentKVM: x86: SVM: move avic definitions from AMD's spec to svm.h (diff)
downloadlinux-fcb732d8f8cf6084f8480015ad41d25fb023a4dd.tar.xz
linux-fcb732d8f8cf6084f8480015ad41d25fb023a4dd.zip
KVM: x86/xen: Fix runstate updates to be atomic when preempting vCPU
There are circumstances whem kvm_xen_update_runstate_guest() should not sleep because it ends up being called from __schedule() when the vCPU is preempted: [ 222.830825] kvm_xen_update_runstate_guest+0x24/0x100 [ 222.830878] kvm_arch_vcpu_put+0x14c/0x200 [ 222.830920] kvm_sched_out+0x30/0x40 [ 222.830960] __schedule+0x55c/0x9f0 To handle this, make it use the same trick as __kvm_xen_has_interrupt(), of using the hva from the gfn_to_hva_cache directly. Then it can use pagefault_disable() around the accesses and just bail out if the page is absent (which is unlikely). I almost switched to using a gfn_to_pfn_cache here and bailing out if kvm_map_gfn() fails, like kvm_steal_time_set_preempted() does — but on closer inspection it looks like kvm_map_gfn() will *always* fail in atomic context for a page in IOMEM, which means it will silently fail to make the update every single time for such guests, AFAICT. So I didn't do it that way after all. And will probably fix that one too. Cc: stable@vger.kernel.org Fixes: 30b5c851af79 ("KVM: x86/xen: Add support for vCPU runstate information") Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <b17a93e5ff4561e57b1238e3e7ccd0b613eb827e.camel@infradead.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'kernel/pid.c')
0 files changed, 0 insertions, 0 deletions