mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Sohil Mehta <sohil.mehta@intel.com>, Xin Li <xin@zytor.com>
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, hpa@zytor.com, peterz@infradead.org,
	andrew.cooper3@citrix.com, nikunj@amd.com,
	thomas.lendacky@amd.com, seanjc@google.com,
	stable@vger.kernel.org
Subject: Re: [PATCH v1] x86/smp: Set up exception handling before cr4_init()
Date: Mon, 9 Feb 2026 17:13:36 -0800	[thread overview]
Message-ID: <3f31f8f8-b0a6-4ff9-b2ea-eeb04196b20a@intel.com> (raw)
In-Reply-To: <52e152b9-c840-4480-9337-0f0aca327543@intel.com>

On 2/9/26 16:18, Sohil Mehta wrote:
> 
> 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?

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.

  reply	other threads:[~2026-02-10  1:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06 18:50 Xin Li (Intel)
2026-02-06 19:19 ` Dave Hansen
2026-02-08 19:02   ` Xin Li
2026-02-09  7:28     ` Sohil Mehta
2026-02-09  8:16       ` Xin Li
2026-02-09 15:14         ` Dave Hansen
2026-02-10  0:18       ` Sohil Mehta
2026-02-10  1:13         ` Dave Hansen [this message]
2026-02-10  3:11           ` Xin Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f31f8f8-b0a6-4ff9-b2ea-eeb04196b20a@intel.com \
    --to=dave.hansen@intel.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nikunj@amd.com \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.com \
    --cc=sohil.mehta@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    --cc=xin@zytor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®