Source-Changes-HG archive

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

[src/trunk]: src/sys/net Don't falsely assert cpu_softintr_p().



details:   https://anonhg.NetBSD.org/src/rev/9db096b87423
branches:  trunk
changeset: 975038:9db096b87423
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Aug 20 21:31:16 2020 +0000

description:
Don't falsely assert cpu_softintr_p().

Will fail in the following stack trace:

wg_worker (kthread)
wg_receive_packets
wg_handle_packet
wg_handle_msg_data
KASSERT(cpu_softintr_p())

Instead, use kpreempt_disable/enable around softint_schedule.

XXX Not clear that softint is the right place to do this!

diffstat:

 sys/net/if_wg.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r ed275061e3d0 -r 9db096b87423 sys/net/if_wg.c
--- a/sys/net/if_wg.c   Thu Aug 20 21:31:06 2020 +0000
+++ b/sys/net/if_wg.c   Thu Aug 20 21:31:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wg.c,v 1.4 2020/08/20 21:31:06 riastradh Exp $      */
+/*     $NetBSD: if_wg.c,v 1.5 2020/08/20 21:31:16 riastradh Exp $      */
 
 /*
  * Copyright (C) Ryota Ozaki <ozaki.ryota%gmail.com@localhost>
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.4 2020/08/20 21:31:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.5 2020/08/20 21:31:16 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2351,8 +2351,9 @@
                mutex_exit(wgs_prev->wgs_lock);
 
                /* Anyway run a softint to flush pending packets */
-               KASSERT(cpu_softintr_p());
+               kpreempt_disable();
                softint_schedule(wgp->wgp_si);
+               kpreempt_enable();
        } else {
                if (__predict_false(wg_need_to_send_init_message(wgs))) {
                        wg_schedule_peer_task(wgp, WGP_TASK_SEND_INIT_MESSAGE);



Home | Main Index | Thread Index | Old Index