OFED spinlocks

Hans Petter Selasky hps at selasky.org
Fri Mar 3 16:38:08 UTC 2017


On 03/03/17 17:34, Vijay Singh wrote:
> I am looking at sys/ofed/include/linux/spinlock.h in 10.3:
>
> static inline void
> spin_lock_init(spinlock_t *lock)
> {
>
>         memset(&lock->m, 0, sizeof(lock->m));
>         mtx_init(&lock->m, "lnxspin", NULL, MTX_DEF | MTX_NOWITNESS);
> }
>
> #define DEFINE_SPINLOCK(lock)                                           \
>         spinlock_t lock;                                                \
>         MTX_SYSINIT(lock, &(lock).m, "lnxspin", MTX_DEF)
>
> If this a spin lock, why do we use MTX_DEF? What am I missing.

Hi,

OFED lifts everything with spinlocks in Linux to the FreeBSD mutex 
domain. This has been done, because several other kernel APIs in FreeBSD 
are implemented using mutexes and cannot be used when real spinlocks are 
locked. This is done throughout OFED/LinuxKPI and it should not affect 
any applications.

--HPS



More information about the freebsd-infiniband mailing list