Re: [PATCH v1] x86/smp: Set up exception handling before cr4_init()
From: Sohil Mehta
Date: Mon Feb 09 2026 - 19:18:46 EST
On 2/8/2026 11:28 PM, Sohil Mehta wrote:
> I think Dave already posted the patch for it here.
> https://lore.kernel.org/lkml/02df7890-83c2-4047-8c88-46fbc6e0a892@xxxxxxxxx/
>
> I will test that out to confirm that it doesn't mess up some implicit
> behavior.
>
I verified that the above patch works as expected. I added a debug print
in cpu_init_fred_exceptions() to test FRED behavior.
if (cr4_read_shadow() & X86_CR4_FRED)
pr_warn("FRED is already enabled on CPU%d\n",
smp_processor_id());
With Dave's patch, the warning no longer shows up on APs.
However, I found another location where we enable FRED in CR4 before
enabling the MSRs.
__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?