From: Sean Christopherson <seanjc@google.com>
To: Anish Moorthy <amoorthy@google.com>
Cc: Oliver Upton <oliver.upton@linux.dev>,
Chao Peng <chao.p.peng@linux.intel.com>,
kvm@vger.kernel.org, James Houghton <jthoughton@google.com>
Subject: Re: [PATCH 5/8] kvm: Add cap/kvm_run field for memory fault exits
Date: Thu, 23 Feb 2023 16:01:52 -0800 [thread overview]
Message-ID: <Y/f+cFe2uyaO5qCY@google.com> (raw)
In-Reply-To: <CAF7b7mqV4p_t4yJx6yyFFk7AQ2w6jVDCXUQfA+aza_OQya2qfA@mail.gmail.com>
On Thu, Feb 23, 2023, Anish Moorthy wrote:
> On Thu, Feb 23, 2023 at 12:55 PM Sean Christopherson <seanjc@google.com> wrote:
> > > (3) switched over to a memslot flag: KVM_CAP_MEMORY_FAULT_EXIT simply
> > > indicates whether this flag is supported.
> >
> > The new memslot flag should depend on KVM_CAP_MEMORY_FAULT_EXIT, but
> > KVM_CAP_MEMORY_FAULT_EXIT should be a standalone thing, i.e. should convert "all"
> > guest-memory -EFAULTS to KVM_CAP_MEMORY_FAULT_EXIT. All in quotes because I would
> > likely be ok with a partial conversion for the initial implementation if there
> > are paths that would require an absurd amount of work to convert.
>
> I'm actually not sure where all of the sources of guest-memory -EFAULTs are
> or how I'd go about finding them.
Heh, if anyone can says they can list _all_ sources of KVM accesses to guest
memory of the top of their head, they're lying.
Finding the sources is a bit tedious, but shouldn't be too hard. The scope is
is -EFAULT in the context of KVM_RUN that gets returned to userspace. There are
150+ references to -EFAULT to wade through, but the vast majority are obviously
not in scope, e.g. are for uaccess failures in other ioctls().
> Is the standalone behavior of KVM_CAP_MEMORY_FAULT_EXIT something you're
> suggesting because that new name is too broad for what it does right now?
No, I want a standalone thing because I want to start driving toward KVM never
returning -EFAULT to host userspace for accesses to guest memory in the context
of ioctl(KVM_RUN). E.g. I want to replace the "return -EFAULT" in
kvm_handle_error_pfn() with something like "return kvm_handle_memory_fault_exit(...)".
My hope/goal is that return useful information will allow userspace to do more
interesting things with guest memory without needing invasive, one-off changes
to KVM. At the very least, it should get us to the point where a memory fault
from KVM_RUN exits to userspace with sane, helpful information, not a generic
"-EFAULT, have fun debugging!".
> If so then I'd rather just rename it again: but if that functionality should
> be included with this series, then I'll take a look at the required work
> given a couple of pointers :)
>
> I will say, a partial implementation seems worse than no
> implementation: isn't there a risk that someone ends up depending on
> the incomplete behavior?
In this case, I don't think so. We definitely would need to document that KVM
may still return -EFAULT in certain scenarios, but we have at least one known
use case (this one) where catching the common cases is sufficient. And if/when
use cases come along that need 100% accuracy, we can hunt down and fix the KVM
remaining "bugs".
next prev parent reply other threads:[~2023-02-24 0:02 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 1:16 [PATCH 0/8] Add memory fault exits to avoid slow GUP Anish Moorthy
2023-02-15 1:16 ` [PATCH 1/8] selftests/kvm: Fix bug in how demand_paging_test calculates paging rate Anish Moorthy
2023-02-15 7:27 ` Oliver Upton
2023-02-15 16:44 ` Sean Christopherson
2023-02-15 18:05 ` Anish Moorthy
2023-02-15 1:16 ` [PATCH 2/8] selftests/kvm: Allow many vcpus per UFFD in demand paging test Anish Moorthy
2023-02-15 1:16 ` [PATCH 3/8] selftests/kvm: Switch demand paging uffd readers to epoll Anish Moorthy
2023-02-15 1:16 ` [PATCH 4/8] kvm: Allow hva_pfn_fast to resolve read-only faults Anish Moorthy
2023-02-15 9:01 ` Oliver Upton
2023-02-15 17:03 ` Sean Christopherson
2023-02-15 18:19 ` Anish Moorthy
2023-02-15 1:16 ` [PATCH 5/8] kvm: Add cap/kvm_run field for memory fault exits Anish Moorthy
2023-02-15 8:41 ` Marc Zyngier
2023-02-15 17:07 ` Sean Christopherson
2023-02-16 18:53 ` Anish Moorthy
2023-02-16 21:38 ` Sean Christopherson
2023-02-17 19:14 ` Anish Moorthy
2023-02-17 20:33 ` Sean Christopherson
2023-02-23 1:16 ` Anish Moorthy
2023-02-23 20:55 ` Sean Christopherson
2023-02-23 23:03 ` Anish Moorthy
2023-02-24 0:01 ` Sean Christopherson [this message]
2023-02-17 20:47 ` Sean Christopherson
2023-02-15 8:59 ` Oliver Upton
2023-02-15 1:16 ` [PATCH 6/8] kvm/x86: Add mem fault exit on EPT violations Anish Moorthy
2023-02-15 17:23 ` Sean Christopherson
2023-02-16 22:55 ` Peter Xu
2023-02-23 0:35 ` Anish Moorthy
2023-02-23 20:11 ` Sean Christopherson
2023-02-15 1:16 ` [PATCH 7/8] kvm/arm64: Implement KVM_CAP_MEM_FAULT_NOWAIT for arm64 Anish Moorthy
2023-02-15 18:24 ` Oliver Upton
2023-02-15 23:28 ` Anish Moorthy
2023-02-15 23:37 ` Oliver Upton
2023-02-15 1:16 ` [PATCH 8/8] selftests/kvm: Handle mem fault exits in demand paging test Anish Moorthy
2023-02-15 1:46 ` [PATCH 0/8] Add memory fault exits to avoid slow GUP James Houghton
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=Y/f+cFe2uyaO5qCY@google.com \
--to=seanjc@google.com \
--cc=amoorthy@google.com \
--cc=chao.p.peng@linux.intel.com \
--cc=jthoughton@google.com \
--cc=kvm@vger.kernel.org \
--cc=oliver.upton@linux.dev \
/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.