2006-11-13 13:44:39

by Remi Colinet

[permalink] [raw]
Subject: 2.6.19-rc5-mm1 : probe of 0000:00:1f.2 failed with error -16

Hello,

Since after 2.6.18-mm3, I'm unable to boot mm trees getting the following
message:

ata_piix: probe of 0000:00:1f.2 failed with error -16
Kernel panic - not syncing: Attempted to kill init!

I disabled most options in my .config file just keeping ata_piix enabled.
2.6.19-rc5 still boots fine but 2.6.19-rc-mm1 gives the same previous message.

I bissected the 2.6.19-rc5-mm1 tree and found the patch preventing my DELL D610
laptop from booting.

gregkh-pci-pci-quirks-fix-the-festering-mess-that-claims-to-handle-ide-quirks.patch

Digging further into the source code, I added some code to display I/O ports
allocations and stack traces at some useful points.
(http://remi.colinet.free.fr/ktrace/002/rco.patch)

So what happens with the previous patch applied?
(http://remi.colinet.free.fr/ktrace/002/dmesg_2.6.19-rc5-mm1-rco1)

=> Step 1 : with the patch applied, the resource of the pci device
dev->resource[x] are initialized to claim legacy I/O ports from 0x01f0 up to
0x01f7 with the flag IORESOURCE_IO (drivers/pci/probe.c).

=> Step 2 : then, these resources are allocated from the I/O port resources, by
pcibios_allocate_resources (arch/i386/pci/i386.c).

[<b0103bc5>] show_trace_log_lvl+0x1a/0x2f
[<b0103cbe>] show_trace+0x12/0x14
[<b010440c>] dump_stack+0x19/0x1b
[<b0120089>] catch_resource+0x36/0x38
[<b0120377>] request_resource+0x36/0x47
[<b03670f6>] pcibios_allocate_resources+0x7d/0x130
[<b03671bd>] pcibios_resource_survey+0x14/0x20
[<b036800e>] pcibios_init+0x5f/0x87
[<b01004a4>] init+0x127/0x2cf
[<b0103ad7>] kernel_thread_helper+0x7/0x10
=======================

I/O port resources give :

01f0-01f7 : 0000:00:1f.2

Hence, the I/O port resources are allocated, but with the flag IORESOURCE_IO.

=> Step 3 : then the following code is executed

[<b0120128>] __request_region+0x9d/0xa6
[<b01c2030>] quirk_intel_ide_combined+0x1a4/0x1f9
[<b01c16d5>] pci_fixup_device+0x6b/0x77
[<b01c076f>] pci_init+0x14/0x2c
[<b01004a4>] init+0x127/0x2cf
[<b0103ad7>] kernel_thread_helper+0x7/0x10

which requests the same resources but with the IORESOURCE_BUSY flag. I/O ports
resources are then :

01f0-01f7 : 0000:00:1f.2
01f0-01f7 : libata

=> Step 4 : then the libata tries to allocate once more the same ressources and
fails.

[<f00e3eed>] ata_pci_init_one+0xad/0x423 [libata]
[<f001f9c1>] piix_init_one+0x4b7/0x4d4 [ata_piix]
[<b01c2dd0>] pci_device_probe+0x39/0x5b
[<b01f7170>] really_probe+0x7a/0x101
[<b01f728c>] driver_probe_device+0x95/0xa1
[<b01f736a>] __driver_attach+0x4c/0x83
[<b01f67eb>] bus_for_each_dev+0x37/0x5c
[<b01f702a>] driver_attach+0x19/0x1b
[<b01f6ad2>] bus_add_driver+0x67/0x16a
[<b01f753f>] driver_register+0x76/0x7b
[<b01c2f5a>] __pci_register_driver+0x7e/0x99
[<f0035012>] piix_init+0x12/0x25 [ata_piix]
[<b0135c8b>] sys_init_module+0x1749/0x1926
[<b0102fbb>] syscall_call+0x7/0xb

Ending with the messages.

PCI: Unable to reserve I/O region #1:8@1f0 for device 0000:00:1f.2

And then,

ata_piix: probe of 0000:00:1f.2 failed with error -16
Kernel panic - not syncing: Attempted to kill init!

I/O ports resources are :

0170-0177 : 0000:00:1f.2
0170-0177 : ide1
01f0-01f7 : 0000:00:1f.2
01f0-01f7 : libata
0376-0376 : 0000:00:1f.2
0376-0376 : ide1

What happens in 2.6.19-rc5 (which boots fine)?
(http://remi.colinet.free.fr/ktrace/002/dmesg_2.6.19-rc5-mm1-rco2)

Step 1 : dev-resource are not initialized. So, step 2 doesn't request resources.
Step 3 allocates I/O ports.

[<b0103bc5>] show_trace_log_lvl+0x1a/0x2f
[<b0103cbe>] show_trace+0x12/0x14
[<b010440c>] dump_stack+0x19/0x1b
[<b0120089>] catch_resource+0x36/0x38
[<b0120128>] __request_region+0x9d/0xa6
[<b01c2030>] quirk_intel_ide_combined+0x1a4/0x1f9
[<b01c16d5>] pci_fixup_device+0x6b/0x77
[<b01c076f>] pci_init+0x14/0x2c
[<b01004a4>] init+0x127/0x2cf
[<b0103ad7>] kernel_thread_helper+0x7/0x10

Step 4, doesn't request the I/O ports in pci_request_regions() and falls back to
legacy mode in the function ata_pci_init_one (drivers/ata/libata-sff.c)

I'am blured about which peace of code __has__ to request the I/O ports (pcibios,
quirk, libata, ...).

Any idea about what to change to fix this problem?

Thanks,
Remi



2006-11-13 13:52:17

by Fabio Coatti

[permalink] [raw]
Subject: Re: 2.6.19-rc5-mm1 : probe of 0000:00:1f.2 failed with error -16

Alle 14:44, luned? 13 novembre 2006, Remi ha scritto:
> Hello,
>
> Since after 2.6.18-mm3, I'm unable to boot mm trees getting the following
> message:
>
> ata_piix: probe of 0000:00:1f.2 failed with error -16
> Kernel panic - not syncing: Attempted to kill init!
>
> I disabled most options in my .config file just keeping ata_piix enabled.
> 2.6.19-rc5 still boots fine but 2.6.19-rc-mm1 gives the same previous
> message.


It seems exactly the same problem that is hitting me:

http://lkml.org/lkml/2006/11/13/37

If some patch comes out, I'll be willing to try it asap ;)



--
Fabio "Cova" Coatti http://members.ferrara.linux.it/cova
Ferrara Linux Users Group http://ferrara.linux.it
GnuPG fp:9765 A5B6 6843 17BC A646 BE8C FA56 373A 5374 C703
Old SysOps never die... they simply forget their password.

2006-11-13 14:08:48

by Alan

[permalink] [raw]
Subject: Re: 2.6.19-rc5-mm1 : probe of 0000:00:1f.2 failed with error -16

On Mon, 13 Nov 2006 14:44:37 +0100
Remi <[email protected]> wrote:

> => Step 1 : with the patch applied, the resource of the pci device
> dev->resource[x] are initialized to claim legacy I/O ports from 0x01f0 up to
> 0x01f7 with the flag IORESOURCE_IO (drivers/pci/probe.c).

This is correct behaviour. The resource addresses are implied resources.

> => Step 2 : then, these resources are allocated from the I/O port resources, by
> pcibios_allocate_resources (arch/i386/pci/i386.c).

That is correct, the implied resources end up in the tree as they should
so we now have a correct map of the PCI resources

> which requests the same resources but with the IORESOURCE_BUSY flag. I/O ports
> resources are then :
>
> 01f0-01f7 : 0000:00:1f.2
> 01f0-01f7 : libata

This is an ugly hack that is done by the libata code to deal with old v
new IDE handling. All is still correct however
>
> => Step 4 : then the libata tries to allocate once more the same ressources and
> fails.
>
> [<f00e3eed>] ata_pci_init_one+0xad/0x423 [libata]
> [<f001f9c1>] piix_init_one+0x4b7/0x4d4 [ata_piix]

ata_pci_init_one should have followed the legacy_mode path at this point,
and the legacy mode path should not be trying to request the legacy
regions the quirk code already reserved.

I suspect the code should only do the pci_request_regions() call if the
device on if (!legacy_mode), and the legacy code should
pci_request_region(pdev, 4, ...);



2006-11-13 14:59:14

by Remi Colinet

[permalink] [raw]
Subject: Re: 2.6.19-rc5-mm1 : probe of 0000:00:1f.2 failed with error -16

Alan <[email protected]> wrote:

> On Mon, 13 Nov 2006 14:44:37 +0100
> Remi <[email protected]> wrote:
>
> >
> > => Step 4 : then the libata tries to allocate once more the same ressources
> and
> > fails.
> >
> > [<f00e3eed>] ata_pci_init_one+0xad/0x423 [libata]
> > [<f001f9c1>] piix_init_one+0x4b7/0x4d4 [ata_piix]
>
> ata_pci_init_one should have followed the legacy_mode path at this point,

So, doing the following change in drivers/ata/libata-sff.c, function
ata_pci_init_one should fix the problem.

- rc = pci_request_regions(pdev, DRV_NAME);
- if (rc) {
- disable_dev_on_err = 0;
- goto err_out;
- }
-
- if (legacy_mode) {
- if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) {


+ if (!legacy_mode) {
+ rc = pci_request_regions(pdev, DRV_NAME);
+ if (rc) {
+ disable_dev_on_err = 0;
+ goto err_out;
+ }
+ else {
+ if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) {

Going to try it.
But the ioport map is going stay a little bit ugly.

> and the legacy mode path should not be trying to request the legacy
> regions the quirk code already reserved.
>
> I suspect the code should only do the pci_request_regions() call if the
> device on if (!legacy_mode), and the legacy code should
> pci_request_region(pdev, 4, ...);
>

Actually, it seems to be exactly what the code does in the legacy mode.

Thanks,
Remi





2006-11-13 15:20:20

by Remi Colinet

[permalink] [raw]
Subject: Re: 2.6.19-rc5-mm1 : probe of 0000:00:1f.2 failed with error -16

Selon Fabio Coatti <[email protected]>:

> > ata_piix: probe of 0000:00:1f.2 failed with error -16
> > Kernel panic - not syncing: Attempted to kill init!
> >
> > I disabled most options in my .config file just keeping ata_piix enabled.
> > 2.6.19-rc5 still boots fine but 2.6.19-rc-mm1 gives the same previous
> > message.
>
>
> It seems exactly the same problem that is hitting me:
>
> http://lkml.org/lkml/2006/11/13/37
>
> If some patch comes out, I'll be willing to try it asap ;)
>

You are getting the same message

ata_piix 0000:00:1f.2: MAP [ P0 P1 IDE IDE ]
ACPI: PCI Interrupt 0000:00:1f.2[A] -> GSI 18 (level, low) -> IRQ 17
PCI: Unable to reserve I/O region #1:8@1f0 for device 0000:00:1f.2
ata_piix: probe of 0000:00:1f.2 failed with error -16

But, your drives are driven by the sata_sil driver, which seems to be ok.
See your partition tables displayed below.

ACPI: PCI Interrupt 0000:03:03.0[A] -> GSI 19 (level, low) -> IRQ 18
ata1: SATA max UDMA/100 cmd 0xF8804080 ctl 0xF880408A bmdma 0xF8804000 irq 18
ata2: SATA max UDMA/100 cmd 0xF88040C0 ctl 0xF88040CA bmdma 0xF8804008 irq 18
scsi1 : sata_sil
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
ata1.00: ATA-7, max UDMA/133, 625142448 sectors: LBA48 NCQ (depth 0/32)
ata1.00: ata1: dev 0 multi count 0
ata1.00: configured for UDMA/100
scsi2 : sata_sil
ata2: SATA link down (SStatus 0 SControl 310)
scsi 1:0:0:0: Direct-Access ATA Maxtor 6V320F0 VA11 PQ: 0 ANSI: 5
SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
sda: Write Protect is off
SCSI device sda: drive cache: write back
SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
sda: Write Protect is off
SCSI device sda: drive cache: write back
sda: sda1 sda2 sda3 sda4 < sda5 >

-- cut

VFS: Cannot open root device "821" or unknown-block(8,33)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(8,33)

Your root device seems to be wrong. Append the correct root=/dev/sda1 if it is
this partition.

Anyway, the first message indicates the same trouble as mine when trying to
reserve the I/O ports.

Remi

2006-11-13 15:54:31

by Fabio Coatti

[permalink] [raw]
Subject: Re: 2.6.19-rc5-mm1 : probe of 0000:00:1f.2 failed with error -16

Alle 16:20, luned? 13 novembre 2006, Remi ha scritto:
> Selon Fabio Coatti <[email protected]>:
> > > ata_piix: probe of 0000:00:1f.2 failed with error -16
> > > Kernel panic - not syncing: Attempted to kill init!
> > >
> > > I disabled most options in my .config file just keeping ata_piix
> > > enabled. 2.6.19-rc5 still boots fine but 2.6.19-rc-mm1 gives the same
> > > previous message.
> >
> > It seems exactly the same problem that is hitting me:
> >
> > http://lkml.org/lkml/2006/11/13/37
> >
> > If some patch comes out, I'll be willing to try it asap ;)
>
> You are getting the same message
>
> ata_piix 0000:00:1f.2: MAP [ P0 P1 IDE IDE ]
> ACPI: PCI Interrupt 0000:00:1f.2[A] -> GSI 18 (level, low) -> IRQ 17
> PCI: Unable to reserve I/O region #1:8@1f0 for device 0000:00:1f.2
> ata_piix: probe of 0000:00:1f.2 failed with error -16
>
> But, your drives are driven by the sata_sil driver, which seems to be ok.
> See your partition tables displayed below.

Not exactly: my fault to not including previous mails, but basically I've two
different devices: one driven by sata_sil, the other by piix.
cfr: http://lkml.org/lkml/2006/11/12/20
In this dmesg, the kernel finds only the second device, and assigns the
name "sda"; of course the right drive (the real "sda" on my system) is not
detected so the kernel is searching the "/" filesystem where it cannot be
found.

here the relevant part of lspci output:

00:1f.2 IDE interface: Intel Corporation 82801EB (ICH5) SATA Controller (rev
02) (prog-if 8a [Master SecP PriP])
Subsystem: ABIT Computer Corp. Unknown device 1014
Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 17
I/O ports at <unassigned>
I/O ports at <unassigned>
I/O ports at <unassigned>
I/O ports at <unassigned>
I/O ports at f000 [size=16]


03:03.0 RAID bus controller: Silicon Image, Inc. SiI 3112 [SATALink/SATARaid]
Serial ATA Controller (rev 02)
Subsystem: Silicon Image, Inc. SiI 3112 SATARaid Controller
Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 18
I/O ports at 8000 [size=8]
I/O ports at 8400 [size=4]
I/O ports at 8800 [size=8]
I/O ports at 8c00 [size=4]
I/O ports at 9000 [size=16]
Memory at fb005000 (32-bit, non-prefetchable) [size=512]
[virtual] Expansion ROM at 50000000 [disabled] [size=512K]
Capabilities: [60] Power Management version 2




--
Fabio "Cova" Coatti http://members.ferrara.linux.it/cova
Ferrara Linux Users Group http://ferrara.linux.it
GnuPG fp:9765 A5B6 6843 17BC A646 BE8C FA56 373A 5374 C703
Old SysOps never die... they simply forget their password.

2006-11-13 16:27:12

by Remi Colinet

[permalink] [raw]
Subject: Re: 2.6.19-rc5-mm1 : probe of 0000:00:1f.2 failed with error -16

Selon Fabio Coatti <[email protected]>:

> Alle 16:20, luned? 13 novembre 2006, Remi ha scritto:
> > Selon Fabio Coatti <[email protected]>:
> > > > ata_piix: probe of 0000:00:1f.2 failed with error -16
> > > > Kernel panic - not syncing: Attempted to kill init!
> > > >
> > > > I disabled most options in my .config file just keeping ata_piix
> > > > enabled. 2.6.19-rc5 still boots fine but 2.6.19-rc-mm1 gives the same
> > > > previous message.
> > >
> > > It seems exactly the same problem that is hitting me:
> > >
> > > http://lkml.org/lkml/2006/11/13/37
> > >
> > > If some patch comes out, I'll be willing to try it asap ;)
> >
> > You are getting the same message
> >
> > ata_piix 0000:00:1f.2: MAP [ P0 P1 IDE IDE ]
> > ACPI: PCI Interrupt 0000:00:1f.2[A] -> GSI 18 (level, low) -> IRQ 17
> > PCI: Unable to reserve I/O region #1:8@1f0 for device 0000:00:1f.2
> > ata_piix: probe of 0000:00:1f.2 failed with error -16
> >
> > But, your drives are driven by the sata_sil driver, which seems to be ok.
> > See your partition tables displayed below.
>
> Not exactly: my fault to not including previous mails, but basically I've two
> different devices: one driven by sata_sil, the other by piix.
> cfr: http://lkml.org/lkml/2006/11/12/20
> In this dmesg, the kernel finds only the second device, and assigns the
> name "sda"; of course the right drive (the real "sda" on my system) is not
> detected so the kernel is searching the "/" filesystem where it cannot be
> found.
>
> here the relevant part of lspci output:
>
> 00:1f.2 IDE interface: Intel Corporation 82801EB (ICH5) SATA Controller (rev
> 02) (prog-if 8a [Master SecP PriP])
> Subsystem: ABIT Computer Corp. Unknown device 1014
> Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 17
> I/O ports at <unassigned>
> I/O ports at <unassigned>
> I/O ports at <unassigned>
> I/O ports at <unassigned>
> I/O ports at f000 [size=16]

ok,

Could you try the following patch which solved the problemn on my laptop?

--- linux-2.6.19-rc5-mm1/drivers/ata/libata-sff.c 2006-11-12 13:08:19.000000000
+0100
+++ w1/drivers/ata/libata-sff.c 2006-11-13 18:32:18.000000000 +0100
@@ -1021,13 +1021,13 @@
#endif
}

- rc = pci_request_regions(pdev, DRV_NAME);
- if (rc) {
- disable_dev_on_err = 0;
- goto err_out;
- }
-
- if (legacy_mode) {
+ if (!legacy_mode) {
+ rc = pci_request_regions(pdev, DRV_NAME);
+ if (rc) {
+ disable_dev_on_err = 0;
+ goto err_out;
+ }
+ } else {
if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) {
struct resource *conflict, res;
res.start = ATA_PRIMARY_CMD;
Remi

2006-11-13 19:45:10

by Fabio Coatti

[permalink] [raw]
Subject: Re: 2.6.19-rc5-mm1 : probe of 0000:00:1f.2 failed with error -16

Alle 17:27, luned? 13 novembre 2006, Remi ha scritto:

> > Not exactly: my fault to not including previous mails, but basically I've
> > two different devices: one driven by sata_sil, the other by piix.
> > cfr: http://lkml.org/lkml/2006/11/12/20
> > In this dmesg, the kernel finds only the second device, and assigns the
> > name "sda"; of course the right drive (the real "sda" on my system) is
> > not detected so the kernel is searching the "/" filesystem where it
> > cannot be found.


[...]

>
> ok,
>
> Could you try the following patch which solved the problemn on my laptop?


Confirmed, problem solved. Now 2.6.19-rc5-mm1 is booting just fine with your
patch, well done.

Thanks.


--
Fabio "Cova" Coatti http://members.ferrara.linux.it/cova
Ferrara Linux Users Group http://ferrara.linux.it
GnuPG fp:9765 A5B6 6843 17BC A646 BE8C FA56 373A 5374 C703
Old SysOps never die... they simply forget their password.