From owner-freebsd-infiniband@freebsd.org Fri Mar 3 16:38:08 2017 Return-Path: Delivered-To: freebsd-infiniband@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8D55CF69F5 for ; Fri, 3 Mar 2017 16:38:08 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84D3E1D1B for ; Fri, 3 Mar 2017 16:38:08 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 4B07A1FE025; Fri, 3 Mar 2017 17:37:41 +0100 (CET) Subject: Re: OFED spinlocks To: Vijay Singh , "freebsd-infiniband@freebsd.org" References: From: Hans Petter Selasky Message-ID: <5c38ad75-b6f1-41af-8d24-95dc3bd81a36@selasky.org> Date: Fri, 3 Mar 2017 17:37:19 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-infiniband@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Infiniband on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Mar 2017 16:38:08 -0000 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