Date: Tue, 31 Jul 2012 13:43:31 -0400 From: John Baldwin <jhb@freebsd.org> To: Garrett Cooper <yanegomi@gmail.com> Cc: Adrian Chadd <adrian@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, Andrey Zonov <andrey@zonov.org>, Luigi Rizzo <luigi@freebsd.org>, Jack Vogel <jfvogel@gmail.com>, svn-src-head@freebsd.org Subject: Re: svn commit: r238765 - head/sys/dev/e1000 Message-ID: <201207311343.31777.jhb@freebsd.org> In-Reply-To: <CAGH67wQGddoNHwQmNrw0J3YspCvn33rWVKzezoi48_9YH%2B9E3A@mail.gmail.com> References: <201207251128.q6PBSFlt052575@svn.freebsd.org> <CAFOYbck2f5%2B6-8ObjERKEdUo%2Bpw3bx4tqxO1SxngNwuDDC6PLA@mail.gmail.com> <CAGH67wQGddoNHwQmNrw0J3YspCvn33rWVKzezoi48_9YH%2B9E3A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, July 31, 2012 12:29:32 pm Garrett Cooper wrote: > On Tue, Jul 31, 2012 at 9:20 AM, Jack Vogel <jfvogel@gmail.com> wrote: > > Yes, I agree John, that was ugly, I'm already taking care of it with my > > changes, > > I'll send you a copy to check out. > > Like so: > > --- //depot/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c > 2012-07-25 17:11:00.000000000 0000 > +++ /scratch/p4/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c > 2012-07-25 17:11:00.000000000 0000 > @@ -1320,9 +1320,10 @@ > lem_local_timer, adapter); > goto out; > } > + EM_CORE_UNLOCK(adapter); > > + lem_rxeof(adapter, -1, NULL); > EM_TX_LOCK(adapter); > - lem_rxeof(adapter, -1, NULL); > lem_txeof(adapter); > if (ifp->if_drv_flags & IFF_DRV_RUNNING && > !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) > @@ -1330,8 +1331,8 @@ > EM_TX_UNLOCK(adapter); > > out: > - EM_CORE_UNLOCK(adapter); > - return; > + if (mtx_owned(&adapter->core_mtx)) > + EM_CORE_UNLOCK(adapter); > } No, mtx_owned() is equally bad (I'd rather people be intentional about what locks they hold when, mtx_owned() allows people to be lazy IMO). Just do this: EM_TX_UNLOCK(adapter); return; out: EM_CORE_UNLOCK(adapter); } -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207311343.31777.jhb>