diff options
author | Matt Macy <mmacy@FreeBSD.org> | 2018-05-18 17:29:43 +0000 |
---|---|---|
committer | Matt Macy <mmacy@FreeBSD.org> | 2018-05-18 17:29:43 +0000 |
commit | 70398c2f86e2fbc2120b4a11d9ec9284a6a395f5 (patch) | |
tree | 626ec536b75742cbb2513aab5f55a4e32ca4dbe3 /sys/net | |
parent | 1696e1f2b8ffc9bef101abbbfb7e880b195ac686 (diff) | |
download | src-70398c2f86e2fbc2120b4a11d9ec9284a6a395f5.tar.gz src-70398c2f86e2fbc2120b4a11d9ec9284a6a395f5.zip |
epoch(9): Make epochs non-preemptible by default
There are risks associated with waiting on a preemptible epoch section.
Change the name to make them not be the default and document the issue
under CAVEATS.
Reported by: markj
Notes
Notes:
svn path=/head/; revision=333802
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 2 | ||||
-rw-r--r-- | sys/net/if_lagg.c | 6 | ||||
-rw-r--r-- | sys/net/if_var.h | 1 |
3 files changed, 6 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index cc3ffa63da6e..348495f612fb 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -104,6 +104,7 @@ _Static_assert(sizeof(((struct ifreq *)0)->ifr_name) == offsetof(struct ifreq, ifr_ifru), "gap between ifr_name and ifr_ifru"); +epoch_t net_epoch_preempt; epoch_t net_epoch; #ifdef COMPAT_FREEBSD32 #include <sys/mount.h> @@ -903,6 +904,7 @@ if_attachdomain(void *dummy) { struct ifnet *ifp; + net_epoch_preempt = epoch_alloc(EPOCH_PREEMPT); net_epoch = epoch_alloc(0); TAILQ_FOREACH(ifp, &V_ifnet, if_link) if_attachdomain1(ifp); diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 30f568a8033d..851337835996 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -73,8 +73,8 @@ __FBSDID("$FreeBSD$"); #include <net/if_lagg.h> #include <net/ieee8023ad_lacp.h> -#define LAGG_RLOCK() epoch_enter(net_epoch) -#define LAGG_RUNLOCK() epoch_exit(net_epoch) +#define LAGG_RLOCK() epoch_enter_preempt(net_epoch_preempt) +#define LAGG_RUNLOCK() epoch_exit_preempt(net_epoch_preempt) #define LAGG_RLOCK_ASSERT() MPASS(in_epoch()) #define LAGG_UNLOCK_ASSERT() MPASS(!in_epoch()) @@ -859,7 +859,7 @@ lagg_port_destroy(struct lagg_port *lp, int rundelport) * free port and release it's ifnet reference after a grace period has * elapsed. */ - epoch_call(net_epoch, &lp->lp_epoch_ctx, lagg_port_destroy_cb); + epoch_call(net_epoch_preempt, &lp->lp_epoch_ctx, lagg_port_destroy_cb); /* Update lagg capabilities */ lagg_capabilities(sc); lagg_linkstate(sc); diff --git a/sys/net/if_var.h b/sys/net/if_var.h index adfadead633b..4a65ca7d7b2f 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -106,6 +106,7 @@ VNET_DECLARE(struct hhook_head *, ipsec_hhh_in[HHOOK_IPSEC_COUNT]); VNET_DECLARE(struct hhook_head *, ipsec_hhh_out[HHOOK_IPSEC_COUNT]); #define V_ipsec_hhh_in VNET(ipsec_hhh_in) #define V_ipsec_hhh_out VNET(ipsec_hhh_out) +extern epoch_t net_epoch_preempt; extern epoch_t net_epoch; #endif /* _KERNEL */ |