Re: [PATCH v9 3/6] x86/sev: Disable CPU hotplug while SNP is active
From: Kalra, Ashish
Date: Sun Jun 28 2026 - 23:12:26 EST
On 6/28/2026 10:05 PM, K Prateek Nayak wrote:
> Hello Boris,
>
> On 6/27/2026 10:11 AM, Borislav Petkov wrote:
>> You could also block hotplug for the time being by grabbing cpus_read_lock().
>> And only when you know you are all clear to disable hotplug, then you can do
>> that in the end and drop the hotplug lock.
>
> This is bad idea because it'll stall the tasks trying to do a hotplug
> until the last SNP VM exits. Instead of simply getting an -EBUSY, the
> users will start seeing a hung task splats in dmesg.
>
> Also, since the last VM has to re-enable hotplug, you'll need a
> up_read_non_owner() variant for cpus_read_unlock() to unlock the rwsem
> from a different thread compared to the one that locks.
>
> I think cpu_hotplug_disable() is the correct way to go forward but if
> you are not a fan of the global "snp_cpu_hotplug_disabled" flag, maybe
> it can be turned into an indicator like "snp_initialized" in
> "struct sev_device". Thoughts?
>
As i mentioned in my previous reply, i have already removed the global
"snp_cpu_hotplug_disabled", the new implementation is flag-free, and
does hotplug disable/enable by following the SNP_EN state.
Thanks,
Ashish