From owner-freebsd-net@FreeBSD.ORG Tue Jan 24 14:53:12 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F42F106566B for ; Tue, 24 Jan 2012 14:53:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id A5DA38FC1C for ; Tue, 24 Jan 2012 14:53:11 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q0OErAjq048699; Tue, 24 Jan 2012 18:53:10 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q0OErAJA048698; Tue, 24 Jan 2012 18:53:10 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 24 Jan 2012 18:53:10 +0400 From: Gleb Smirnoff To: rozhuk.im@gmail.com Message-ID: <20120124145310.GC48157@FreeBSD.org> References: <4f1dcc8e.45c8cc0a.2935.2254@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <4f1dcc8e.45c8cc0a.2935.2254@mx.google.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-net@FreeBSD.org Subject: Re: ng_bridge and locks X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2012 14:53:12 -0000 On Tue, Jan 24, 2012 at 06:09:30AM +0900, rozhuk.im@gmail.com wrote: r> I found a comment in the code: r> /* r> * This node has all kinds of stuff that could be screwed by SMP. r> * Until it gets it's own internal protection, we go through in r> * single file. This could hurt a machine bridging beteen two r> * GB ethernets so it should be fixed. r> * When it's fixed the process SHOULD NOT SLEEP, spinlocks please! r> * (and atomic ops ) r> */ r> r> mtx_init(...., MTX_DEF); r> How bad to use netgraph node MTX_DEF mutex? It would be correct to use MTX_DEF mutex to lock the ng_bridge node. You need smth like a mutex per hash entry, and if all done correctly, then you can remove NG_NODE_FORCE_WRITER(). -- Totus tuus, Glebius.