Transitioning if_addr_lock to an rwlock

John Baldwin jhb at freebsd.org
Wed Jan 4 15:49:58 UTC 2012


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


More information about the freebsd-net mailing list