From: Vivek Goyal <vgoyal@redhat.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: virtio-fs-list <virtio-fs@redhat.com>,
pbonzini@redhat.com, kvm@vger.kernel.org,
Sean Christopherson <sean.j.christopherson@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [Virtio-fs] [PATCH v4] kvm, x86: Exit to user space in case page fault error
Date: Tue, 6 Oct 2020 11:08:17 -0400 [thread overview]
Message-ID: <20201006150817.GD5306@redhat.com> (raw)
In-Reply-To: <874kn78l2z.fsf@vitty.brq.redhat.com>
On Tue, Oct 06, 2020 at 04:50:44PM +0200, Vitaly Kuznetsov wrote:
> Vivek Goyal <vgoyal@redhat.com> writes:
>
> > On Tue, Oct 06, 2020 at 04:05:16PM +0200, Vitaly Kuznetsov wrote:
> >> Vivek Goyal <vgoyal@redhat.com> writes:
> >>
> >> > A. Just exit to user space with -EFAULT (using kvm request) and don't
> >> > wait for the accessing task to run on vcpu again.
> >>
> >> What if we also save the required information (RIP, GFN, ...) in the
> >> guest along with the APF token
> >
> > Can you elaborate a bit more on this. You mean save GFN on stack before
> > it starts waiting for PAGE_READY event?
>
> When PAGE_NOT_PRESENT event is injected as #PF (for now) in the guest
> kernel gets all the registers of the userspace process (except for CR2
> which is replaced with a token). In case it is not trivial to extract
> accessed GFN from this data we can extend the shared APF structure and
> add it there, KVM has it when it queues APF.
>
> >
> >> so in case of -EFAULT we can just 'crash'
> >> the guest and the required information can easily be obtained from
> >> kdump? This will solve the debugging problem even for TDX/SEV-ES (if
> >> kdump is possible there).
> >
> > Just saving additional info in guest will not help because there might
> > be many tasks waiting and you don't know which GFN is problematic one.
>
> But KVM knows which token caused the -EFAULT when we exit to userspace
> (and we can pass this information to it) so to debug the situation you
> take this token and then explore the kdump searching for what's
> associated with this exact token.
So you will have to report token (along with -EFAULT) to user space. So this
is basically the 3rd proposal which is extension of kvm API and will
report say HVA/GFN also to user space along with -EFAULT.
Thanks
Vivek
WARNING: multiple messages have this Message-ID (diff)
From: Vivek Goyal <vgoyal@redhat.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
virtio-fs-list <virtio-fs@redhat.com>,
pbonzini@redhat.com
Subject: Re: [PATCH v4] kvm,x86: Exit to user space in case page fault error
Date: Tue, 6 Oct 2020 11:08:17 -0400 [thread overview]
Message-ID: <20201006150817.GD5306@redhat.com> (raw)
In-Reply-To: <874kn78l2z.fsf@vitty.brq.redhat.com>
On Tue, Oct 06, 2020 at 04:50:44PM +0200, Vitaly Kuznetsov wrote:
> Vivek Goyal <vgoyal@redhat.com> writes:
>
> > On Tue, Oct 06, 2020 at 04:05:16PM +0200, Vitaly Kuznetsov wrote:
> >> Vivek Goyal <vgoyal@redhat.com> writes:
> >>
> >> > A. Just exit to user space with -EFAULT (using kvm request) and don't
> >> > wait for the accessing task to run on vcpu again.
> >>
> >> What if we also save the required information (RIP, GFN, ...) in the
> >> guest along with the APF token
> >
> > Can you elaborate a bit more on this. You mean save GFN on stack before
> > it starts waiting for PAGE_READY event?
>
> When PAGE_NOT_PRESENT event is injected as #PF (for now) in the guest
> kernel gets all the registers of the userspace process (except for CR2
> which is replaced with a token). In case it is not trivial to extract
> accessed GFN from this data we can extend the shared APF structure and
> add it there, KVM has it when it queues APF.
>
> >
> >> so in case of -EFAULT we can just 'crash'
> >> the guest and the required information can easily be obtained from
> >> kdump? This will solve the debugging problem even for TDX/SEV-ES (if
> >> kdump is possible there).
> >
> > Just saving additional info in guest will not help because there might
> > be many tasks waiting and you don't know which GFN is problematic one.
>
> But KVM knows which token caused the -EFAULT when we exit to userspace
> (and we can pass this information to it) so to debug the situation you
> take this token and then explore the kdump searching for what's
> associated with this exact token.
So you will have to report token (along with -EFAULT) to user space. So this
is basically the 3rd proposal which is extension of kvm API and will
report say HVA/GFN also to user space along with -EFAULT.
Thanks
Vivek
next prev parent reply other threads:[~2020-10-06 15:08 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-20 21:13 [Virtio-fs] [PATCH v4] kvm, x86: Exit to user space in case page fault error Vivek Goyal
2020-07-20 21:13 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-07-27 13:56 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vivek Goyal
2020-07-27 13:56 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-07-27 16:09 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vitaly Kuznetsov
2020-07-27 16:09 ` [PATCH v4] kvm,x86: " Vitaly Kuznetsov
2020-07-27 18:40 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vivek Goyal
2020-07-27 18:40 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-07-30 5:01 ` [Virtio-fs] [PATCH v4] kvm, x86: " Pankaj Gupta
2020-07-30 5:01 ` [PATCH v4] kvm,x86: " Pankaj Gupta
2020-08-07 17:51 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vivek Goyal
2020-08-07 17:51 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-09-29 4:37 ` [Virtio-fs] [PATCH v4] kvm, x86: " Sean Christopherson
2020-09-29 4:37 ` [PATCH v4] kvm,x86: " Sean Christopherson
2020-10-01 21:55 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vivek Goyal
2020-10-01 21:55 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-10-01 22:33 ` [Virtio-fs] [PATCH v4] kvm, x86: " Sean Christopherson
2020-10-01 22:33 ` [PATCH v4] kvm,x86: " Sean Christopherson
2020-10-02 15:38 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vivek Goyal
2020-10-02 15:38 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-10-02 18:30 ` [Virtio-fs] [PATCH v4] kvm, x86: " Sean Christopherson
2020-10-02 18:30 ` [PATCH v4] kvm,x86: " Sean Christopherson
2020-10-02 19:27 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vivek Goyal
2020-10-02 19:27 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-10-02 19:45 ` [Virtio-fs] [PATCH v4] kvm, x86: " Sean Christopherson
2020-10-02 19:45 ` [PATCH v4] kvm,x86: " Sean Christopherson
2020-10-02 20:02 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vivek Goyal
2020-10-02 20:02 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-10-02 21:13 ` [Virtio-fs] [PATCH v4] kvm, x86: " Sean Christopherson
2020-10-02 21:13 ` [PATCH v4] kvm,x86: " Sean Christopherson
2020-10-05 15:33 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vivek Goyal
2020-10-05 15:33 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-10-05 16:16 ` [Virtio-fs] [PATCH v4] kvm, x86: " Sean Christopherson
2020-10-05 16:16 ` [PATCH v4] kvm,x86: " Sean Christopherson
2020-10-06 13:46 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vivek Goyal
2020-10-06 13:46 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-10-06 14:05 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vitaly Kuznetsov
2020-10-06 14:05 ` [PATCH v4] kvm,x86: " Vitaly Kuznetsov
2020-10-06 14:15 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vivek Goyal
2020-10-06 14:15 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-10-06 14:50 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vitaly Kuznetsov
2020-10-06 14:50 ` [PATCH v4] kvm,x86: " Vitaly Kuznetsov
2020-10-06 15:08 ` Vivek Goyal [this message]
2020-10-06 15:08 ` Vivek Goyal
2020-10-06 15:24 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vitaly Kuznetsov
2020-10-06 15:24 ` [PATCH v4] kvm,x86: " Vitaly Kuznetsov
2020-10-06 16:12 ` [Virtio-fs] [PATCH v4] kvm, x86: " Sean Christopherson
2020-10-06 16:12 ` [PATCH v4] kvm,x86: " Sean Christopherson
2020-10-06 16:24 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vivek Goyal
2020-10-06 16:24 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-10-06 16:39 ` [Virtio-fs] [PATCH v4] kvm, x86: " Vitaly Kuznetsov
2020-10-06 16:39 ` [PATCH v4] kvm,x86: " Vitaly Kuznetsov
2020-10-06 17:17 ` [Virtio-fs] [PATCH v4] kvm, x86: " Sean Christopherson
2020-10-06 17:17 ` [PATCH v4] kvm,x86: " Sean Christopherson
2020-10-06 17:21 ` [Virtio-fs] [PATCH v4] kvm, x86: " Dr. David Alan Gilbert
2020-10-06 17:21 ` Dr. David Alan Gilbert
2020-10-06 17:28 ` Vivek Goyal
2020-10-06 17:28 ` Vivek Goyal
2020-10-06 17:35 ` Vivek Goyal
2020-10-06 17:35 ` [PATCH v4] kvm,x86: " Vivek Goyal
2020-10-07 0:04 ` [Virtio-fs] [PATCH v4] kvm, x86: " Sean Christopherson
2020-10-07 0:04 ` [PATCH v4] kvm,x86: " Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201006150817.GD5306@redhat.com \
--to=vgoyal@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=virtio-fs@redhat.com \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.