[Bug 219846] [panic] [kevent] mutex nm_kn_lock not owned, netmap with INVARIANTS+WITNESS
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Jan 15 06:18:53 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219846
--- Comment #6 from Aleksandr Fedorov <aleksandr.fedorov at itglobal.com> ---
This patch fix the panic:
Index: sys/dev/netmap/netmap_freebsd.c
===================================================================
--- sys/dev/netmap/netmap_freebsd.c (revision 342550)
+++ sys/dev/netmap/netmap_freebsd.c (working copy)
@@ -1321,7 +1321,12 @@
/* use a non-zero hint to tell the notification from the
* call done in kqueue_scan() which uses 0
*/
- KNOTE_UNLOCKED(&si->si.si_note, 0x100 /* notification */);
+
+ if (mtx_owned(&si->m)) {
+ KNOTE_LOCKED(&si->si.si_note, 0x100 /* notification */);
+ } else {
+ KNOTE_UNLOCKED(&si->si.si_note, 0x100 /* notification */);
+ }
}
void
It seems there are several paths to call the function nm_os_selwakeup():
Trace from bhyve:
dtrace: script './nm_os_selwakeup.d' matched 1 probe
CPU ID FUNCTION:NAME
18 39521 nm_os_selwakeup:entry
kernel`netmap_notify+0x1d
kernel`nm_vale_flush+0xb70
kernel`netmap_vale_vp_txsync+0x51d
kernel`netmap_ioctl+0x4e1
kernel`freebsd_netmap_ioctl+0x88
kernel`devfs_ioctl+0xca
kernel`VOP_IOCTL_APV+0x63
kernel`vn_ioctl+0x124
kernel`devfs_ioctl_f+0x1f
kernel`kern_ioctl+0x29b
kernel`sys_ioctl+0x15d
kernel`amd64_syscall+0x276
kernel`0xffffffff8107a81d
20 39521 nm_os_selwakeup:entry
kernel`netmap_notify+0x1d
kernel`netmap_poll+0x5e6
kernel`netmap_knrw+0x6f
kernel`kqueue_kevent+0x56d
kernel`kern_kevent_fp+0x97
kernel`kern_kevent+0x9f
kernel`kern_kevent_generic+0x70
kernel`sys_kevent+0x61
kernel`amd64_syscall+0x276
kernel`0xffffffff8107a81d
The first does not hold the mutex ("nm_kn_lock"), the second does.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list