From: Sohil Mehta <sohil.mehta@intel.com>
To: Xin Li <xin@zytor.com>, Dave Hansen <dave.hansen@intel.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: Sun, 8 Feb 2026 23:28:41 -0800 [thread overview]
Message-ID: <37de06e1-aae4-4ebd-ac93-1846ee4cd91e@intel.com> (raw)
In-Reply-To: <DAF4D431-5596-4FD1-BF8B-D7D753C0810C@zytor.com>
On 2/8/2026 11:02 AM, Xin Li wrote:
>
> I’m curious why cr4_init() is not part of the following cpu_init()? IOW,
> why does it need to be called so early in the existing code?
>
The name cpu_init() is misleading. Most of the pinned features don't get
initialized in cpu_init(). They are set up slightly later:
start_secondary()
ap_starting()
identify_secondary_cpu()
identify_cpu()
The original reason for writing CR4 early on APs probably originates in
commit c7ad5ad297e6 ("x86/mm/64: Initialize CR4.PCIDE early"). Then,
when CR pinning was introduced, it was a global system-wide concept. So,
the pinned bits had to be programmed when the first write to CR4 happened.
>
>>
>> I _really_ think we need a defined per-cpu point where pinning comes
>> into effect. Marking the CPU online is one idea.
>>
>> Thoughts?
>
I think this approach could work. It should cover APs as well as hotplug
CPUs that come online later.
> It seems a good fit. Just that {on,off}line() are not called on BSP (not
> a real problem).
>
The BSP is marked online in boot_cpu_init()->set_cpu_online(). So, it
should be covered as well.
> Question is that who would work on it ;) ?
I think Dave already posted the patch for it here.
https://lore.kernel.org/lkml/02df7890-83c2-4047-8c88-46fbc6e0a892@intel.com/
I will test that out to confirm that it doesn't mess up some implicit
behavior.
next prev parent reply other threads:[~2026-02-09 7:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 18:50 [PATCH v1] x86/smp: Set up exception handling before cr4_init() Xin Li (Intel)
2026-02-06 19:19 ` Dave Hansen
2026-02-08 19:02 ` Xin Li
2026-02-09 7:28 ` Sohil Mehta [this message]
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
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=37de06e1-aae4-4ebd-ac93-1846ee4cd91e@intel.com \
--to=sohil.mehta@intel.com \
--cc=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--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=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