From owner-freebsd-current Tue Mar 5 7:53: 5 2002 Delivered-To: freebsd-current@freebsd.org Received: from mail12.speakeasy.net (mail12.speakeasy.net [216.254.0.212]) by hub.freebsd.org (Postfix) with ESMTP id 7659337B421 for ; Tue, 5 Mar 2002 07:52:16 -0800 (PST) Received: (qmail 15890 invoked from network); 5 Mar 2002 15:52:10 -0000 Received: from unknown (HELO server.baldwin.cx) ([65.91.137.49]) (envelope-sender ) by mail12.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 5 Mar 2002 15:52:10 -0000 Received: from laptop.baldwin.cx (john@laptop.baldwin.cx [192.168.0.4]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g25Fq3G57130; Tue, 5 Mar 2002 10:52:03 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <3C827021.A7FA73A4@verizon.net> Date: Tue, 05 Mar 2002 10:51:51 -0500 (EST) From: John Baldwin To: Maksim Yevmenkin Subject: RE: Netgraph, device drivers and mutexes Cc: freebsd-current@freebsd.org Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 03-Mar-02 Maksim Yevmenkin wrote: > the same locking questions goes for the other Netgraph > nodes that connected to the driver node. i want very > simple locks to do the following: > > 1) handle timeouts with timeout(9)/untimeout(9) - > my _biggest_ concern. all i could find in -current is > everyone use splXXX/splx :( is it broken on SMP? > > 2) modify node's internal data structure in a safe way. > i'm talking about things like linked lists, queues > etc. > > since splXXX(9) functions are no longer relevant in > -current (please correct me if i wrong), i was looking > at mutex(9). i have noticed several device drivers that > also use Netgraph (if_ar, if_sr, if_lmc and udbp), and > they use MTX_DEF mutexes and splXXX(9) functions. is that > OK with Netgraph? the man page says that MTX_DEF mutexes > _will_ context switch when they are already held. For now, I would not use any mutexes in your device driver code. The network stack hasn't been locked so we still don't know what actual locks will be needed in the device drivers themselves. Netgraph has some custom reader/writer locks that you may need to interface with. Julian should be able to help you with that. > can/should i use MTX_SPIN mutexes? i have tried to use > them, but WITNESS code gets very upset (panic) unless i > modify "order_lists" in kern/subr_wintess.c. i would > rather not do it, since i'm not fully aware of what's > going on. For now, avoid MTX_SPIN mutexes unless you have a fast interrupt handler (INTR_FAST) (which you probably don't). -- 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-current" in the body of the message