Date: Sat, 05 Feb 2011 22:53:46 +0100 From: Ivan Voras <ivoras@freebsd.org> To: freebsd-questions@freebsd.org Subject: Re: Why does printf(9) hang network? Message-ID: <iikgtd$2mn$1@dough.gmane.org> In-Reply-To: <8CD938986F06744-660-2F4AE@web-mmc-m06.sysops.aol.com> References: <8CD938986F06744-660-2F4AE@web-mmc-m06.sysops.aol.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 05/02/2011 21:22, dieterbsd@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@.
>
> 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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?iikgtd$2mn$1>
