[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c5d21a4c-bfb1-4a0f-8302-d3b78fcc8f3e@intel.com>
Date: Fri, 13 Jun 2025 08:19:20 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: "Liang, Kan" <kan.liang@...ux.intel.com>, peterz@...radead.org,
mingo@...hat.com, acme@...nel.org, namhyung@...nel.org, tglx@...utronix.de,
dave.hansen@...ux.intel.com, irogers@...gle.com, adrian.hunter@...el.com,
jolsa@...nel.org, alexander.shishkin@...ux.intel.com,
linux-kernel@...r.kernel.org
Cc: dapeng1.mi@...ux.intel.com, ak@...ux.intel.com, zide.chen@...el.com
Subject: Re: [RFC PATCH 03/12] x86/fpu/xstate: Add xsaves_nmi
On 6/13/25 07:54, Liang, Kan wrote:
>> One other thing...
>>
>> XSAVES uses the modified optimization. That means if you did something
>> like this:
>>
>> NMI=>
>> xsaves_nmi();
>> <=IRET
>> ... run a little bit in the kernel
>> NMI=> // another NMI
>> xsaves_nmi();
>> <=IRET
>>
>> The second XSAVES might not actually write anything to the buffer
>> because the registers didn't change (they weren't modified). Is that OK?
> Yes. The per-cpu buffer in perf is only used by this XSAVES. No one will
> clear it or modify it between the two xsaves_nmi().
What prevents it from being freed, reallocated to some other user, freed
and reallocated to the per-cpu buffer? ;)
But, really, the thing that saves you here is that the modified
optimization only comes into effect if you XRSTOR from an XSAVE buffer.
This buffer is only ever XSAVES'd to.
So I think it's safe ... from the modified optimization. I'll look at
the init optimization later in the series.
Powered by blists - more mailing lists