[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1A25CD17-B30C-4B36-811A-5DFD3F75B647@zytor.com>
Date: Mon, 9 Feb 2026 19:11:41 -0800
From: Xin Li <xin@...or.com>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Sohil Mehta <sohil.mehta@...el.com>, linux-kernel@...r.kernel.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
peterz@...radead.org, andrew.cooper3@...rix.com, nikunj@....com,
thomas.lendacky@....com, seanjc@...gle.com, stable@...r.kernel.org
Subject: Re: [PATCH v1] x86/smp: Set up exception handling before cr4_init()
> On Feb 9, 2026, at 5:13 PM, Dave Hansen <dave.hansen@...el.com> wrote:
>
> On 2/9/26 16:18, Sohil Mehta wrote:
>>
>> However, I found another location where we enable FRED in CR4 before
>> enabling the MSRs.
IIRC, it’s expected:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e5f1e8af9c9e151ecd665f6d2e36fb25fec3b110
>>
>> __restore_processor_state():
>>
>> ...
>>
>> __write_cr4(ctxt->cr4);
>>
>> ...
>>
>> if (ctxt->cr4 & X86_CR4_FRED) {
>> cpu_init_fred_exceptions();
>> cpu_init_fred_rsps();
>> }
>>
>> Due to limitations of my test platform, I couldn't verify the FRED print
>> in __restore_processor_state()'s path. But, could "restore" run into a
>> similar issue in the future?
>
> It sure looks like it. Good catch! I have the feeling there's never been
> an exception in that code anyway. The:
>
> wrmsrq(MSR_GS_BASE, ctxt->kernelmode_gs_base);
>
> is misplaced too. Exception handling leans heavily on MSR_GS_BASE.
>
> But, it doesn't hurt to be consistent about the ordering.
>
> In a perfect world, we'd probably unify all this code. Maybe the boot
> code establishes a 'saved_context' and all the APs just
> restore_processor_state() to go online normally instead of just for a
> restore. Or maybe the restore_processor_state() should be unified more
> with start_secondary() because a big chunk of the stuff its restoring is
> pretty static already.
>
> But there's no need today to do anything that drastic.
>
Powered by blists - more mailing lists