Re: 2.5.44: problemn when shutting down, drivers/base/power.c and the global_device_list

From: Patrick Mochel (
Date: Mon Oct 21 2002 - 12:33:28 EST

On Mon, 21 Oct 2002, Jurriaan wrote:

> I tried this patch:

> and it didn't work - still hangs in 'Shutting down devices'.

> and I see a loop when shutting down:
> ID 'scsi0'
> ID '0:0:1:0:gen'
> ID '0:0:1:0'
> ID '0:0:2:0:gen'
> ID '0:0:5:0:gen'
> ID '0:0:5:0'
> ID 'scsi0'
> and then it goes on to 0:0:1:0:gen and repeats itself.
> With the crude '>128 devices, skip the rest of it' above, it actually
> shuts down. I still wonder if this warning about might-sleep in my dmesg
> can have anything to do with this; it occurs just when registering the
> scsi card. A full dmesg has been attached.

It is related to the __might_sleep() dump on boot, but not necessarily
because of it. In short, Mike Anderson posted the patch I've appended.
That should fix it. Could you please try it?

The problem again is ncr_attach() in sym5c8xx.c. It's calling
scsi_set_pci_device(), which is registering the device a second time.

[ A note on that: the reason I didn't find this before is that it's a
static inline in drivers/scsi/host.h, and I was grepping through .c files
only. Does this really need to be static inline? It doesn't appear so. ]

The dump happens because ncr_attach(), on line 5838, NCR_LOCK()
(homebrewed locking macro wrappers for compatability) is called (which
does a spin_lock_irqsave()), and is held until line 5908. That's not
necessarily an ungodly long time, but probably unncessary.
scsi_set_pci_device() is called on line 5893, which calls
device_register(), which calls functions that can definitely sleep.


--- 1.19/drivers/scsi/hosts.h Wed Oct 16 17:53:47 2002
+++ edited/drivers/scsi/hosts.h Sun Oct 20 19:45:35 2002
@@ -551,9 +551,6 @@
         shost->pci_dev = pdev;
- /* register parent with driverfs */
- device_register(&shost->host_driverfs_dev);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Wed Oct 23 2002 - 22:00:55 EST