Date: Fri, 3 Mar 2017 17:37:19 +0100 From: Hans Petter Selasky <hps@selasky.org> To: Vijay Singh <vijju.singh@gmail.com>, "freebsd-infiniband@freebsd.org" <freebsd-infiniband@freebsd.org> Subject: Re: OFED spinlocks Message-ID: <5c38ad75-b6f1-41af-8d24-95dc3bd81a36@selasky.org> In-Reply-To: <CALCNsJQ6GiMdRa=kZFO=R8FnL5av4OXBgef7ypUcdrZ5wCUBeQ@mail.gmail.com> References: <CALCNsJQ6GiMdRa=kZFO=R8FnL5av4OXBgef7ypUcdrZ5wCUBeQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5c38ad75-b6f1-41af-8d24-95dc3bd81a36>