qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH] i386: Remove ospke CPUID flag name


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC PATCH] i386: Remove ospke CPUID flag name
Date: Wed, 13 Jun 2018 19:01:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

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 <address@hidden>
>>>> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]