Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752809AbcCKVOn (ORCPT ); Fri, 11 Mar 2016 16:14:43 -0500 Received: from mail-ob0-f179.google.com ([209.85.214.179]:34470 "EHLO mail-ob0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752428AbcCKVOk (ORCPT ); Fri, 11 Mar 2016 16:14:40 -0500 MIME-Version: 1.0 In-Reply-To: <1457729240-3846-2-git-send-email-dmatlack@google.com> References: <1457729240-3846-1-git-send-email-dmatlack@google.com> <1457729240-3846-2-git-send-email-dmatlack@google.com> From: Andy Lutomirski Date: Fri, 11 Mar 2016 13:14:20 -0800 Message-ID: Subject: Re: [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0 is loaded To: David Matlack Cc: "linux-kernel@vger.kernel.org" , X86 ML , kvm list , Paolo Bonzini , Ingo Molnar , Andrew Lutomirski , "H. Peter Anvin" , digitaleric@google.com Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 630 Lines: 14 On Fri, Mar 11, 2016 at 12:47 PM, David Matlack wrote: > From: Eric Northup > > 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