From: Paolo Bonzini <pbonzini@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [RFC PATCH] i386: Remove ospke CPUID flag name
Date: Wed, 13 Jun 2018 19:01:23 +0200 [thread overview]
Message-ID: <b93cd6e5-bb2e-b932-bc68-da5c314924a2@redhat.com> (raw)
In-Reply-To: <20180612182541.GN7451@localhost.localdomain>
On 12/06/2018 20:25, Eduardo Habkost wrote:
> On Tue, Jun 12, 2018 at 05:12:58PM +0200, Paolo Bonzini wrote:
>> On 12/06/2018 17:01, Eduardo Habkost wrote:
>>>>>
>>>>> Remove OSPKE from the feature name array so users don't try to
>>>>> configure it manually.
>>>>>
>>>>> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
>>>> Yes, it's the same as OSXSAVE. Thanks!
>>> CR4_OSXSAVE_MASK is automatically enabled on user-mode QEMU,
>>> though.
>>>
>>> My question is if it would make any sense to enable CR4_PKE_MASK
>>> too.
>>
>> If you mean OSPKE, then yes---if PKU is available. Likewise, OSXSAVE
>> should only be enabled if XSAVE is available.
>
> Yeah, I mean enabling it only if PKU is available, like we
> already do with OSXAVE/XSAVE.
>
> But we don't do it today, so enabling it automatically in
> CONFIG_USER_ONLY would be a new feature. Would it be useful for
> anything, though?
>
> I'm asking that to find out if somebody could be already using
> "-cpu ...,+ospke" with user-mode QEMU today (which this patch
> would break). If RDPKRU/WRPKRU is useless under user-mode QEMU,
> than we don't need to worry about that.
Hmm, actually there are two more things to consider for user-mode emulation.
First, QEMU doesn't support any of pkey_mprotect, pkey_alloc, pkey_free,
so it should probably never set OSPKE.
Second, for user-mode emulation it makes sense to allow flipping of
OSPKE and OSXSAVE, because that corresponds to different behaviors of
the underlying kernels. There have been bugs in fact with programs that
incorrectly tested XSAVE instead of OSXSAVE, so it's worthwhile to let
the user test both configurations.
So to sum up, the default for QEMU user-mode emulation should be
OSXSAVE=XSAVE and OSPKE=0.
Paolo
next prev parent reply other threads:[~2018-06-13 17:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 20:37 [Qemu-devel] [RFC PATCH] i386: Remove ospke CPUID flag name Eduardo Habkost
2018-06-11 21:49 ` Richard Henderson
2018-06-12 6:55 ` Paolo Bonzini
2018-06-12 15:01 ` Eduardo Habkost
2018-06-12 15:12 ` Paolo Bonzini
2018-06-12 18:25 ` Eduardo Habkost
2018-06-13 17:01 ` Paolo Bonzini [this message]
2018-06-13 17:16 ` Eduardo Habkost
2018-06-13 17:26 ` Paolo Bonzini
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=b93cd6e5-bb2e-b932-bc68-da5c314924a2@redhat.com \
--to=pbonzini@redhat.com \
--cc=ehabkost@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).