Re: [PATCH v2 2/7] x86/sev: add support for enabling RMPOPT

From: Dave Hansen

Date: Mon Mar 02 2026 - 18:22:16 EST


On 3/2/26 14:55, Kalra, Ashish wrote:
>> What's wrong with:
>>
>> u64 rmpopt_base = pa_start | MSR_AMD64_RMPOPT_ENABLE;
>> ...
>> for_each_online_cpu(cpu)
>> wrmsrq_on_cpu(cpu, MSR_AMD64_RMPOPT_BASE, rmpopt_base);
>>
>> Then there's at least no ugly casting.
>>
> RMOPT_BASE MSRs don't need to be set serially, therefore, by
> using the cpu_online_mask and on_each_cpu_mask(), we can setup the MSRs
> concurrently and in parallel. Using for_each_online_cpu() will be slower than
> doing on_each_cpu_mask() as it doesn't send IPIs in parallel, right.

If that's the case and you *need* performance, then please go add a
wrmsrq_on_cpumask() function to do things in parallel.