Why does printf(9) hang network?

Ivan Voras ivoras at freebsd.org
Sat Feb 5 21:54:06 UTC 2011


On 05/02/2011 21:22, dieterbsd at engineer.com wrote:
> 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)  ?

You should ask this question on freebsd-hackers at .

>
> 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
>
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>




More information about the freebsd-questions mailing list