Re: [EXTERNAL] [PATCH] 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 25/10/21 12:39, David Woodhouse wrote:
Not every single time, only if the cache is absent, stale or not
initialized.
Hm, my reading of it suggests that it will fail even when the cache is
valid, on IOMEM PFNs for which pfn_valid() is not set:

         if (pfn_valid(pfn)) {
                 page = pfn_to_page(pfn);
                 if (atomic)
                         hva = kmap_atomic(page);
                 else
                         hva = kmap(page);
#ifdef CONFIG_HAS_IOMEM
         } else if (!atomic) {
                 hva = memremap(pfn_to_hpa(pfn), PAGE_SIZE,
MEMREMAP_WB);
         } else {
                 return -EINVAL;
#endif
         }


Yeah, you're right.  That's the "if" above.

For this use case I'm not even sure why I'd *want* to cache the PFN and
explicitly kmap/memremap it, when surely by *definition* there's a
perfectly serviceable HVA which already points to it?

The point of the gfn_to_pfn cache would be to know in advance that there won't be a page fault in atomic context. You certainly don't want to memremap/memunmap it here, it would be awfully slow, but pulling the kmap/memremap to the MMU notifier would make sense.

Paolo




[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