Re: [PATCH v5 04/22] x86/virt/seamldr: Introduce a wrapper for P-SEAMLDR SEAMCALLs

From: Chao Gao

Date: Mon Mar 16 2026 - 20:45:25 EST


>> +/*
>> + * Serialize P-SEAMLDR calls since the hardware only allows a single CPU to
>> + * interact with P-SEAMLDR simultaneously. Use raw version as the calls can
>> + * be made with interrupts disabled.
>
>Hm. I am not sure how it explains use of raw_spinlock. What's wrong with
>using plain spinlock with interrupts disabled?

We mustn't acquire sleeping lock with interrupts disabled. in RT kernel, a plain
spinlock becomes a sleeping lock.

The lock doc [*] states:
On PREEMPT_RT kernels, these lock types are converted to sleeping locks:
local_lock
spinlock_t
rwlock_t

*:https://docs.kernel.org/locking/locktypes.html

and also see the test I did:

https://lore.kernel.org/kvm/abPEit+Ckeqmypv+@xxxxxxxxx/

How about:

/*
* Serialize P-SEAMLDR calls since the hardware only allows a single CPU to
* interact with P-SEAMLDR simultaneously. Use raw version as the calls can
* be made with interrupts disabled, where plain spinlocks are prohibited in
* PREEMPT_RT kernels as they become sleeping locks.
*/