From: Sean Christopherson <seanjc@google.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Metin Kaya <metikaya@amazon.co.uk>,
kvm@vger.kernel.org, pbonzini@redhat.com, x86@kernel.org,
bp@alien8.de, paul@xen.org, tglx@linutronix.de, mingo@redhat.com,
dave.hansen@linux.intel.com, joao.m.martins@oracle.com
Subject: Re: [EXTERNAL][PATCH v2] KVM: x86/xen: Implement hvm_op/HVMOP_flush_tlbs hypercall
Date: Tue, 18 Apr 2023 07:44:51 -0700 [thread overview]
Message-ID: <ZD6s4w2NDtoYZSuH@google.com> (raw)
In-Reply-To: <138f584bd86fe68aa05f20db3de80bae61880e11.camel@infradead.org>
On Tue, Apr 18, 2023, David Woodhouse wrote:
> On Mon, 2023-04-17 at 09:31 -0700, Sean Christopherson wrote:
> > On Mon, Apr 17, 2023, Metin Kaya wrote:
> > > HVMOP_flush_tlbs suboperation of hvm_op hypercall allows a guest to
> > > flush all vCPU TLBs. There is no way for the VMM to flush TLBs from
> > > userspace.
> >
> > Ah, took me a minute to connect the dots.� Monday morning is definitely partly
> > to blame, but it would be helpful to expand this sentence to be more explicit as
> > to why userspace's inability to efficiently flush TLBs.
> >
> > And strictly speaking, userspace _can_ flush TLBs, just not in a precise, efficient
> > way.
>
> Hm, how? We should probably implement that in userspace as a fallback,
> however much it sucks.
Oh, the suckage is high :-) Use KVM_{G,S}ET_SREGS2 to toggle any CR{0,3,4}/EFER
bit and __set_sregs() will reset the MMU context. Note that without this fix[*]
that I'm going to squeeze into 6.4, the MMU context reset may result in all TDP
MMU roots being freed and reallocated.
[*] https://lore.kernel.org/all/20230413231251.1481410-1-seanjc@google.com
>
> > > �arch/x86/kvm/xen.c���������������� | 31 ++++++++++++++++++++++++++++++
> > > �include/xen/interface/hvm/hvm_op.h |� 3 +++
> >
> > Modifications to uapi headers is conspicuously missing.� I.e. there likely needs
> > to be a capability so that userspace can query support.
>
> Nah, nobody cares. If the kernel "accelerates" this hypercall, so be
> it. Userspace will just never get the KVM_EXIT_XEN for that hypercall
> because it'll be magically handled, like the others.
Ah, that makes sense, I was thinking userspace would complain if it got the
"unexpected" exit.
next prev parent reply other threads:[~2023-04-18 14:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230417122206.34647-1-metikaya@amazon.co.uk>
2023-04-17 12:22 ` [PATCH v2] KVM: x86/xen: Implement hvm_op/HVMOP_flush_tlbs hypercall Metin Kaya
2023-04-17 16:31 ` Sean Christopherson
2023-04-18 9:14 ` [EXTERNAL][PATCH " David Woodhouse
2023-04-18 10:13 ` [PATCH v3] " Metin Kaya
2023-04-18 10:48 ` Paul Durrant
2023-04-18 11:04 ` Kaya, Metin
2023-04-18 11:13 ` Paul Durrant
2023-04-18 11:05 ` [EXTERNAL][PATCH " David Woodhouse
2023-05-26 20:32 ` [PATCH " Sean Christopherson
2023-07-25 12:56 ` David Woodhouse
2023-07-26 20:07 ` Sean Christopherson
2023-07-27 12:04 ` David Woodhouse
2023-07-28 7:31 ` Kaya, Metin
2023-08-04 0:22 ` Sean Christopherson
2023-04-18 14:44 ` Sean Christopherson [this message]
2023-04-18 15:47 ` [EXTERNAL][PATCH v2] " David Woodhouse
2023-04-18 16:08 ` David Woodhouse
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=ZD6s4w2NDtoYZSuH@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=joao.m.martins@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=metikaya@amazon.co.uk \
--cc=mingo@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).