From owner-freebsd-hackers@FreeBSD.ORG Sun Apr 10 01:23:16 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 8DF64106564A for ; Sun, 10 Apr 2011 01:23:16 +0000 (UTC) (envelope-from dieterbsd@engineer.com) Received: from imr-ma02.mx.aol.com (imr-ma02.mx.aol.com [64.12.206.40]) by mx1.freebsd.org (Postfix) with ESMTP id 4DC858FC12 for ; Sun, 10 Apr 2011 01:23:15 +0000 (UTC) Received: from imo-da01.mx.aol.com (imo-da01.mx.aol.com [205.188.169.199]) by imr-ma02.mx.aol.com (8.14.1/8.14.1) with ESMTP id p3A1NFVw010153 for ; Sat, 9 Apr 2011 21:23:15 -0400 Received: from dieterbsd@engineer.com by imo-da01.mx.aol.com (mail_out_v42.9.) id n.1038.487a208 (55914) for ; Sat, 9 Apr 2011 21:23:10 -0400 (EDT) Received: from smtprly-mc03.mx.aol.com (smtprly-mc03.mx.aol.com [64.12.95.99]) by cia-md07.mx.aol.com (v129.9) with ESMTP id MAILCIAMD071-d3da4da1067c63; Sat, 09 Apr 2011 21:23:10 -0400 Received: from web-mmc-m02 (web-mmc-m02.sim.aol.com [64.12.224.135]) by smtprly-mc03.mx.aol.com (v129.9) with ESMTP id MAILSMTPRLYMC034-d3da4da1067c63; Sat, 09 Apr 2011 21:23:08 -0400 To: freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Date: Sat, 09 Apr 2011 21:23:08 -0400 X-MB-Message-Source: WebUI X-AOL-IP: 67.206.162.65 X-MB-Message-Type: User MIME-Version: 1.0 From: dieterbsd@engineer.com Content-Type: text/plain; charset="us-ascii"; format=flowed X-Mailer: Mail.com Webmail 33490-STANDARD Received: from 67.206.162.65 by web-mmc-m02.sysops.aol.com (64.12.224.135) with HTTP (WebMailUI); Sat, 09 Apr 2011 21:23:08 -0400 Message-Id: <8CDC534FC00AE72-18FC-4107@web-mmc-m02.sysops.aol.com> X-Spam-Flag: NO X-AOL-SENDER: dieterbsd@engineer.com Subject: Re: *printf(9) and PRINTF_BUFR_SIZE 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, 10 Apr 2011 01:23:16 -0000 >> While working on other problems with *printf(9), log(9), etc. >> I stumbled upon: >> >> options PRINTF_BUFR_SIZE=3D128 # Prevent printf output being=20 interspersed. >> >> Question 1: Am I correct in thinking that PRINTF_BUFR_SIZE is=20 supposed >> to prevent this: >> >> ada2: 300.000MB/s transfuhub2: 3 ports with 3 removable, self=20 powered >> ers (SATA 2.x, UDMA6, PIO 8192bytes) >> ada2: Command Queueing enabled >> >> Question 2: Why is vprintf() the only function that does this=20 buffering? >> As far as I can tell, the various functions that call kvprintf()=20 directly >> without going through vprintf() do not get buffered. I'm thinking=20 that >> kvprintf() would be a better place for the buffering. Or would this=20 break >> something? >=20 http://docs.freebsd.org/cgi/mid.cgi?AANLkTinPhcc8Z_BdvoEQUv-ZXlHAYOTQJwlUQ= DVO\ 8iJ9 Thanks, Alex! That was a useful thread, I now know more about the problem and how to fix it. I gather the answer to Q1 is yes. Given that the word "transfers" is broken, I still think this example is most likely due to my changes that use unbuffered kvprintf() rather than buffered vprintf(). So question 2 remains. BTW, I see some threads where people think this is due to SMP. It happens on uniprocessor machines too.