All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] kvm,x86,async_pf: Add capability to return page fault error
@ 2020-03-31 19:40 ` Vivek Goyal
  0 siblings, 0 replies; 12+ messages in thread
From: Vivek Goyal @ 2020-03-31 19:40 UTC (permalink / raw)
  To: kvm, linux-kernel
  Cc: virtio-fs, miklos, stefanha, dgilbert, vgoyal, aarcange, dhildenb

Current page fault logic in kvm seems to assume that host will always
be able to successfully resolve page fault soon or later. There does not
seem to be any mechanism for hypervisor to return an error say -EFAULT
to guest.

We are writing DAX support for virtiofs filesystem. This will allow
directly mapping host page cache page into guest user space process.

This mechanism now needs additional support from kvm where a page
fault error needs to be propagated back into guest. For example, say
guest process mmaped a file (and this did an mmap of portion of file
on host into qemu address space). Now file gets truncated and guest
process tries to access mapped region. It will generate page fault
in host and it will try to map the file page. But page is not there
any more so it will get back -EFAULT. But there is no mechanism to
send this information back to guest and currently host sends PAGE_READY
to guest, guest retries and fault happens again and host tries to
resolve page fault again and this becomes an infinite loop.

This is an RFC patch series which tries to extend async page fault
mechanism to also be able to communicate back that an error occurred
while resolving the page fault. Then guest can send SIGBUS to guest
process accessing the truncated portion of file. Or if access happened
in guest kernel, then it can try to fixup the exception and jump
to error handling portion if there is one.  

This patch series tries to solve it only for x86 architecture on intel
vmx only. Also it does not solve the problem for nested virtualization.

Is extending async page fault mechanism to report error back to
guest is right thing to do? Or there needs to be another way.

Any feedback or comments are welcome. 

Thanks
Vivek

Vivek Goyal (4):
  kvm: Add capability to be able to report async pf error to guest
  kvm: async_pf: Send faulting gva address in case of error
  kvm: Always get async page notifications
  kvm,x86,async_pf: Search exception tables in case of error

 Documentation/virt/kvm/cpuid.rst     |  4 ++
 Documentation/virt/kvm/msr.rst       | 11 +++--
 arch/x86/include/asm/kvm_host.h      | 17 ++++++-
 arch/x86/include/asm/kvm_para.h      | 13 +++---
 arch/x86/include/asm/vmx.h           |  2 +
 arch/x86/include/uapi/asm/kvm_para.h | 12 ++++-
 arch/x86/kernel/kvm.c                | 69 ++++++++++++++++++++++------
 arch/x86/kvm/cpuid.c                 |  3 +-
 arch/x86/kvm/mmu/mmu.c               | 12 +++--
 arch/x86/kvm/vmx/nested.c            |  2 +-
 arch/x86/kvm/vmx/vmx.c               | 11 ++++-
 arch/x86/kvm/x86.c                   | 37 +++++++++++----
 include/linux/kvm_host.h             |  1 +
 virt/kvm/async_pf.c                  |  6 ++-
 14 files changed, 156 insertions(+), 44 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-04-01  0:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31 19:40 [RFC PATCH 0/4] kvm,x86,async_pf: Add capability to return page fault error Vivek Goyal
2020-03-31 19:40 ` [Virtio-fs] [RFC PATCH 0/4] kvm, x86, async_pf: " Vivek Goyal
2020-03-31 19:40 ` [PATCH 1/4] kvm: Add capability to be able to report async pf error to guest Vivek Goyal
2020-03-31 19:40   ` [Virtio-fs] " Vivek Goyal
2020-03-31 19:40 ` [PATCH 2/4] kvm: async_pf: Send faulting gva address in case of error Vivek Goyal
2020-03-31 19:40   ` [Virtio-fs] " Vivek Goyal
2020-03-31 23:54   ` kbuild test robot
2020-04-01  0:16   ` kbuild test robot
2020-03-31 19:40 ` [PATCH 3/4] kvm: Always get async page notifications Vivek Goyal
2020-03-31 19:40   ` [Virtio-fs] " Vivek Goyal
2020-03-31 19:40 ` [PATCH 4/4] kvm,x86,async_pf: Search exception tables in case of error Vivek Goyal
2020-03-31 19:40   ` [Virtio-fs] [PATCH 4/4] kvm, x86, async_pf: " Vivek Goyal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.