From owner-freebsd-questions@FreeBSD.ORG Sat Feb 5 20:22:40 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DA35106564A for ; Sat, 5 Feb 2011 20:22:40 +0000 (UTC) (envelope-from dieterbsd@engineer.com) Received: from imr-ma06.mx.aol.com (imr-ma06.mx.aol.com [64.12.78.142]) by mx1.freebsd.org (Postfix) with ESMTP id F1CC38FC13 for ; Sat, 5 Feb 2011 20:22:39 +0000 (UTC) Received: from imo-da02.mx.aol.com (imo-da02.mx.aol.com [205.188.169.200]) by imr-ma06.mx.aol.com (8.14.1/8.14.1) with ESMTP id p15KMU9w020267; Sat, 5 Feb 2011 15:22:30 -0500 Received: from dieterbsd@engineer.com by imo-da02.mx.aol.com (mail_out_v42.9.) id n.f11.11a3558c (34934); Sat, 5 Feb 2011 15:22:26 -0500 (EST) Received: from smtprly-dd03.mx.aol.com (smtprly-dd03.mx.aol.com [205.188.84.131]) by cia-da04.mx.aol.com (v129.8) with ESMTP id MAILCIADA047-d4054d4db17d167; Sat, 05 Feb 2011 15:22:25 -0500 Received: from web-mmc-m06 (web-mmc-m06.sim.aol.com [64.12.224.139]) by smtprly-dd03.mx.aol.com (v129.8) with ESMTP id MAILSMTPRLYDD031-d4054d4db17d167; Sat, 05 Feb 2011 15:22:21 -0500 To: freebsd-questions@freebsd.org Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Feb 2011 15:22:21 -0500 X-AOL-IP: 67.206.164.162 X-MB-Message-Source: WebUI Received: from 67.206.164.162 by web-mmc-m06.sysops.aol.com (64.12.224.139) with HTTP (WebMailUI); Sat, 05 Feb 2011 15:22:21 -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: <8CD938986F06744-660-2F4AE@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-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Feb 2011 20:22:40 -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