Why does printf(9) hang network?
dieterbsd at engineer.com
dieterbsd at engineer.com
Sun Feb 6 03:46:42 UTC 2011
Why would doing a printf(9) in a device driver (usb, firewire, probably
others) cause an obscenely long lockout on
/usr/src/sys/kern/uipc_sockbuf.c:148 (sx:so_rcv_sx) ?
Printf(9) alone isn't the problem, adding printfs to chown(2) does not
cause the problem, but printfs from device drivers do.
Grep says that uipc_sockbuf.c is the only file that locks/unlocks sb_sx.
The device drivers and printf don't even know that sb_sx exists.
135 int
136 sblock(struct sockbuf *sb, int flags)
137 {
138
139 KASSERT((flags & SBL_VALID) == flags,
140 ("sblock: flags invalid (0x%x)", flags));
141
142 if (flags & SBL_WAIT) {
143 if ((sb->sb_flags & SB_NOINTR) ||
144 (flags & SBL_NOINTR)) {
145 sx_xlock(&sb->sb_sx);
146 return (0);
147 }
148 return (sx_xlock_sig(&sb->sb_sx));
149 } else {
150 if (sx_try_xlock(&sb->sb_sx) == 0)
151 return (EWOULDBLOCK);
152 return (0);
153 }
154 }
More info at: http://www.freebsd.org/cgi/query-pr.cgi?pr=118093
More information about the freebsd-hackers
mailing list