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

From: Kiryl Shutsemau

Date: Tue Mar 17 2026 - 06:00:00 EST


On Tue, Mar 17, 2026 at 08:43:31AM +0800, Chao Gao wrote:
> >> +/*
> >> + * 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.
> */

Looks better. Thanks for the explanation.

Reviewed-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>

--
Kiryl Shutsemau / Kirill A. Shutemov