Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-07-01 Thread Vitaly Kuznetsov
Vivek Goyal writes: > On Tue, Jun 30, 2020 at 05:43:54PM +0200, Vitaly Kuznetsov wrote: >> Vivek Goyal writes: >> >> > On Tue, Jun 30, 2020 at 05:13:54PM +0200, Vitaly Kuznetsov wrote: >> >> >> >> > - If you retry in kernel, we will change the context completely that >> >> > who was trying

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-30 Thread Vivek Goyal
On Tue, Jun 30, 2020 at 05:43:54PM +0200, Vitaly Kuznetsov wrote: > Vivek Goyal writes: > > > On Tue, Jun 30, 2020 at 05:13:54PM +0200, Vitaly Kuznetsov wrote: > >> > >> > - If you retry in kernel, we will change the context completely that > >> > who was trying to access the gfn in question.

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-30 Thread Sean Christopherson
On Tue, Jun 30, 2020 at 06:12:49PM +0200, Vitaly Kuznetsov wrote: > Sean Christopherson writes: > > > On Tue, Jun 30, 2020 at 05:43:54PM +0200, Vitaly Kuznetsov wrote: > >> Vivek Goyal writes: > >> > >> > On Tue, Jun 30, 2020 at 05:13:54PM +0200, Vitaly Kuznetsov wrote: > >> >> > >> >> > - If

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-30 Thread Vitaly Kuznetsov
Sean Christopherson writes: > On Tue, Jun 30, 2020 at 05:43:54PM +0200, Vitaly Kuznetsov wrote: >> Vivek Goyal writes: >> >> > On Tue, Jun 30, 2020 at 05:13:54PM +0200, Vitaly Kuznetsov wrote: >> >> >> >> > - If you retry in kernel, we will change the context completely that >> >> > who was

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-30 Thread Sean Christopherson
On Tue, Jun 30, 2020 at 05:43:54PM +0200, Vitaly Kuznetsov wrote: > Vivek Goyal writes: > > > On Tue, Jun 30, 2020 at 05:13:54PM +0200, Vitaly Kuznetsov wrote: > >> > >> > - If you retry in kernel, we will change the context completely that > >> > who was trying to access the gfn in question.

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-30 Thread Vitaly Kuznetsov
Vivek Goyal writes: > On Tue, Jun 30, 2020 at 05:13:54PM +0200, Vitaly Kuznetsov wrote: >> >> > - If you retry in kernel, we will change the context completely that >> > who was trying to access the gfn in question. We want to retain >> > the real context and retain information who was

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-30 Thread Vivek Goyal
On Tue, Jun 30, 2020 at 05:13:54PM +0200, Vitaly Kuznetsov wrote: > Vivek Goyal writes: > > > On Tue, Jun 30, 2020 at 03:24:43PM +0200, Vitaly Kuznetsov wrote: > > >> > >> It's probably me who's missing something important here :-) but I think > >> you describe how it *should* work as I'm not

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-30 Thread Vitaly Kuznetsov
Vivek Goyal writes: > On Tue, Jun 30, 2020 at 03:24:43PM +0200, Vitaly Kuznetsov wrote: >> >> It's probably me who's missing something important here :-) but I think >> you describe how it *should* work as I'm not seeing how we can leave the >> loop in kvm_async_pf_task_wait_schedule() other

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-30 Thread Vivek Goyal
On Tue, Jun 30, 2020 at 03:24:43PM +0200, Vitaly Kuznetsov wrote: > Vivek Goyal writes: > > > On Mon, Jun 29, 2020 at 10:56:25PM +0200, Vitaly Kuznetsov wrote: > >> Vivek Goyal writes: > >> > >> > On Fri, Jun 26, 2020 at 11:25:19AM +0200, Vitaly Kuznetsov wrote: > >> > > >> > [..] > >> >> >

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-30 Thread Vitaly Kuznetsov
Vivek Goyal writes: > On Mon, Jun 29, 2020 at 10:56:25PM +0200, Vitaly Kuznetsov wrote: >> Vivek Goyal writes: >> >> > On Fri, Jun 26, 2020 at 11:25:19AM +0200, Vitaly Kuznetsov wrote: >> > >> > [..] >> >> > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c >> >> > index

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-29 Thread Vivek Goyal
On Mon, Jun 29, 2020 at 10:56:25PM +0200, Vitaly Kuznetsov wrote: > Vivek Goyal writes: > > > On Fri, Jun 26, 2020 at 11:25:19AM +0200, Vitaly Kuznetsov wrote: > > > > [..] > >> > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > >> > index 76817d13c86e..a882a6a9f7a7 100644 > >> >

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-29 Thread Vitaly Kuznetsov
Vivek Goyal writes: > On Fri, Jun 26, 2020 at 11:25:19AM +0200, Vitaly Kuznetsov wrote: > > [..] >> > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c >> > index 76817d13c86e..a882a6a9f7a7 100644 >> > --- a/arch/x86/kvm/mmu/mmu.c >> > +++ b/arch/x86/kvm/mmu/mmu.c >> > @@ -4078,7

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-26 Thread Vivek Goyal
On Fri, Jun 26, 2020 at 11:25:19AM +0200, Vitaly Kuznetsov wrote: [..] > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > > index 76817d13c86e..a882a6a9f7a7 100644 > > --- a/arch/x86/kvm/mmu/mmu.c > > +++ b/arch/x86/kvm/mmu/mmu.c > > @@ -4078,7 +4078,7 @@ static bool

Re: [RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-26 Thread Vitaly Kuznetsov
Vivek Goyal writes: > Page fault error handling behavior in kvm seems little inconsistent when > page fault reports error. If we are doing fault synchronously > then we capture error (-EFAULT) returned by __gfn_to_pfn_memslot() and > exit to user space and qemu reports error, "error: kvm run

[RFC PATCH] kvm,x86: Exit to user space in case of page fault error

2020-06-25 Thread Vivek Goyal
Page fault error handling behavior in kvm seems little inconsistent when page fault reports error. If we are doing fault synchronously then we capture error (-EFAULT) returned by __gfn_to_pfn_memslot() and exit to user space and qemu reports error, "error: kvm run failed Bad address". But if we