All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Michal Hocko <mhocko@suse.com>, Len Brown <len.brown@intel.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ben Segall <bsegall@google.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Huang Rui <ray.huang@amd.com>, Jan Beulich <JBeulich@suse.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	Jiri Slaby <jslaby@suse.cz>, Thomas Gleixner <tglx@linutronix.de>,
	Kees Cook <keescook@chromium.org>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>, Kyle Huey <me@kylehuey.com>,
	Robert O'Callahan <robert@ocallahan.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Vlastimil Babka <vbabka@suse.cz>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Alex Thorlton <athorlton@sgi>
Subject: Re: [PATCH] prctl, x86 Add PR_[GET|SET]_CPUID for controlling the CPUID instruction.
Date: Wed, 14 Sep 2016 20:42:23 +0100	[thread overview]
Message-ID: <15829dd7-387c-0eba-4301-7b2b53a3a2cc__30014.2859261998$1473882232$gmane$org@citrix.com> (raw)
In-Reply-To: <CALCETrUkmiwLDD0V-b5woDncOzdqZaS4Pg5EnneXD4ZEN7ttbg@mail.gmail.com>

On 14/09/2016 20:36, Andy Lutomirski wrote:
> On Wed, Sep 14, 2016 at 12:28 PM, Andrew Cooper
> <andrew.cooper3@citrix.com> wrote:
>> On 14/09/2016 20:23, Boris Ostrovsky wrote:
>>> On 09/14/2016 02:52 PM, Andy Lutomirski wrote:
>>>> On Tue, Sep 13, 2016 at 11:13 PM, Kyle Huey <me@kylehuey.com> wrote:
>>>>> On Mon, Sep 12, 2016 at 9:56 AM, Andy Lutomirski <luto@amacapital.net> wrote:
>>>>>> You should explicitly check that, if the
>>>>>> feature is set under Xen PV, then the MSR actually works as
>>>>>> advertised.  This may require talking to the Xen folks to make sure
>>>>>> you're testing the right configuration.
>>>>> This is interesting.  When running under Xen PV the kernel is allowed
>>>>> to read the real value of MSR_PLATFORM_INFO and see that CPUID
>>>>> faulting is supported.  But as you suggested, writing to
>>>>> MSR_MISC_FEATURES_ENABLES doesn't actually enable CPUID faulting, at
>>>>> least not in any way that works.
>>>>>
>>>>> It's not obvious to me how to test this, because when this feature
>>>>> works, CPUID only faults in userspace, not in the kernel.  Is there
>>>>> existing code somewhere that runs tests like this in userspace?
>>>>>
>>>> Andrew, Boris: should we expect Xen PV to do anything sensible when we
>>>> write to MSR_PLATFORM_INFO to turn on CPUID faulting?  Should the Xen
>>>> PV rdmsr hooks or perhaps the hypervisor mask out the feature if it
>>>> isn't going to be supported?
>>> The hypervisor uses CPUID faulting so we shouldn't advertise this
>>> feature to guests.
>> In the case that the hardware has faulting, or for any HVM guest, the
>> extra cost to making the feature available to the guest is a single
>> conditional test in the cpuid path.  This is about as close to zero as a
>> feature gets.  We really should be offering the feature to guests, and
>> have it actually working.  The issue here is that it is leaking when we
>> weren't intending to offer it.
> As long as Xen can fix this one way or the other in reasonably short
> order, I think I'm okay with having Linux incorrectly think it works
> on old Xen hypervisors.

For now, unilaterally hiding CPUID faulting is easy, and simple to backport.

Making the feature available for guests to use is slightly more tricky,
as the toolstack still depends on not being faulted to construct HVM
domains properly.  This is the subject of my current CPUID project,
which will result in dom0 being no more special than any other domain
(in terms of hypervisor-side cpuid handling).

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-09-14 19:42 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12  0:29 [PATCH] prctl,x86 Add PR_[GET|SET]_CPUID for controlling the CPUID instruction Kyle Huey
2016-09-12  0:29 ` Kyle Huey
2016-09-12  9:07 ` Borislav Petkov
2016-09-12  9:07   ` Borislav Petkov
2016-09-12 14:15   ` Kyle Huey
2016-09-12 14:15     ` Kyle Huey
2016-09-12 14:34     ` Borislav Petkov
2016-09-12 14:34       ` Borislav Petkov
2016-09-12 14:34       ` Borislav Petkov
2016-09-13 18:42     ` Kyle Huey
2016-09-13 18:42       ` Kyle Huey
2016-09-12 16:56 ` Andy Lutomirski
2016-09-12 16:56   ` Andy Lutomirski
2016-09-12 17:18   ` Borislav Petkov
2016-09-12 17:18     ` Borislav Petkov
2016-09-12 17:56   ` Jann Horn
2016-09-12 17:56     ` Jann Horn
2016-09-12 21:07     ` Andy Lutomirski
2016-09-12 21:07       ` Andy Lutomirski
2016-09-14  6:13   ` Kyle Huey
2016-09-14  6:13     ` Kyle Huey
2016-09-14 18:52     ` Andy Lutomirski
2016-09-14 18:52       ` Andy Lutomirski
2016-09-14 19:22       ` Andrew Cooper
2016-09-14 19:22         ` Andrew Cooper
2016-09-14 19:23       ` Boris Ostrovsky
2016-09-14 19:23         ` Boris Ostrovsky
2016-09-14 19:28         ` Andrew Cooper
2016-09-14 19:28           ` Andrew Cooper
2016-09-14 19:36           ` Andy Lutomirski
2016-09-14 19:36             ` Andy Lutomirski
2016-09-14 19:42             ` Andrew Cooper
2016-09-14 19:42               ` Andrew Cooper
2016-09-14 19:42             ` Andrew Cooper [this message]
2016-09-12 17:37 ` Andi Kleen
2016-09-12 18:25   ` Henrique de Moraes Holschuh

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='15829dd7-387c-0eba-4301-7b2b53a3a2cc__30014.2859261998$1473882232$gmane$org@citrix.com' \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=athorlton@sgi \
    --cc=bsegall@google.com \
    --cc=hpa@zytor.com \
    --cc=jslaby@suse.cz \
    --cc=keescook@chromium.org \
    --cc=len.brown@intel.com \
    --cc=luto@amacapital.net \
    --cc=me@kylehuey.com \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=mst@redhat.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=peterz@infradead.org \
    --cc=ray.huang@amd.com \
    --cc=robert@ocallahan.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tglx@linutronix.de \
    --cc=vbabka@suse.cz \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.