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

Borislav Petkov <[email protected]> Thu, 23 Jul 2026 11:32:02 -0700
Newsgroups dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-crypto,org.kernel.vger.linux-kernel
Message-ID <20260723183202.GAamJeIr1Cey5clsfE@fat_crate.local>
On Thu, Jul 23, 2026 at 01:50:48AM -0500, Kalra, Ashish wrote:
> > 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:

Then the comment in the code is greatly misleading:

        /*
         * The RMPOPT_BASE MSR is per-core, so only one thread per core needs
         * to set up the RMPOPT_BASE MSR.
         * 
         * Note: only online primary threads are included.  If a core's
         * primary thread is offline, that core is not covered.  CPU hotplug
         * is not currently supported with SNP enabled.
         */     
        scoped_guard(cpus_read_lock) {
                for_each_online_cpu(cpu)
                        if (topology_is_primary_thread(cpu))

I'd expect to read there:

        /*
         * The RMPOPT_BASE MSR is per-core, so only one thread per core needs
         * to set up the RMPOPT_BASE MSR. All primary threads are online,
	 * otherwise SNP would not have been enabled.
         */

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette