From owner-freebsd-net@FreeBSD.ORG Wed Jan 4 15:49:58 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 A29C31065675; Wed, 4 Jan 2012 15:49:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 77BD68FC14; Wed, 4 Jan 2012 15:49:58 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 3044846B0D; Wed, 4 Jan 2012 10:49:58 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B5384B924; Wed, 4 Jan 2012 10:49:57 -0500 (EST) From: John Baldwin To: "Bjoern A. Zeeb" Date: Wed, 4 Jan 2012 10:49:57 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201112221130.01823.jhb@freebsd.org> <76A806B1-6D12-46DD-BC9D-F3CBDC587330@FreeBSD.org> <21AEF92A-94B5-4115-91A7-D3BEEFDAB433@FreeBSD.org> In-Reply-To: <21AEF92A-94B5-4115-91A7-D3BEEFDAB433@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201201041049.57187.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 04 Jan 2012 10:49:57 -0500 (EST) Cc: FreeBSD Net , Robert Watson Subject: Re: Transitioning if_addr_lock to an rwlock 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: Wed, 04 Jan 2012 15:49:58 -0000 On Wednesday, January 04, 2012 7:45:26 am Bjoern A. Zeeb wrote: > > On 3. Jan 2012, at 22:19 , Bjoern A. Zeeb wrote: > > > On 29. Dec 2011, at 20:27 , John Baldwin wrote: > >> I've gone ahead with this approach. I have three separate patches that should > >> implement Phase 1. All of them can be found at > >> http://www.FreeBSD.org/~jhb/patches/ > >> > >> - if_addr_dev.patch This fixes a few new device drivers that were using > >> the locking macros directly rather than the wrapper > >> functions Robert added. I've already sent this > >> directly to the relevant driver maintainers for their > >> review. > >> - if_addr_macros.patch This adds new locking macros to support read locks vs > >> write locks. However, they all still map to mutex > >> operations. > > > > The first two look good. I wondered why you didn't need the r-wraper-functions > > but obviously they had been named like that already:) > > > > > > I'll look at the one below in more detail and get back to you. > > > >> - if_addr_uses.patch This changes callers of the existing macros to use > >> either read or write locks. This is the patch that > >> could use the most review. > > I went through this one as well. > > I skipped mld6.c, in6.c, igmp.c and in.c as they need to be regenerated. > in nd6_rtr.c/prelist_update I think we are lacking an ifa_ref() dance > currently but that's unrelated. The other conversions to R/W locking > seemed ok. if_addr_uses.patch is now updated. I think prelist_update is fine because i doesn't actually use the memory referenced by the one pointer it uses after dropping the IF_ADDR_LOCK. It merely checks it against NULL to see if it found anything useful. For that case no reference count is needed. -- John Baldwin