[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0522A1EE-211A-45E1-BAAD-002ABF47D0ED@oracle.com>
Date: Wed, 13 Nov 2024 20:04:51 +0000
From: Aruna Ramakrishna <aruna.ramakrishna@...cle.com>
To: Dave Hansen <dave.hansen@...el.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
"dave.hansen@...ux.intel.com"
<dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo
Molnar <mingo@...nel.org>,
Rudi Horn <rudi.horn@...cle.com>, Joe Jin
<joe.jin@...cle.com>
Subject: Re: [PATCH 2/2] x86/pkeys: Set XINUSE[PKRU] to 1 so that PKRU is
XRSTOR'd correctly
> On Nov 13, 2024, at 11:10 AM, Dave Hansen <dave.hansen@...el.com> wrote:
>
> On 11/13/24 10:14, Aruna Ramakrishna wrote:
>> PKRU value is not XRSTOR'd from the XSAVE area if the corresponding
>> XINUSE[i] bit is 0. When PKRU value is set to 0, it sets XINUSE[PKRU]
>> to 0 on AMD systems, which means the value updated on the sigframe
>> later (after a wrpkru(0)) is ignored.
>
> I think this is confusing XINUSE and XSTATE_BV.
>
> XINUSE is really internal to the CPU and is partially exposed in
> xgetbv(1). But XINUSE is monolithic; it includes user and supervisor state.
>
> XSTATE_BV is the actual memory location in the XSAVE buffer.
>
> So I think it's incorrect to say that XRSTOR behavior depends on XINUSE.
> XRSTOR behavior depends on XSTATE_BV.
You’re right; XSTATE_BV[i] is set during XSAVE based on XINUSE[i], and
XRSTOR restores based on XSTATE_BV. I will reword that (and change the
variable name in update_pkru_in_sigframe()) for v2.
Thanks,
Aruna
Powered by blists - more mailing lists