[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ccee3768-c160-25b6-362f-de6cdd2b78c2@amd.com>
Date: Fri, 6 Dec 2019 15:14:17 +0700
From: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, hpa@...or.com, jon.grimm@....com,
Dave Hansen <dave.hansen@...el.com>,
Thomas Lendacky <Thomas.Lendacky@....com>
Subject: Re: [PATCH] x86/fpu: Warn only when CPU-provided sizes less than
struct declaration
Sebastian,
On 12/3/19 5:34 PM, Sebastian Andrzej Siewior wrote:
> On 2019-12-03 04:01:28 [-0500], Suravee Suthikulpanit wrote:
>> The current XCHECK_SZ macro warns if the XFEATURE size reported
>> by CPUID does not match the size of kernel structure. However, depending
>> on the hardware implementation, CPUID can report the XSAVE state size
>> larger than the size of C structures defined for each of the XSAVE state
>> due to padding. Such case should be safe and should not need to generate
>> warning message.
> Do you have an example which CPU generation and which feature?
This is observed with one of the newly supported features in the upcoming product.
> We don't use this these structs in the kernel and the xsave layout is
> dynamic based on the memory requirements reported by the CPU.
> But we have a warning which complains about different sizes. Now you
> change the warning that it is okay if the CPU reports that more memory
> is needed than we expect. This looks wrong. The other way around would
> be "okay" but this just renders the warning useless.
My point is it should be safe for the hardware to save data more than or equal
to the size used by the kernel. However, it is not okay if the hardware
saves data less than the amount used by kernel because that means the data
would lost at the time of restore.
However, in this case the hardware reported size contains data + padding.
Thanks,
Suravee
Powered by blists - more mailing lists