diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2021-07-20 16:32:29 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2021-07-20 16:32:29 +0000 |
commit | 24bf5c3ffd1adbd7a51ad9edb1d84baa48f6fed5 (patch) | |
tree | 6fa419c589299c49b0ab47de92f03960084ddf22 /sys/net/if.c | |
parent | 65a5ea6f7410296d99dd7eb035f29349058c0757 (diff) |
The current workaround to disable parallel IPsec did not work.
Variable nettaskqs must not change at runtime. Interface input
queues choose the thread during init with ifiq_softnet = net_tq().
So it cannot be modified after pfkeyv2_send() sets the first SA in
kernel. Also changing the calculation in net_tq() may call task_del()
with a different taskq than task_add().
Instead of restricting the index to the first softnet task, use an
exclusive lock. For now just move the comment. We can later decide
if a write net lock or kernel lock is better.
OK mvs@
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 91f544e0ed3..8fe99eff4df 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.642 2021/06/30 13:23:33 bluhm Exp $ */ +/* $OpenBSD: if.c,v 1.643 2021/07/20 16:32:28 bluhm Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -834,6 +834,12 @@ if_input_process(struct ifnet *ifp, struct mbuf_list *ml) * to PF globals, pipex globals, unicast and multicast addresses * lists and the socket layer. */ + + /* + * XXXSMP IPsec data structures are not ready to be accessed + * by multiple network threads in parallel. In this case + * use an exclusive lock. + */ NET_LOCK(); while ((m = ml_dequeue(ml)) != NULL) (*ifp->if_input)(ifp, m); @@ -3311,17 +3317,14 @@ unhandled_af(int af) panic("unhandled af %d", af); } -/* - * XXXSMP This tunable is here to work around the fact that IPsec - * globals aren't ready to be accessed by multiple threads in - * parallel. - */ -int nettaskqs = NET_TASKQ; - struct taskq * net_tq(unsigned int ifindex) { struct taskq *t = NULL; + static int nettaskqs; + + if (nettaskqs == 0) + nettaskqs = min(NET_TASKQ, ncpus); t = nettqmp[ifindex % nettaskqs]; |