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

Re: [PATCH v2 5/8] x86/hvm: Context switch MSR_PKRS


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Mon, 16 Jan 2023 15:43:36 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=egGgxn++pMs3jICn9GuUZ62v5QcxMryKjEcVXGx3rj4=; b=mY+q5wqhDydCCBKeBPC8hcb5BzZXgFOgAgLSYILoxr0nufpmwA5p2U+o3/Rp1yIkuRjmZ2/ypIfFGjS/Q1v+CxmalD9T197hMJai/NVZ01+3gm+vVUPIv1wqhLOmWZy3GXjret/E3IssYeo+1KVgt8xhMXPoxmCyaBCVARDsFzDPyr7XL5vp/PJ3qTbw7klD+eGKx6M1pQ4Ch8PeAAeJ0Jq0CEswmDAEWliL+HMjqvj4KVxnbTFFNQgBGb2+qMqIAUhWNn69l50dG+J43q5iq69N0fxsjMxfqMFTuumR6tx3fryenYMTu8/KkRj12HOudzzrvVq94u2MZONsZCXNQA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SO8QHTatFmCs04tYDd/QHJVHBMLIrOwP24UD2N/E+3qAjMD7kzI9AqEuH2SGpPfL5jKA4oXHkVm7xw2PJuJntkG7IhwDbjgB5o3l8nOuKVz7aKFDjF5oUkspzyqMK/lmsXq1nOWU6E2DeK8Ku85zp6K2kCBpE2j3zuxs+i43kEGicUKPaCemMQaxfHbKfzjXS7zVm7fjmNGvs9fLKmsyXRnV5xNkE1QZgGtcADZNeNcrP9xxWK2oANi1Fc8A5wfmG63fb5VdjdIBGSvEX3u2yxNJGLqf3yVf/bnd1aP4WxciFgWIYWuKxD2vvXzYzV/He8wCU7DrkOeTRmADzg2s0g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 16 Jan 2023 15:43:51 +0000
  • Ironport-data: A9a23:dUjBG6gHDLTA2KVmPoEjSCoaX161WBEKZh0ujC45NGQN5FlHY01je htvXWGHPv6JZmShfNlyO4+w8h4FsZXTz9M1GQtl/yk0FXkb9cadCdqndUqhZCn6wu8v7q5Ex 55HNoSfdpBcolv0/ErF3m3J9CEkvU2wbuOgTrWCYmUpH1QMpB4J0XpLg/Q+jpNjne+3CgaMv cKai8DEMRqu1iUc3lg8sspvkzsy+qWt0N8klgZmP6sT5QaAzyN94K83fsldEVOpGuG4IcbiL wrz5OnR1n/U+R4rFuSknt7TGqHdauePVeQmoiM+t5mK2nCulARrukoIHKN0hXNsoyeIh7hMJ OBl7vRcf+uL0prkw4zxWzEAe8130DYvFLXveRBTuuTLp6HKnueFL1yDwyjaMKVBktubD12i+ tQXGRYvZzmE2diPyZ3lbLJnvpo7KsD0adZ3VnFIlVk1DN4AaLWaGuDmwIEd2z09wMdTAfzZe swVLyJ1awjNaAFOPVFRD48imOCvhT/0dDgwRFC9/PJrpTSMilEuluGybbI5efTTLSlRtm+eq njL4CLSBRYCOcbE4TGE7mitlqnEmiaTtIc6ReforKU62Qz7Kmo7JTgyUFLk+qODzV+Ga81Dc 2Me3Qp0lP1nnKCsZpynN/Gim1aGtBMBX9tbE8Uh9RqAjKHT5m6xGWwsXjNHLts8u6ceRjE01 1nPg9LgAxRutqGYTTSW8bL8hSO/P20ZIHEPYQcATBAZ+J/zrYcrlBXNQ91/VqmvgbXI9SrYx jmLqG0ygusVhMtSjqGjpwmY3nSru4TDSRMz6kPPRGW54whlZYmjIYu19Vzc6vUGJ4GcJrWcg EU5dwGlxLhmJfmweOalGY3hwJnBCy65DQDh
  • Ironport-hdrordr: A9a23:MAJTDq54CdLURpuz2QPXwPfXdLJyesId70hD6qm+c20tTiX4rb HXoB1/73XJYVkqKRQdcLy7Scu9qDbnhP1ICOoqXItKPjOW3FdARbsKheDfKn/bexEWndQtsp uIHZIObuEYzmIXsS852mSF+hobr+VvOZrHudvj
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZJRefeExwWeppzE65VXS63DgRAq6axG6AgAA9twCABgijAIAAFX4AgAALUQCAAAHpAIAACugA
  • Thread-topic: [PATCH v2 5/8] x86/hvm: Context switch MSR_PKRS

On 16/01/2023 3:04 pm, Jan Beulich wrote:
> On 16.01.2023 15:57, Andrew Cooper wrote:
>> On 16/01/2023 2:17 pm, Jan Beulich wrote:
>>> On 16.01.2023 14:00, Andrew Cooper wrote:
>>>> --- a/xen/arch/x86/acpi/power.c
>>>> +++ b/xen/arch/x86/acpi/power.c
>>>> @@ -299,6 +299,13 @@ static int enter_state(u32 state)
>>>>  
>>>>      update_mcu_opt_ctrl();
>>>>  
>>>> +    /*
>>>> +     * Should be before restoring CR4, but that is earlier in asm.  We
>>>> rely on
>>>> +     * MSR_PKRS actually being 0 out of S3 resume.
>>>> +     */
>>>> +    if ( cpu_has_pks )
>>>> +        wrpkrs_and_cache(0);
>>>> +
>>>>      /* (re)initialise SYSCALL/SYSENTER state, amongst other things. */
>>>>      percpu_traps_init();
>>>>  
>>>>
>>>> I've folded this hunk, to sort out the S3 resume path.
>>> The comment is a little misleading imo - it looks to justify that nothing
>>> needs doing. Could you add "..., but our cache needs clearing" to clarify
>>> why, despite our relying on zero being in the register (which I find
>>> problematic, considering that the doc doesn't even spell out reset state),
>>> the write is needed?
>> Xen doesn't actually set CR4.PKS at all (yet).
>>
>> I'm just trying to do a reasonable job of leaving Xen in a position
>> where it doesn't explode the instant we want to start using PKS ourselves.
>>
>> S3 resume is out of a full core poweroff.  Registers (which aren't
>> modified by firmware) will have their architectural reset values, and
>> for MSR_PKRS, that's 0.
> And where have you found that to be spelled out? It is this lack of
> specification (afaics) which is concerning me.

I have a request for an update to table 10-1 already pending.  MSR_PKRS
isn't plausibly different from PKRU.

(And even if it is different, this still won't matter while Xen doesn't
use CR4.PKS itself.)

~Andrew

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.