From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 6 03:46:42 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2499A10656C9 for ; Sun, 6 Feb 2011 03:46:42 +0000 (UTC) (envelope-from dieterbsd@engineer.com) Received: from imr-mb01.mx.aol.com (imr-mb01.mx.aol.com [64.12.207.164]) by mx1.freebsd.org (Postfix) with ESMTP id D88888FC1B for ; Sun, 6 Feb 2011 03:46:41 +0000 (UTC) Received: from imo-ma04.mx.aol.com (imo-ma04.mx.aol.com [64.12.78.139]) by imr-mb01.mx.aol.com (8.14.1/8.14.1) with ESMTP id p163aPNs012241; Sat, 5 Feb 2011 22:36:25 -0500 Received: from dieterbsd@engineer.com by imo-ma04.mx.aol.com (mail_out_v42.9.) id n.ebf.681ee34 (34919); Sat, 5 Feb 2011 22:36:24 -0500 (EST) Received: from smtprly-mb01.mx.aol.com (smtprly-mb01.mx.aol.com [64.12.207.148]) by cia-da03.mx.aol.com (v129.8) with ESMTP id MAILCIADA034-5c624d4e17312e3; Sat, 05 Feb 2011 22:36:23 -0500 Received: from web-mmc-m06 (web-mmc-m06.sim.aol.com [64.12.224.139]) by smtprly-mb01.mx.aol.com (v129.8) with ESMTP id MAILSMTPRLYMB018-5c624d4e17312e3; Sat, 05 Feb 2011 22:36:17 -0500 To: freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Feb 2011 22:36:16 -0500 X-AOL-IP: 67.206.161.198 X-MB-Message-Source: WebUI Received: from 67.206.161.198 by web-mmc-m06.sysops.aol.com (64.12.224.139) with HTTP (WebMailUI); Sat, 05 Feb 2011 22:36:16 -0500 MIME-Version: 1.0 From: dieterbsd@engineer.com X-MB-Message-Type: User Content-Type: text/plain; charset="us-ascii" X-Mailer: Mail.com Webmail 33189-STANDARD Message-Id: <8CD93C6255B8920-660-30BBA@web-mmc-m06.sysops.aol.com> X-Spam-Flag: NO X-AOL-SENDER: dieterbsd@engineer.com Cc: freebsd@sopwith.solgatos.com Subject: Why does printf(9) hang network? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Feb 2011 03:46:42 -0000 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