Re: [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0 is loaded

From: Andy Lutomirski
Date: Fri Mar 11 2016 - 16:14:46 EST


On Fri, Mar 11, 2016 at 12:47 PM, David Matlack <dmatlack@xxxxxxxxxx> wrote:
> From: Eric Northup <digitaleric@xxxxxxxxxx>
>
> Add a percpu boolean, tracking whether a KVM vCPU is running on the
> host CPU. KVM will set and clear it as it loads/unloads guest XCR0.
> (Note that the rest of the guest FPU load/restore is safe, because
> kvm_load_guest_fpu and kvm_put_guest_fpu call __kernel_fpu_begin()
> and __kernel_fpu_end(), respectively.) irq_fpu_usable() will then
> also check for this percpu boolean.

Is this better than just always keeping the host's XCR0 loaded outside
if the KVM interrupts-disabled region?

--Andy