Re: [PATCH v10 2/6] x86/sev: Initialize RMPOPT configuration MSRs

"Kalra, Ashish" <[email protected]> Thu, 23 Jul 2026 08:24:56 -0500
Newsgroups dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-crypto,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 7/23/2026 1:50 AM, Kalra, Ashish wrote:
> Hello Boris,
> 
> On 7/23/2026 12:14 AM, Borislav Petkov wrote:
>> On Thu, Jul 23, 2026 at 10:23:56AM +0530, K Prateek Nayak wrote:
>>> The offline cores will remain offline since hotplug is disabled. RMPOPT
>>> is simply a performance optimization for RMP checks and leaving the
>>> offline cores (that will never exit idle) unoptimized should be
>>> acceptable.
>>
>> What happens if you boot with a subset of cores, the boot flow enables RMPOPT
>> and then you online the rest?
>>
>> Have we tried that?
>>
> 
>  It can't happen here. snp_prepare() does the following, in order:
> 
>   1. cpu_hotplug_disable() — freeze the CPU set.
>   2. fail SNP init (-EOPNOTSUPP) unless every present CPU is online (cpumask_equal(cpu_online_mask, cpu_present_mask).
>   3. enable SNP.
> 
>   snp_setup_rmpopt() runs only after snp_prepare() succeeds, so all present CPUs are online and stay online (hotplug is
>   disabled). No core's primary thread can be offline at this point.
> 
>   (The kexec path is the one exception — snp_prepare() returns early there — which I'm handling in the other thread.)
> 
>   Thanks,
>   Ashish
> 

Additionally for kexec considerations: on RMPOPT-capable platforms kexec clears SnpEn (full SNP_SHUTDOWN_EX, x86_snp_shutdown=1),
so snp_prepare() re-runs its cpumask_equal() all-online check on the kexec boot exactly as on a normal boot.

So no kexec-specific case where RMPOPT gets set up with a partial CPU set.

Thanks,
Ashish