[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9afc4ca6-a326-79ea-cc0b-4ce0808217d2@redhat.com>
Date: Wed, 17 Nov 2021 08:39:27 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Sean Christopherson <seanjc@...gle.com>
Cc: "Liu, Jing2" <jing2.liu@...el.com>,
LKML <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"Nakajima, Jun" <jun.nakajima@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Arjan van de Ven <arjan@...ux.intel.com>,
Jing Liu <jing2.liu@...ux.intel.com>,
"Cooper, Andrew" <andrew.cooper3@...rix.com>,
"Bae, Chang Seok" <chang.seok.bae@...el.com>
Subject: Re: Thoughts of AMX KVM support based on latest kernel
On 11/16/21 21:36, Thomas Gleixner wrote:
> 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().
>
> Did not think about preemption notifiers. Probably because I hate
> notifiers with a passion since I had to deal with the CPU hotplug
> notifier trainwreck.
>
> But yes that would work. So the places to do that would be:
>
> 1) kvm_sched_out() -> kvm_arch_vcpu_put() > 2) kernel_fpu_begin_mask()
... which calls save_fpregs_to_fpstate
> 3) kvm_put_guest_fpu()
... which calls save_fpregs_to_fpstate via fpu_swap_kvm_fpstate
So perhaps it could be done in save_fpregs_to_fpstate (for the sched out
path, it would be called by switch_fpu_prepare()). But for now I would
also start with the trivial version.
> I'd be really surprised if that RDMSR is truly noticeable within all the
> other crud this path is doing.
I agree.
Paolo
Powered by blists - more mailing lists