Module Name:    src
Committed By:   yamaguchi
Date:           Thu Mar 31 06:21:41 UTC 2022

Modified Files:
        src/sys/dev/pci: if_ixl.c

Log Message:
Use xc_barrier to wait for finish of the interrupt handler

poited out by riastradh@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pci/if_ixl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.80 src/sys/dev/pci/if_ixl.c:1.81
--- src/sys/dev/pci/if_ixl.c:1.80	Thu Mar 31 06:20:14 2022
+++ src/sys/dev/pci/if_ixl.c	Thu Mar 31 06:21:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.80 2022/03/31 06:20:14 yamaguchi Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.81 2022/03/31 06:21:41 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.80 2022/03/31 06:20:14 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.81 2022/03/31 06:21:41 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -95,6 +95,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1
 #include <sys/pcq.h>
 #include <sys/syslog.h>
 #include <sys/workqueue.h>
+#include <sys/xcall.h>
 
 #include <sys/bus.h>
 
@@ -989,6 +990,14 @@ ixl_lookup(const struct pci_attach_args 
 	return NULL;
 }
 
+static void
+ixl_intr_barrier(void)
+{
+
+	/* wait for finish of all handler */
+	xc_barrier(0);
+}
+
 static int
 ixl_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -1447,14 +1456,11 @@ ixl_detach(device_t self, int flags)
 	ixl_stop(ifp, 1);
 
 	ixl_disable_other_intr(sc);
+	ixl_intr_barrier();
 
 	callout_halt(&sc->sc_stats_callout, NULL);
 	ixl_work_wait(sc->sc_workq, &sc->sc_stats_task);
 
-	/* wait for ATQ handler */
-	mutex_enter(&sc->sc_atq_lock);
-	mutex_exit(&sc->sc_atq_lock);
-
 	ixl_work_wait(sc->sc_workq, &sc->sc_arq_task);
 	ixl_work_wait(sc->sc_workq, &sc->sc_link_state_task);
 

Reply via email to