mbox series

[v4,0/4] Add support for XMM fast hypercalls

Message ID cover.1622019133.git.sidcha@amazon.de (mailing list archive)
Headers show
Series Add support for XMM fast hypercalls | expand

Message

Siddharth Chandrasekaran May 26, 2021, 8:56 a.m. UTC
Hyper-V supports the use of XMM registers to perform fast hypercalls.
This allows guests to take advantage of the improved performance of the
fast hypercall interface even though a hypercall may require more than
(the current maximum of) two general purpose registers.

The XMM fast hypercall interface uses an additional six XMM registers
(XMM0 to XMM5) to allow the caller to pass an input parameter block of
up to 112 bytes. Hyper-V can also return data back to the guest in the
remaining XMM registers that are not used by the current hypercall.

Although the Hyper-v TLFS mentions that a guest cannot use this feature
unless the hypervisor advertises support for it, some hypercalls which
we plan on upstreaming in future uses them anyway. This patchset adds
necessary infrastructure for handling input/output via XMM registers and
patches kvm_hv_flush_tlb() to use xmm input arguments.

~ Sid.

v3 -> v4:
  - Rebase to latest master
  - Remove unused loop variable j

v2 -> v3:
  - Remove inline for kvm_hv_hypercall_{read,write}_xmm()
  - Fix typo: s/ouput/output/
  - Remove sse128_t from kvm_emulate.h
  - Reword comment to match TLFS wording
  - Move num XMM registers macro to hyperv-tlfs.h
  - Stop advertising HV_X64_HYPERCALL_XMM_OUTPUT_AVAILABLE

v1 -> v2:
  - Add hc.fast to is_xmm_fast_hypercall() check
  - Split CPUID feature bits for input and output

Siddharth Chandrasekaran (4):
  KVM: x86: Move FPU register accessors into fpu.h
  KVM: hyper-v: Collect hypercall params into struct
  KVM: x86: kvm_hv_flush_tlb use inputs from XMM registers
  KVM: hyper-v: Advertise support for fast XMM hypercalls

 arch/x86/include/asm/hyperv-tlfs.h |  10 +-
 arch/x86/kvm/emulate.c             | 137 +++---------------
 arch/x86/kvm/fpu.h                 | 140 ++++++++++++++++++
 arch/x86/kvm/hyperv.c              | 222 +++++++++++++++++++----------
 arch/x86/kvm/kvm_emulate.h         |   3 +-
 5 files changed, 310 insertions(+), 202 deletions(-)
 create mode 100644 arch/x86/kvm/fpu.h

Comments

Siddharth Chandrasekaran June 30, 2021, 11:56 a.m. UTC | #1
On Wed, May 26, 2021 at 10:56:07AM +0200, Siddharth Chandrasekaran wrote:
> Hyper-V supports the use of XMM registers to perform fast hypercalls.
> This allows guests to take advantage of the improved performance of the
> fast hypercall interface even though a hypercall may require more than
> (the current maximum of) two general purpose registers.
> 
> The XMM fast hypercall interface uses an additional six XMM registers
> (XMM0 to XMM5) to allow the caller to pass an input parameter block of
> up to 112 bytes. Hyper-V can also return data back to the guest in the
> remaining XMM registers that are not used by the current hypercall.
> 
> Although the Hyper-v TLFS mentions that a guest cannot use this feature
> unless the hypervisor advertises support for it, some hypercalls which
> we plan on upstreaming in future uses them anyway. This patchset adds
> necessary infrastructure for handling input/output via XMM registers and
> patches kvm_hv_flush_tlb() to use xmm input arguments.

Hi Paolo,

Are you expecting more reviews on these patches? 

Thanks. 

~ Sid



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879
Paolo Bonzini July 6, 2021, 3:04 p.m. UTC | #2
On 30/06/21 13:56, Siddharth Chandrasekaran wrote:
> On Wed, May 26, 2021 at 10:56:07AM +0200, Siddharth Chandrasekaran wrote:
>> Hyper-V supports the use of XMM registers to perform fast hypercalls.
>> This allows guests to take advantage of the improved performance of the
>> fast hypercall interface even though a hypercall may require more than
>> (the current maximum of) two general purpose registers.
>>
>> The XMM fast hypercall interface uses an additional six XMM registers
>> (XMM0 to XMM5) to allow the caller to pass an input parameter block of
>> up to 112 bytes. Hyper-V can also return data back to the guest in the
>> remaining XMM registers that are not used by the current hypercall.
>>
>> Although the Hyper-v TLFS mentions that a guest cannot use this feature
>> unless the hypervisor advertises support for it, some hypercalls which
>> we plan on upstreaming in future uses them anyway. This patchset adds
>> necessary infrastructure for handling input/output via XMM registers and
>> patches kvm_hv_flush_tlb() to use xmm input arguments.
> 
> Hi Paolo,
> 
> Are you expecting more reviews on these patches?

They are part of 5.14 already. :)

Paolo
Siddharth Chandrasekaran July 6, 2021, 3:15 p.m. UTC | #3
On Tue, Jul 06, 2021 at 05:04:59PM +0200, Paolo Bonzini wrote:
> On 30/06/21 13:56, Siddharth Chandrasekaran wrote:
> > On Wed, May 26, 2021 at 10:56:07AM +0200, Siddharth Chandrasekaran wrote:
> > > Hyper-V supports the use of XMM registers to perform fast hypercalls.
> > > This allows guests to take advantage of the improved performance of the
> > > fast hypercall interface even though a hypercall may require more than
> > > (the current maximum of) two general purpose registers.
> > > 
> > > The XMM fast hypercall interface uses an additional six XMM registers
> > > (XMM0 to XMM5) to allow the caller to pass an input parameter block of
> > > up to 112 bytes. Hyper-V can also return data back to the guest in the
> > > remaining XMM registers that are not used by the current hypercall.
> > > 
> > > Although the Hyper-v TLFS mentions that a guest cannot use this feature
> > > unless the hypervisor advertises support for it, some hypercalls which
> > > we plan on upstreaming in future uses them anyway. This patchset adds
> > > necessary infrastructure for handling input/output via XMM registers and
> > > patches kvm_hv_flush_tlb() to use xmm input arguments.
> > 
> > Hi Paolo,
> > 
> > Are you expecting more reviews on these patches?
> 
> They are part of 5.14 already. :)

Ahh, I see them now. I was expecting them to show up in master - that was
the confusion.

Thanks! :)

~ Sid



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879
Paolo Bonzini July 6, 2021, 4:36 p.m. UTC | #4
On 06/07/21 17:15, Siddharth Chandrasekaran wrote:
> On Tue, Jul 06, 2021 at 05:04:59PM +0200, Paolo Bonzini wrote:
>> On 30/06/21 13:56, Siddharth Chandrasekaran wrote:
>>> On Wed, May 26, 2021 at 10:56:07AM +0200, Siddharth Chandrasekaran wrote:
>>>> Hyper-V supports the use of XMM registers to perform fast hypercalls.
>>>> This allows guests to take advantage of the improved performance of the
>>>> fast hypercall interface even though a hypercall may require more than
>>>> (the current maximum of) two general purpose registers.
>>>>
>>>> The XMM fast hypercall interface uses an additional six XMM registers
>>>> (XMM0 to XMM5) to allow the caller to pass an input parameter block of
>>>> up to 112 bytes. Hyper-V can also return data back to the guest in the
>>>> remaining XMM registers that are not used by the current hypercall.
>>>>
>>>> Although the Hyper-v TLFS mentions that a guest cannot use this feature
>>>> unless the hypervisor advertises support for it, some hypercalls which
>>>> we plan on upstreaming in future uses them anyway. This patchset adds
>>>> necessary infrastructure for handling input/output via XMM registers and
>>>> patches kvm_hv_flush_tlb() to use xmm input arguments.
>>>
>>> Hi Paolo,
>>>
>>> Are you expecting more reviews on these patches?
>>
>> They are part of 5.14 already. :)
> 
> Ahh, I see them now. I was expecting them to show up in master - that was
> the confusion.

No problem! The patches for the rc period (in your case it was 5.13) go 
in master, while yours ended up in next (destined for 5.14).

I usually update master only after 5.14-rc1 is out.  In this case I 
didn't even have access to kvm.git on the day that Linus pulled your 
patches into his tree.

Paolo