svn commit: r238765 - head/sys/dev/e1000

John Baldwin jhb at freebsd.org
Tue Jul 31 17:59:43 UTC 2012


On Tuesday, July 31, 2012 12:29:32 pm Garrett Cooper wrote:
> On Tue, Jul 31, 2012 at 9:20 AM, Jack Vogel <jfvogel at 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


More information about the svn-src-all mailing list