Re: [PATCH v2] KVM: x86/xen: Fix runstate updates to be atomic when preempting vCPU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2021-10-25 at 14:29 +0100, David Woodhouse wrote:
> From: David Woodhouse <dwmw@xxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxxxx
> Fixes: 30b5c851af79 ("KVM: x86/xen: Add support for vCPU runstate information")
> Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> ---
> v2: Mark the page dirty after writing to it, add stable tag.

Hm, this got dropped I think.

I'm now working on other event channel stuff and I spotted it because
it's causing conflicts on backports to my internal tree (where it
didn't get dropped).

I am also working on converting to gfn_to_pfn_cache; the commit comment
above predates me actually *fixing* that. But this patch should
probably go in as-is for backporting to stable, and the conversions can
come on top.

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux