lkml.org 
[lkml]   [2021]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: Thoughts of AMX KVM support based on latest kernel
From
On 11/16/21 19:55, Thomas Gleixner wrote:
> We can do that, but I'm unhappy about this conditional in schedule(). So
> I was asking for doing a simple KVM only solution first:
>
> vcpu_run()
> kvm_load_guest_fpu()
> wrmsrl(XFD, guest_fpstate->xfd);
> XRSTORS
>
> do {
>
> local_irq_disable();
>
> if (test_thread_flag(TIF_NEED_FPU_LOAD))
> switch_fpu_return()
> wrmsrl(XFD, guest_fpstate->xfd);
>
> do {
> vmenter(); // Guest modifies XFD
> } while (reenter);
>
> update_xfd_state(); // Restore consistency
>
> local_irq_enable();
>
> and check how bad that is for KVM in terms of overhead on AMX systems.

I agree, this is how we handle SPEC_CTRL for example and it can be
extended to XFD. We should first do that, then switch to the MSR lists.
Hacking into schedule() should really be the last resort.

> local_irq_enable(); <- Problem starts here
>
> preempt_enable(); <- Becomes wider here

It doesn't become that much wider because there's always preempt
notifiers. So if it's okay to save XFD in the XSAVES wrapper and in
kvm_arch_vcpu_put(), that might be already remove the need to do it
schedule().

Paolo

\
 
 \ /
  Last update: 2021-11-16 20:50    [W:0.248 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site