Re: [PATCH 5/5 v2] KVM: PPC: Book3S HV: Use __gfn_to_pfn_memslot() in page fault handler

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

 



On 03/27/2018 11:31 PM, Paul Mackerras wrote:
> This changes the hypervisor page fault handler for radix guests to use
> the generic KVM __gfn_to_pfn_memslot() function instead of using
> get_user_pages_fast() and then handling the case of VM_PFNMAP vmas
> specially.  The old code missed the case of VM_IO vmas; with this
> change, VM_IO vmas will now be handled correctly by code within
> __gfn_to_pfn_memslot.
> 
> Currently, __gfn_to_pfn_memslot calls hva_to_pfn, which only uses
> __get_user_pages_fast for the initial lookup in the cases where
> either atomic or async is set.  Since we are not setting either
> atomic or async, we do our own __get_user_pages_fast first, for now.
> 
> This also adds code to check for the KVM_MEM_READONLY flag on the
> memslot.  If it is set and this is a write access, we synthesize a
> data storage interrupt for the guest.
> 
> In the case where the page is not normal RAM (i.e. page == NULL in
> kvmppc_book3s_radix_page_fault(), we read the PTE from the Linux page
> tables because we need the mapping attribute bits as well as the PFN.
> (The mapping attribute bits indicate whether accesses have to be
> non-cacheable and/or guarded.)
> 
> Signed-off-by: Paul Mackerras <paulus@xxxxxxxxxx>
> ---
> v2: Read the Linux PTE for the non-RAM case to get the attribute bits.

Tested-by: Cédric Le Goater <clg@xxxxxxxx>

I have used patches [1-4]/5 + 5/5 v2 on top of 4.16-rc7 and tested
a guest using P9 XIVE exploitation mode. It works fine.

Thanks, 

C.



[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