Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 05 Feb 2011 15:22:21 -0500
From:      dieterbsd@engineer.com
To:        freebsd-questions@freebsd.org
Cc:        freebsd@sopwith.solgatos.com
Subject:   Why does printf(9) hang network?
Message-ID:  <8CD938986F06744-660-2F4AE@web-mmc-m06.sysops.aol.com>

next in thread | raw e-mail | index | archive | help
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) =3D=3D 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) =3D=3D 0)
151                          return (EWOULDBLOCK);
152                  return (0);
153          }
154  }

More info at: http://www.freebsd.org/cgi/query-pr.cgi?pr=3D118093





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8CD938986F06744-660-2F4AE>