[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#345067: My understanding of the IDE mess, and why it does not make sense to apply the proposed patch



On Fri, 10 Mar 2006, Jonas Smedegaard wrote:

If modular-ide is the sole source of trouble here, then what worked in
2.6.14-4 and earlier?

The bugreports seem to indicate that things broke in 2.6.14-5 that
worked in 2.6.14-4. And it seems nothing related else than linux-2.6
changed then - not yaird and not kernel-package.

I have compared the 2.6.14-4 and 2.6.14-5 linux-2.6 packages. The
configs used to build the kernel are almost identical, and the 3
patches added in 2.6.14-5 do not touch anything in the IDE subsystem
at all. Both have the modular IDE patch applied. File lists of
/lib/modules/[version]/kernel/drivers/ide are exactly the same. Thus,
it is pretty unlikely that kernel is the cause of problems with
ide-generic.

Yaird, on the other hand, contains some relevant changes between the
last known working version (0.0.11-12) and the broken one (0.0.12-1).
Out of the complete diff between the source the following three hunks
are relevant for ide-generic handling:

--- yaird-0.0.11-12/perl/Hardware.pm    2006-03-10 17:28:03.852469888 -0800
+++ yaird-0.0.12-1/perl/Hardware.pm     2005-12-08 14:42:33.000000000 -0800
[..]
@@ -88,9 +113,42 @@
                        # Other mac-io devices are not storage related.
                        $modules = [ "mesh" ];
                }
-
+               elsif ($abspath =~ m!/ide\d+$!) {
+                       # IDE bus. On this end of the
+                       # cable we normally have on the PCI bus a chipset
+                       # controlling the IDE bus, so that the whole looks
+                       # like this:
+                       # /sys/devices/pci0000:00/0000:00:11.1/ide0/0.0
+                       # Here the driver for the PCI device will know how
+                       # to manage the IDE bus, and there's no need to load
+                       # a driver for the bus as such.
+                       #
+                       # Except that there also is this:
+                       # /sys/devices/ide0/0.0
+                       # This happens with the ide-generic driver.  This
+                       # is a driver that manages any PCI/IDE controller,
+ # regardless of device or vendor ID. + # The ide-generic driver does not do DMA, which
+                       # means it can be an order of magnitude slower than
+                       # drivers specific for a chipset.  Avoid if possible.
+                       # The ide-generic driver will not show the PCI device
+                       # in /sys/devices; this is an indicator for yaird to
+                       # add ide-generic to the image.
+                       #
+                       # Note that there is discussion over whether
+                       # ide-generic # should grab otherwise unhandled
+                       # IDE devices.
+                       # - http://thread.gmane.org/gmane.linux.hotplug.devel/6003
+                       # - http://lists.debian.org/debian-kernel/2004/11/msg00218.h
tml
+                       # - http://www.ussg.iu.edu/hypermail/linux/kernel/0410.1/145
2.html
+ # + if ($i == 0) {
+                               $modules = [ "ide-generic" ];
+                       }
+               }
                elsif ($abspath =~ m!/ide\d+/\d+\.\d+$!) {
-                       # IDE device
+                       # IDE device - this is the device at the other end
+                       # of the cable; normally a disk.
                        my $dev = IdeDev->new (path => $abspath);
                        $modules = IdeDev::findModuleByIdeDev ($dev);
                }
[..]
@@ -145,6 +205,19 @@
                        push @{$result}, @{$modules};
                }
        }
+
+       #
+       # Hmm, via82cxxx (2.6.8) also needs ide-generic
+       # to load it seems.  That could be because ide-generic
+       # contains a call to ide_probe_init() which is in
+       # the ide-core module.  After loading ide-generic
+       # it's still the via82cxxx module that manages the device;
+ # see /sys/bus/pci/drivers/VIA_IDE/. + # The above error persists in 2.6.12, and is solved
+       # in 2.6.14.
+       #
+       $result = [ map { $_ eq "via82cxxx" ?  ($_, "ide-generic") : $_ } @{$result}
 ];
+
        return $result;
 }
[..]
--- yaird-0.0.11-12/perl/IdeDev.pm      2005-08-07 13:57:40.000000000 -0700
+++ yaird-0.0.12-1/perl/IdeDev.pm       2005-12-08 14:42:33.000000000 -0800
[..]
@@ -108,16 +86,14 @@
        my ($ideDev) = @_;
        my $media = $ideDev->media();
        my $result = [];
-       if (! KConfig::isOmitted ("ide-generic")) {
-               # Supply ide-generic as default chipseet driver only if
-               # it was compiled into the kernel.
-               push @{$result}, "ide-generic";
-       }

        my $driver;
        $driver = "ide-disk" if ($media eq "disk");
        $driver = "ide-tape" if ($media eq "tape");
+
+       # The CD may also need ide-generic.
        $driver = "ide-cd" if ($media eq "cdrom");
+
        $driver = "ide-floppy" if ($media eq "floppy");
        if (defined ($driver)) {
                push @{$result}, $driver;

Judging by the comments, the first one is supposed to take care of
situations when one of the IDE devices is handled by ide-generic. In
that case the sysfs entry looks like /sys/devices/ide0/0.0, and
ide-generic is added to initrd in that case. The second one is the
via82cxxx kludge. And I believe that the third one is responsible for
breakage. It appears, that 0.0.11-12 had some logic in perl/IdeDev.pm
to add ide-generic to the initrd in the case when CONFIG_IDE_GENERIC
is present in the kernel config, but for some reason it got removed in
0.0.12-1. Testing on my box (with ICH4 controller) shows that both
2.6.14-4 and 2.6.14-5 work with 0.0.11-12 (ide-generic is included in
initrd), fail with 0.0.12-1 (ide-generic is not included in initrd),
and work again with 0.0.12-1 if the third hunk mentioned above is
reversed.

Best regards,

Jurij Smakov                                        jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/                   KeyID: C99E03CC



Reply to: