From owner-freebsd-hackers Thu May 2 7: 1:22 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.speakeasy.net (mail14.speakeasy.net [216.254.0.214]) by hub.freebsd.org (Postfix) with ESMTP id 70D6537B417 for ; Thu, 2 May 2002 07:01:17 -0700 (PDT) Received: (qmail 10902 invoked from network); 2 May 2002 14:01:15 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail14.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 2 May 2002 14:01:15 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g42E1EF07536; Thu, 2 May 2002 10:01:14 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20020501161502.GF98487@elvis.mu.org> Date: Thu, 02 May 2002 10:00:16 -0400 (EDT) From: John Baldwin To: Alfred Perlstein Subject: Re: Kernel spin lock facilities Cc: "freebsd-hackers@freebsd.org" Cc: "freebsd-hackers@freebsd.org" , "Nelson, Trent ." Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 01-May-2002 Alfred Perlstein wrote: > * Nelson, Trent . [020501 06:41] wrote: >> Hi, >> >> I'm working on porting the Linux Cisco VPN client kernel module to >> FreeBSD. The API interface between the OS and their actual driver has four >> spinlock functions that operate around a handle (void *) to a ``critical >> section'': >> >> CNI_free_spin_lock >> CNI_new_spin_lock >> CNI_spin_lock >> CNI_spin_unlock >> >> Funnily enough, these wrap the Linux spinlock_t/spin_lock*() >> functionality quite nicely. Does the FreeBSD kernel offer such a trivial >> spinlock facility? If not, could anyone suggest what type of locking >> mechanism would best be used? > > man 9 mutex, see the MTX_SPIN section, but you might not need it. Actually, a normal mutex would probably be best. On stable these would be nops. On current I would use a MTX_DEF mutex. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message