Subject: Re: ata probe messages being interspersed into other output?
To: Havard Eidnes <he@NetBSD.org>
From: Manuel Bouyer <firstname.lastname@example.org>
Date: 02/13/2007 22:31:07
On Sun, Feb 11, 2007 at 09:58:46PM +0100, Havard Eidnes wrote:
> I've noticed that sometimes probe messages from the ata subsystem
> appears to come interspersed into other output during boot.
> An example:
> atapibus0 at atabus0: 2 targets
> cd0 at atapibus0 drive 0: <SONY CD-ROM CDU4821, MT1198-B Firmware, S0.Q> cdrom removable
> scsibus0: waiting 2 seconds for devices to settle...
> scsibus1: waiting 2 seconds for devices to settle...
> cd0: 32-bit data port
> scsibus2: waiting 2 seconds for devices to settle...
> cd0: drive supports PIO mode 4satalink0: port 0: device present, speed: 1.5Gb/s
> , DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
> cd0(cypide0:0:0): using PIO mode 4, DMA mode 2 (using DMA)
> wd0 at atabus2 drive 0: <WDC WD2500JS-00MHB1>
> wd0: drive supports 16-sector PIO transfers, LBA48 addressing
> wd0: 232 GB, 484521 cyl, 16 head, 63 sec, 512 bytes/sect x 488397168 sectors
> wd0: 32-bit data port
> wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133)
> wd0(satalink0:0:0): using PIO mode 4, Ultra-DMA mode 6 (Ultra/133) (using DMA)
> Notice how the first "satalink0: ..." line comes in the middle of
> the probe message from cd0.
> Anyone have any good idea how to fix this? Is this becuase there
> are some sleepable operations done in-between the printing of the
> different parts of the line containing "cd0: drive supports"?
Yes, it's because of sleeps in the probe path. Maybe we could just sprintf()
it on a buffer on stack and print the whole thing at once at the end.
But we can't do this in all case, for example:
wd0 at atabus2 drive 0: <WDC WD2500JS-00MHB1>
there is also a sleep between "wd0 at atabus2 drive 0" and
": <WDC WD2500JS-00MHB1>". But the first one is printed by the
autoconf system and the second by the wd driver.
One way to fix this could be to add a tocken argument to aprint_*() (for
example the address of struct device) and have it line-buffer the output.
Manuel Bouyer <email@example.com>
NetBSD: 26 ans d'experience feront toujours la difference