kern/159511: ad0 disappear after upgrading to 8.2-STABLE, root mount error

Henry Hu henry.hu.sh at gmail.com
Thu Aug 4 06:10:11 UTC 2011


>Number:         159511
>Category:       kern
>Synopsis:       ad0 disappear after upgrading to 8.2-STABLE, root mount error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 04 06:10:11 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Henry Hu
>Release:        FreeBSD 8.2-STABLE
>Organization:
>Environment:
FreeBSD henryhu9.net9.org 8.2-STABLE FreeBSD 8.2-STABLE #4: Thu Aug  4 08:36:25 CST 2011     root@:/usr/obj/usr/src/sys/MYKERNEL  i386

>Description:
After upgrading from an old 8.1-STABLE to 8.2-STABLE yesterday, the ad0 disappears from the boot log, and the system failed to mount root, since there is no ad0s1 or ad0.
I found someone discussed it:
https://groups.google.com/forum/#!topic/mailing.freebsd.stable/dkIh0h8jk-g

I think that my problem is exactly the same. He did not find the answer, except changing the ATA controller to AHCI mode.
However, I cannot change mine. The AHCI option in my BIOS has two choices: Auto or Disabled. Even if you select Auto, the controller is still working in the compatible mode, not in the AHCI mode.

I hacked the code a little so it works for me, however this is just a hack and is not general. 

My computer is SAMSUNG R70-A00A, and its ATA controller is ICH8M(8086:2828), which is defined as ATA_I82801HBM_S1 in ata-intel.c. My HD is a Seagate ST9500325AS, ATA version 8, supports SATA 2.x


I compared the old verbose boot log with the new one. The differences are:
1. ad0 disappeared (so this PR...)

2. there is "SATA reset: port status=0x01" in the new log, but there is no such thing in the old log
   I found this in ata-intel.c, in ata_intel_reset(). It is emitted from ata0, the primary channel. 
   From the secondary channel, there is no "SATA reset.." emitted, but there is "reset tp1..." emitted. In the old log, both channels emit "reset tp1...". I found this in ata-lowlevel.c, in ata_generic_reset().

3. After this, there is "SATA connect timeout status=00000000" in the new log. There is no such thing in the old log.
   I found this in ata-sata.c, in ata_stat_connect(). I tried to increase the timeout to 10 secs, but it still times out.

4. in old log: ata0: Identifying devices: 00000001
               ata0: New devices: 00000001
   in new log: ata0: Identifying devices: 00000000
               ata0: New devices: 00000000

atacontrol cap ad0:
Protocol              SATA revision 2.x
device model          ST9500325AS
serial number         5VE68CF8
firmware revision     0002SDM1
cylinders             16383
heads                 16
sectors/track         63
lba supported         268435455 sectors
lba48 supported       976773168 sectors
dma supported
overlap not supported

Feature                      Support  Enable    Value           Vendor
write cache                    yes      yes
read ahead                     yes      yes
Native Command Queuing (NCQ)   yes       -      31/0x1F
Tagged Command Queuing (TCQ)   no       no      31/0x1F
SMART                          yes      yes
microcode download             yes      yes
security                       yes      no
power management               yes      yes
advanced power management      yes      yes     33022/0x80FE
automatic acoustic management  no       no      0/0x00  254/0xFE


lspci -nn:
00:00.0 Host bridge [0600]: Intel Corporation Mobile Memory Controller Hub [8086:2a00] (rev 03)
00:01.0 PCI bridge [0604]: Intel Corporation Mobile PCI Express Root Port [8086:2a01] (rev 03)
00:1a.0 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Contoller #4 [8086:2834] (rev 03)
00:1a.1 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 [8086:2835] (rev 03)
00:1a.7 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 [8086:283a] (rev 03)
00:1b.0 Audio device [0403]: Intel Corporation 82801H (ICH8 Family) HD Audio Controller [8086:284b] (rev 03)
00:1c.0 PCI bridge [0604]: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 [8086:283f] (rev 03)
00:1c.1 PCI bridge [0604]: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 [8086:2841] (rev 03)
00:1c.3 PCI bridge [0604]: Intel Corporation 82801H (ICH8 Family) PCI Express Port 4 [8086:2845] (rev 03)
00:1d.0 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 [8086:2830] (rev 03)
00:1d.1 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 [8086:2831] (rev 03)
00:1d.2 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 [8086:2832] (rev 03)
00:1d.7 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 [8086:2836] (rev 03)
00:1e.0 PCI bridge [0604]: Intel Corporation 82801 Mobile PCI Bridge [8086:2448] (rev f3)
00:1f.0 ISA bridge [0601]: Intel Corporation Mobile LPC Interface Controller [8086:2815] (rev 03)
00:1f.2 IDE interface [0101]: Intel Corporation Mobile SATA IDE Controller [8086:2828] (rev 03)
00:1f.3 SMBus [0c05]: Intel Corporation 82801H (ICH8 Family) SMBus Controller [8086:283e] (rev 03)
01:00.0 VGA compatible controller [0300]: nVidia Corporation Unknown device [10de:0425] (rev a1)
03:00.0 Network controller [0280]: Intel Corporation PRO/Wireless 3945ABG Network Connection [8086:4222] (rev 02)
04:00.0 Ethernet controller [0200]: Marvell Technology Group Ltd. 88E8055 PCI-E Gigabit Ethernet Controller [11ab:4363] (rev 13)
05:09.0 CardBus bridge [0607]: Ricoh Co Ltd RL5c476 II [1180:0476] (rev b4)
05:09.1 SD Host controller [0805]: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter [1180:0822] (rev 18)
05:09.2 System peripheral [0880]: Ricoh Co Ltd Unknown device [1180:0843]
05:09.3 System peripheral [0880]: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter [1180:0592] (rev 09)
05:09.4 System peripheral [0880]: Ricoh Co Ltd xD-Picture Card Controller [1180:0852] (rev 04)

old boot log:
http://pastebin.com/baqQp9U5

I cannot obtain a boot log with the problematic kernel, since I cannot boot into the system...
>How-To-Repeat:
1. Build an 8.2-STABLE kernel with ata, atadisk and other required drivers
2. Boot it on an computer with ICH8M(8086:2828) as the south bridge, and the ICH8M must work in the compatible mode.
>Fix:
So I suspect that the driver should still use ata_generic_reset() instead of ata_intel_reset() to reset the channel.
The start of ata_intel_reset() looks like this:

static void
ata_intel_reset(device_t dev)
{
// variable defs

	/* In combined mode, skip SATA stuff for PATA channel. */
	if ((ch->flags & ATA_SATA) == 0)
		return (ata_generic_reset(dev));

I am not very clear with AHCI mode and SATA, so I added a line after this to use the old reset method:

return ata_generic_reset(dev);

And the problem resolved. The system is using ata_generic_reset() to reset ata channel 0.

I think this is a bug somewhere in the ata-intel driver, so developers please have a look. Is my drive working in the optimal mode or not?

new boot log after patching:
http://pastebin.com/BmbR6G9U

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list