[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9D8B895D-0728-4451-BD22-B8EC78F90BEB@zytor.com>
Date: Fri, 23 Dec 2022 11:37:07 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Andrew Cooper <Andrew.Cooper3@...rix.com>,
Peter Zijlstra <peterz@...radead.org>,
Xin Li <xin3.li@...el.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"seanjc@...gle.com" <seanjc@...gle.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"ravi.v.shankar@...el.com" <ravi.v.shankar@...el.com>
Subject: Re: [RFC PATCH 22/32] x86/fred: FRED initialization code
On December 20, 2022 1:55:31 AM PST, Andrew Cooper <Andrew.Cooper3@...rix.com> wrote:
>On 20/12/2022 9:45 am, Peter Zijlstra wrote:
>> On Mon, Dec 19, 2022 at 10:36:48PM -0800, Xin Li wrote:
>>
>>> + wrmsrl(MSR_IA32_FRED_STKLVLS,
>>> + FRED_STKLVL(X86_TRAP_DB, 1) |
>>> + FRED_STKLVL(X86_TRAP_NMI, 2) |
>>> + FRED_STKLVL(X86_TRAP_MC, 2) |
>>> + FRED_STKLVL(X86_TRAP_DF, 3));
>>> +
>>> + /* The FRED equivalents to IST stacks... */
>>> + wrmsrl(MSR_IA32_FRED_RSP1, __this_cpu_ist_top_va(DB));
>>> + wrmsrl(MSR_IA32_FRED_RSP2, __this_cpu_ist_top_va(NMI));
>>> + wrmsrl(MSR_IA32_FRED_RSP3, __this_cpu_ist_top_va(DF));
>> Not quite.. IIRC fred only switches to another stack when the level of
>> the exception is higher. Specifically, if we trigger #DB while inside
>> #NMI we will not switch to the #DB stack (since 1 < 2).
>
>There needs to be a new stack for #DF, and just possibly one for #MC.
>NMI and #DB do not need separate stacks under FRED.
>
>> Now, as mentioned elsewhere, it all nests a lot saner, but stack
>> exhaustion is still a thing, given the above, what happens when a #DB
>> hits an #NMI which tickles a #VE or something?
>>
>> I don't think we've increased the exception stack size, but perhaps we
>> should for FRED?
>
>Not sure if it matters too much - it doesn't seem usefully different to
>IDT delivery. #DB shouldn't get too deep, and NMI gets properly
>inhibited now.
>
>~Andrew
>
I still don't think you want to take #DB or – especially – NMI on the task stack while in the kernel. In fact, the plan is to get rid of the software irqstack handling, too, but at tglx's request that will be a later changeset (correctness first, then optimization.)
Powered by blists - more mailing lists