Date: Tue, 15 Jan 2019 06:18:50 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 219846] [panic] [kevent] mutex nm_kn_lock not owned, netmap with INVARIANTS+WITNESS Message-ID: <bug-219846-227-4bJJeoijkT@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-219846-227@https.bugs.freebsd.org/bugzilla/> References: <bug-219846-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D219846 --- Comment #6 from Aleksandr Fedorov <aleksandr.fedorov@itglobal.com> --- This patch fix the panic: Index: sys/dev/netmap/netmap_freebsd.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-219846-227-4bJJeoijkT>