Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net pfil(9): Assert pfil lists are not run in interrupt ...



details:   https://anonhg.NetBSD.org/src/rev/ba9566829a61
branches:  trunk
changeset: 366179:ba9566829a61
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue May 17 10:28:08 2022 +0000

description:
pfil(9): Assert pfil lists are not run in interrupt context.

All the paths leading to this should have been dispensed with by now.
The network stack runs in thread or softint context these days; hard
interrupt context is used only to put packets on queues deferred to
softint.

diffstat:

 sys/net/pfil.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r db61284f795b -r ba9566829a61 sys/net/pfil.c
--- a/sys/net/pfil.c    Tue May 17 10:27:37 2022 +0000
+++ b/sys/net/pfil.c    Tue May 17 10:28:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pfil.c,v 1.40 2022/05/17 10:27:37 riastradh Exp $      */
+/*     $NetBSD: pfil.c,v 1.41 2022/05/17 10:28:08 riastradh Exp $      */
 
 /*
  * Copyright (c) 2013 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.40 2022/05/17 10:27:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.41 2022/05/17 10:28:08 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_net_mpsafe.h"
@@ -39,6 +39,7 @@
 #include <sys/queue.h>
 #include <sys/kmem.h>
 #include <sys/psref.h>
+#include <sys/cpu.h>
 
 #include <net/if.h>
 #include <net/pfil.h>
@@ -411,6 +412,7 @@
        int ret = 0;
 
        KASSERT(dir == PFIL_IN || dir == PFIL_OUT);
+       KASSERT(!cpu_intr_p());
 
        if (ph == NULL) {
                return ret;
@@ -449,6 +451,8 @@
        struct psref psref;
        int s, bound;
 
+       KASSERT(!cpu_intr_p());
+
        bound = curlwp_bind();
        s = pserialize_read_enter();
        phlist = atomic_load_consume(&phlistset->active);



Home | Main Index | Thread Index | Old Index