public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat•com>
To: "Dave Hansen" <dave.hansen@intel•com>,
	"Stephen Rothwell" <sfr@canb•auug.org.au>,
	"Radim Krčmář" <rkrcmar@redhat•com>, KVM <kvm@vger•kernel.org>,
	"Thomas Gleixner" <tglx@linutronix•de>,
	"Ingo Molnar" <mingo@elte•hu>, "H. Peter Anvin" <hpa@zytor•com>,
	"Peter Zijlstra" <peterz@infradead•org>
Cc: Linux Next Mailing List <linux-next@vger•kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger•kernel.org>,
	Marc Orr <marcorr@google•com>
Subject: Re: "x86: Remove Intel MPX" is wrong (Re: linux-next: manual merge of the kvm tree with the tip tree)
Date: Wed, 19 Dec 2018 22:40:59 +0100	[thread overview]
Message-ID: <e4ee46ee-001c-a22b-173e-551684fa79b5@redhat.com> (raw)
In-Reply-To: <c1c1d927-9e7c-3937-4ea9-a6d6dd94a4ee@intel.com>

On 19/12/18 22:28, Dave Hansen wrote:
> 
> On 12/19/18 1:00 PM, Paolo Bonzini wrote:
>> On 19/12/18 21:54, Dave Hansen wrote:
>>> I should have called this out in the changelog, but I removed *all* the
>>> support because I assumed that guests don't need MPX because no other OS
>>> supported it that I know of.
>>
>> Well, as long as you could have code that sets the MPX bits in XCR0, KVM
>> will have to support it.  My employer happens to sell one such kernel
>> and will probably do so a little less than ten years from now. :)
> 
> Does your employer sell a system that supports live migration across
> major releases?  Or, is it always that you support migration to _newer_
> releases but not older?

Only to the immediately following major release, but a major release has
a looooong lifetime.  So guests running on RHEL6 will have to reboot
when moving to RHEL8, and will drop MPX support.  But RHEL8 is stuck
supporting MPX even if it's off by default because guests can be
migrated from RHEL7 hosts to RHEL8.

>> In fact I'm not sure we want to ever remove XSAVE support for MPX in KVM
>> as long as the processor supports it.  That is, when KVM does
>> xsave/xrstor of the guest_fpu, we probably want to include MPX in there.
>> That can be contained within KVM, Linux need not enable it in XCR0, 
> 
> I believe you need the feature bit set in XCR0 for XSAVE* to be able to
> operate on it.  So, you could do this, but you would need to save XCR0,
> set the XCR0 MPX bits, do XSAVE or XRSTOR, and restore XCR0 all with
> preemption (and interrupts?) off.

Yes, and on context switch KVM does rely on the kernel saving/restoring
MPX state to userspace (QEMU)'s FPU struct though.  However, I can move
that to the preempt notifier, either open coded or wrapped with XSETBVs.
 One more reason to do our own xsave/xrstor in non-compacted format when
loading/storing guest_fpu.

Paolo

> You could just open-code the MPX save/restore, though.  MPX is
> XSAVE-managed, but not XSAVE-enabled like some other features, IIRC.

      reply	other threads:[~2018-12-19 21:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-19  4:12 linux-next: manual merge of the kvm tree with the tip tree Stephen Rothwell
2018-12-19 20:32 ` "x86: Remove Intel MPX" is wrong (Re: linux-next: manual merge of the kvm tree with the tip tree) Paolo Bonzini
2018-12-19 20:54   ` Dave Hansen
2018-12-19 21:00     ` Paolo Bonzini
2018-12-19 21:28       ` Dave Hansen
2018-12-19 21:40         ` Paolo Bonzini [this message]

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=e4ee46ee-001c-a22b-173e-551684fa79b5@redhat.com \
    --to=pbonzini@redhat$(echo .)com \
    --cc=dave.hansen@intel$(echo .)com \
    --cc=hpa@zytor$(echo .)com \
    --cc=kvm@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=marcorr@google$(echo .)com \
    --cc=mingo@elte$(echo .)hu \
    --cc=peterz@infradead$(echo .)org \
    --cc=rkrcmar@redhat$(echo .)com \
    --cc=sfr@canb$(echo .)auug.org.au \
    --cc=tglx@linutronix$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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