On 06/07/17(Thu) 21:18, Juan Francisco Cantero Hurtado wrote: > On Thu, Jul 06, 2017 at 08:29:39AM -0600, Aaron Bieber wrote: > > Hola, > > > > For roughly a week I have been able to reliably produce panics on > > amd64 (virtual machine and physical machine) using disk IO heavy > > applications (gitea, syncthing). > > > > Unfortunately on the physical machine - the one I can reliably panic > > within < 1 minute - I don't have a serial console, so here are links > > to photos: > > > > https://goo.gl/photos/Z8g225UXXpCXQpGcA > > mirror/google averse: https://deftly.net/panic-2017-07-06/ > > > > Also with machdep.forceukbd=1, once I ran `mach ddbcpu 0`, every > > subsequent key press puked out an "splassert" line, I attempted to run > > a "trace" again, but things seemed to be completely locked up after that. > > I'm seeing the same panic but I can't run ddb. Also with syncthing.
Here's a fix. The problem certainly comes from a contented NET_LOCK() which means that we now have a sleeping point where we're not allowed to sleep. Diff below revert the solock()/sounlock() dances in the kqueue filters, let me know if it works for you. Index: kern/uipc_socket.c =================================================================== RCS file: /cvs/src/sys/kern/uipc_socket.c,v retrieving revision 1.192 diff -u -p -r1.192 uipc_socket.c --- kern/uipc_socket.c 4 Jul 2017 12:58:32 -0000 1.192 +++ kern/uipc_socket.c 7 Jul 2017 10:46:40 -0000 @@ -1998,10 +1998,8 @@ int filt_sowrite(struct knote *kn, long hint) { struct socket *so = kn->kn_fp->f_data; - int s, rv; + int rv; - if (!(hint & NOTE_SUBMIT)) - s = solock(so); kn->kn_data = sbspace(so, &so->so_snd); if (so->so_state & SS_CANTSENDMORE) { kn->kn_flags |= EV_EOF; @@ -2017,8 +2015,6 @@ filt_sowrite(struct knote *kn, long hint } else { rv = (kn->kn_data >= so->so_snd.sb_lowat); } - if (!(hint & NOTE_SUBMIT)) - sounlock(s); return (rv); } @@ -2027,13 +2023,8 @@ int filt_solisten(struct knote *kn, long hint) { struct socket *so = kn->kn_fp->f_data; - int s; - if (!(hint & NOTE_SUBMIT)) - s = solock(so); kn->kn_data = so->so_qlen; - if (!(hint & NOTE_SUBMIT)) - sounlock(s); return (kn->kn_data != 0); } Index: miscfs/fifofs/fifo_vnops.c =================================================================== RCS file: /cvs/src/sys/miscfs/fifofs/fifo_vnops.c,v retrieving revision 1.56 diff -u -p -r1.56 fifo_vnops.c --- miscfs/fifofs/fifo_vnops.c 3 Jul 2017 08:31:39 -0000 1.56 +++ miscfs/fifofs/fifo_vnops.c 7 Jul 2017 10:46:57 -0000 @@ -531,10 +531,8 @@ int filt_fiforead(struct knote *kn, long hint) { struct socket *so = (struct socket *)kn->kn_hook; - int s, rv; + int rv; - if (!(hint & NOTE_SUBMIT)) - s = solock(so); kn->kn_data = so->so_rcv.sb_cc; if (so->so_state & SS_CANTRCVMORE) { kn->kn_flags |= EV_EOF; @@ -543,8 +541,6 @@ filt_fiforead(struct knote *kn, long hin kn->kn_flags &= ~EV_EOF; rv = (kn->kn_data > 0); } - if (!(hint & NOTE_SUBMIT)) - sounlock(s); return (rv); } @@ -563,10 +559,8 @@ int filt_fifowrite(struct knote *kn, long hint) { struct socket *so = (struct socket *)kn->kn_hook; - int s, rv; + int rv; - if (!(hint & NOTE_SUBMIT)) - s = solock(so); kn->kn_data = sbspace(so, &so->so_snd); if (so->so_state & SS_CANTSENDMORE) { kn->kn_flags |= EV_EOF; @@ -575,8 +569,6 @@ filt_fifowrite(struct knote *kn, long hi kn->kn_flags &= ~EV_EOF; rv = (kn->kn_data >= so->so_snd.sb_lowat); } - if (!(hint & NOTE_SUBMIT)) - sounlock(s); return (rv); } Index: sys/socketvar.h =================================================================== RCS file: /cvs/src/sys/sys/socketvar.h,v retrieving revision 1.72 diff -u -p -r1.72 socketvar.h --- sys/socketvar.h 4 Jul 2017 12:58:32 -0000 1.72 +++ sys/socketvar.h 7 Jul 2017 10:46:32 -0000 @@ -186,7 +186,10 @@ static inline long sbspace(struct socket *so, struct sockbuf *sb) { KASSERT(sb == &so->so_rcv || sb == &so->so_snd); +#if 0 + /* XXXSMP kqueue_scan() calling filt_sowrite() cannot sleep. */ soassertlocked(so); +#endif return lmin(sb->sb_hiwat - sb->sb_cc, sb->sb_mbmax - sb->sb_mbcnt); }