linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Matlack <dmatlack@google.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	X86 ML <x86@kernel.org>, kvm list <kvm@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Ingo Molnar <mingo@redhat.com>,
	Andrew Lutomirski <luto@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Eric Northup <digitaleric@google.com>
Subject: Re: [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0 is loaded
Date: Fri, 11 Mar 2016 13:33:53 -0800	[thread overview]
Message-ID: <CALzav=dRU9svdrF-CBKc_zfgz9ziAhJ8bkyPeMZV9T9jxOMdRg@mail.gmail.com> (raw)
In-Reply-To: <CALCETrVc-GaqWC+MZm08YOUCMumzQ-TJK4h296LMtpQPdPS=0Q@mail.gmail.com>

On Fri, Mar 11, 2016 at 1:14 PM, Andy Lutomirski <luto@amacapital.net> wrote:
>
> On Fri, Mar 11, 2016 at 12:47 PM, David Matlack <dmatlack@google.com> wrote:
> > From: Eric Northup <digitaleric@google.com>
> >
> > 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?

Probably not. AFAICT KVM does not rely on it being loaded outside that
region. xsetbv isn't insanely expensive, is it? Maybe to minimize the
time spent with interrupts disabled it was put outside.

I do like that your solution would be contained to KVM.

>
> --Andy

  reply	other threads:[~2016-03-11 21:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 20:47 [PATCH 0/1] KVM: x86: using the fpu in interrupt context with a guest's xcr0 David Matlack
2016-03-11 20:47 ` [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0 is loaded David Matlack
2016-03-11 21:14   ` Andy Lutomirski
2016-03-11 21:33     ` David Matlack [this message]
2016-03-14 13:17       ` Paolo Bonzini
2016-03-15 18:27         ` Andy Lutomirski
2016-03-15 19:32           ` Paolo Bonzini
2016-03-16  3:55             ` Xiao Guangrong
2016-03-16 12:01               ` Paolo Bonzini
2016-03-14  7:46 ` [PATCH 0/1] KVM: x86: using the fpu in interrupt context with a guest's xcr0 Xiao Guangrong
2016-03-15 19:01   ` David Matlack
2016-03-16  3:43     ` Xiao Guangrong
2016-03-16  3:48       ` Andy Lutomirski
2016-03-16 17:11         ` David Matlack
2016-03-16 17:09       ` David Matlack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALzav=dRU9svdrF-CBKc_zfgz9ziAhJ8bkyPeMZV9T9jxOMdRg@mail.gmail.com' \
    --to=dmatlack@google.com \
    --cc=digitaleric@google.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).