Re: [PATCH v5 09/22] x86/virt/seamldr: Introduce skeleton for TDX module updates

From: Chao Gao

Date: Fri Mar 20 2026 - 04:20:35 EST


>> +static struct {
>> + enum module_update_state state;
>> + int thread_ack;
>> + /*
>> + * Protect update_data. Raw spinlock as it will be acquired from
>> + * interrupt-disabled contexts.
>> + */
>> + raw_spinlock_t lock;
>> +} update_data = {
>> + .lock = __RAW_SPIN_LOCK_UNLOCKED(update_data.lock)
>> +};
>
>multi_stop_cpu() used atomic_t for thread_ack insead of spinlock.
>Any particular reason you took different direction?

I switched from atomic_t to spinlock in v5 after Dave complained [*] that using
atomic_t and memory barriers is "overly complicated".

Testing both approaches showed no scalability issues, so I chose spinlock for
better readability.

*: https://lore.kernel.org/kvm/abP%2F2nPh9qkElV4L@xxxxxxxxx/