From 12a5bb547f3b6aa4f1b452357dd8f0fb93b09e01 Mon Sep 17 00:00:00 2001 From: yamaguchi Date: Tue, 25 Feb 2020 07:05:57 +0000 Subject: [PATCH] Remove WQ_PERCPU flag for the workqueue that does configurations such as link up and down And added kpreempt_disable and kpreempt_enable around workqueue_enqueue to call it in non-WQ_PERCPU thread context. pointed out and reviewed by knakahara@n.o., thanks. --- sys/dev/pci/if_ixl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/if_ixl.c b/sys/dev/pci/if_ixl.c index ddd850ba9d16..edab7c5b3980 100644 --- a/sys/dev/pci/if_ixl.c +++ b/sys/dev/pci/if_ixl.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.43 2020/02/25 07:00:26 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.44 2020/02/25 07:05:57 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.43 2020/02/25 07:00:26 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.44 2020/02/25 07:05:57 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -1341,7 +1341,7 @@ ixl_attach(device_t parent, device_t self, void *aux) snprintf(xnamebuf, sizeof(xnamebuf), "%s_wq_cfg", device_xname(self)); sc->sc_workq = ixl_workq_create(xnamebuf, IXL_WORKQUEUE_PRI, - IPL_NET, WQ_PERCPU | WQ_MPSAFE); + IPL_NET, WQ_MPSAFE); if (sc->sc_workq == NULL) goto teardown_sysctls; @@ -6642,7 +6642,9 @@ ixl_work_add(struct workqueue *wq, struct ixl_work *work) if (atomic_cas_uint(&work->ixw_added, 0, 1) != 0) return; + kpreempt_disable(); workqueue_enqueue(wq, &work->ixw_cookie, NULL); + kpreempt_enable(); } static void