Date: Wed, 25 Nov 2020 10:56:38 +0000 (UTC) From: Kristof Provost <kp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368015 - head/sys/net Message-ID: <202011251056.0APAucDm066214@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kp Date: Wed Nov 25 10:56:38 2020 New Revision: 368015 URL: https://svnweb.freebsd.org/changeset/base/368015 Log: if: Remove ifnet_rwlock It no longer serves any purpose, as evidenced by the fact that we never take it without ifnet_sxlock. Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D27278 Modified: head/sys/net/if.c head/sys/net/if_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed Nov 25 10:21:29 2020 (r368014) +++ head/sys/net/if.c Wed Nov 25 10:56:38 2020 (r368015) @@ -306,15 +306,9 @@ VNET_DEFINE(struct ifnet **, ifindex_table); /* * The global network interface list (V_ifnet) and related state (such as - * if_index, if_indexlim, and ifindex_table) are protected by an sxlock and - * an rwlock. Either may be acquired shared to stablize the list, but both - * must be acquired writable to modify the list. This model allows us to - * both stablize the interface list during interrupt thread processing, but - * also to stablize it over long-running ioctls, without introducing priority - * inversions and deadlocks. + * if_index, if_indexlim, and ifindex_table) are protected by an sxlock. + * This may be acquired to stabilise the list, or we may rely on NET_EPOCH. */ -struct rwlock ifnet_rwlock; -RW_SYSINIT_FLAGS(ifnet_rw, &ifnet_rwlock, "ifnet_rw", RW_RECURSE); struct sx ifnet_sxlock; SX_SYSINIT_FLAGS(ifnet_sx, &ifnet_sxlock, "ifnet_sx", SX_RECURSE); Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Wed Nov 25 10:21:29 2020 (r368014) +++ head/sys/net/if_var.h Wed Nov 25 10:56:38 2020 (r368015) @@ -593,29 +593,12 @@ struct ifmultiaddr { struct epoch_context ifma_epoch_ctx; }; -extern struct rwlock ifnet_rwlock; extern struct sx ifnet_sxlock; -#define IFNET_WLOCK() do { \ - sx_xlock(&ifnet_sxlock); \ - rw_wlock(&ifnet_rwlock); \ -} while (0) - -#define IFNET_WUNLOCK() do { \ - rw_wunlock(&ifnet_rwlock); \ - sx_xunlock(&ifnet_sxlock); \ -} while (0) - -/* - * To assert the ifnet lock, you must know not only whether it's for read or - * write, but also whether it was acquired with sleep support or not. - */ -#define IFNET_RLOCK_ASSERT() sx_assert(&ifnet_sxlock, SA_SLOCKED) -#define IFNET_WLOCK_ASSERT() do { \ - sx_assert(&ifnet_sxlock, SA_XLOCKED); \ - rw_assert(&ifnet_rwlock, RA_WLOCKED); \ -} while (0) - +#define IFNET_WLOCK() sx_xlock(&ifnet_sxlock) +#define IFNET_WUNLOCK() sx_xunlock(&ifnet_sxlock) +#define IFNET_RLOCK_ASSERT() sx_assert(&ifnet_sxlock, SA_SLOCKED) +#define IFNET_WLOCK_ASSERT() sx_assert(&ifnet_sxlock, SA_XLOCKED) #define IFNET_RLOCK() sx_slock(&ifnet_sxlock) #define IFNET_RUNLOCK() sx_sunlock(&ifnet_sxlock)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011251056.0APAucDm066214>