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

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


  • To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 16 Jan 2023 16:04:34 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=mFsgRX5bACsixQV9TsmLqP01VelcJnv1dRK4g9WEXdg=; b=BQxHYR2LIfmENm8dcpqU3mXk5ubp0XrJrGFZw3zADd49QgJ2KS23bAUeHeDFreWmsVRX6f4Eqj9x4LSJ4PVWuHfg31297tcQv7pkZbaT1DwO9o8jjnM3pDHINH4gTdnRxpN5G4/p5FSkW+b+acjDBkKxs8GxN/8IAJqnYBbPFdNOx/7a+LavhkO5AALC17r0EHMMHv1T1wz7jg6kBZOz1tcX6QdWroa2ILAfHDDo02V7dx4aLdWUWuM4zKJwIO5YR8dd0B5fQ2aQe+36LF7UBs/4vxRyy2bcYGCie/UFmXxzi7laA5i4iLyEv/CtfbvYf5VriEWP39Qx7XQ4ih0nKQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AfgBewjfoxXJDhKvrz2erMJ+ftkEW2ZFKs0uxWMOAjFa+zZtt8XtjvVo6hXG5exKpmg3eHoOeOy4mOTX2cQi7m1Ap3XkJk4IRscj8kFjIz82bp1oU4VGACHwalBSVAw4wakF044toJN16RRLhCD/3CbOAP1qbQ46pwwuYmcj0K8d/Ux68B+r7WA41H9C1myS+Fh+9gj+V7MTKVN/hlgH5V5o9DaQWslzM9SOsJ5C8JcDfZn8adigtext9uHB42RTtTBOLuJ2E512RvrzrGWEzD/yy4idQpQVCB02zB+plxHrasEOZ3ME4HoXx+JqbP7OiFZV70uDxYf6W5EmAqefiQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.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:04:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

Jan



 


Rackspace

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