Re: [PATCH] Asynchronous scan support for libata
On Tue, Oct 02, 2007 at 10:41:11AM -0400, Jeff Garzik wrote: Did you look at SATA alone? No. I don't think I have any pure-SATA machines. I suppose I could disable the drivers for non-SATA and see what happens. Since SATA does its own scan asynchronously from SCSI itself, doing this seems of little value. This patch doesn't change AHCI scanning at all, for example. Its current value lies in allowing SCSI and SATA scans to take place simultaneously; otherwise SATA forces SCSI to finish its scans before it starts. It also allows the SATA asynchronous scan code to become synchronous. -- Intel are signing my paycheques ... these opinions are still mine Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step. - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Asynchronous scan support for libata
Matthew Wilcox wrote: Last December, I posted this: http://lwn.net/Articles/213635/ Here's an updated version. It shaves 5 seconds off boot time on my configuration (qla2xxx, emulex, two ata_piix, dual fusion), but could save more or less on other setups. I think I can remove the 'sync' argument and code from ata_scsi_scan_host() now, but wanted to send out this update today. --- Some of the drivers (AHCI was mentioned to me as a culprit) take a long time to discover all the devices attached to them. Even for ones which are relatively quick, if you put a lot of them in a machine, it will take a long time in aggregate. This can be fixed by adding support for asynchronous scsi scans, which causes the time-consuming portions of initialisation to take place in threads. Signed-off-by: Matthew Wilcox [EMAIL PROTECTED] Did you look at SATA alone? Since SATA does its own scan asynchronously from SCSI itself, doing this seems of little value. This patch doesn't change AHCI scanning at all, for example. Quite willing to be convinced otherwise, though... Jeff - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Asynchronous scan support for libata
Matthew Wilcox wrote: Last December, I posted this: http://lwn.net/Articles/213635/ Here's an updated version. It shaves 5 seconds off boot time on my configuration (qla2xxx, emulex, two ata_piix, dual fusion), but could save more or less on other setups. I think I can remove the 'sync' argument and code from ata_scsi_scan_host() now, but wanted to send out this update today. --- Some of the drivers (AHCI was mentioned to me as a culprit) take a long time to discover all the devices attached to them. Even for ones which are relatively quick, if you put a lot of them in a machine, it will take a long time in aggregate. This can be fixed by adding support for asynchronous scsi scans, which causes the time-consuming portions of initialisation to take place in threads. Signed-off-by: Matthew Wilcox [EMAIL PROTECTED] I think it's generally okay although it would need to spend quite some time in -mm and we'll need to exclude several drivers which require host-wide silence for mode programming (the current code is buggy but sequential probing hides it pretty well) till host-wide exclusion is implemented. Thanks. -- tejun - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Asynchronous scan support for libata
On Sat, Sep 08, 2007 at 05:10:27PM +0900, Tejun Heo wrote: I think it's generally okay although it would need to spend quite some time in -mm and we'll need to exclude several drivers which require host-wide silence for mode programming (the current code is buggy but sequential probing hides it pretty well) till host-wide exclusion is implemented. Can you tell me a bit more about these drivers? Would it be possible to convert them to one host/many channels, which would give us the exclusion we want? -- Intel are signing my paycheques ... these opinions are still mine Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step. - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Asynchronous scan support for libata
Matthew Wilcox wrote: Can you tell me a bit more about these drivers? Would it be possible to convert them to one host/many channels, which would give us the exclusion we want? As a tangent, I would prefer a more natural representation than current, where there is a 1-1 correspondence between scsi_host and ATA controller instance, and a 1-1 correspondence between SCSI channels and ATA ports. Alas _any_ change to the current setup requires special attention, because it is tied intimately into master/slave exclusion and scheduling. I occasionally ponder what it would take to create an intelligent request scheduling framework that takes into account inflexible hardware bottlenecks like simplex (one command per controller, $n ports, $m devices), master/slave (one command port, $m devices), NCQ ($n commands per port, $m devices), port multipliers with their own bottlenecks, etc. I see a lot of common code patterns in this area, but we are all sorta doing our own thing at a low level in drivers, because of subtle (and not-so-subtle) differences in hardware queueing support. Jeff, thinking out loud - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Asynchronous scan support for libata
Matthew Wilcox wrote: On Sat, Sep 08, 2007 at 05:10:27PM +0900, Tejun Heo wrote: I think it's generally okay although it would need to spend quite some time in -mm and we'll need to exclude several drivers which require host-wide silence for mode programming (the current code is buggy but sequential probing hides it pretty well) till host-wide exclusion is implemented. Can you tell me a bit more about these drivers? Would it be possible to convert them to one host/many channels, which would give us the exclusion we want? IIRC, sata_promise is of this type and there probably are a few old PATA ones. Ports on the host are mostly independent. There's no need for cross-port synchronization for most of the time but configuring transfer mode requires host-wide quiescence. Currently, the planned way to fix the problem is to implement host-wide exclusion mechanism in the error handler (summon EH of all other threads and wait till all of them are parked) and it's on top of the TODO list, so I don't think it will take too long. Thanks. -- tejun - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Asynchronous scan support for libata
Jeff Garzik wrote: Matthew Wilcox wrote: Can you tell me a bit more about these drivers? Would it be possible to convert them to one host/many channels, which would give us the exclusion we want? As a tangent, I would prefer a more natural representation than current, where there is a 1-1 correspondence between scsi_host and ATA controller instance, and a 1-1 correspondence between SCSI channels and ATA ports. Currently, the biggest problem is the EH thread. SCSI EH is per host and entering entering SCSI EH means host-wide quiescence. Alas _any_ change to the current setup requires special attention, because it is tied intimately into master/slave exclusion and scheduling. I occasionally ponder what it would take to create an intelligent request scheduling framework that takes into account inflexible hardware bottlenecks like simplex (one command per controller, $n ports, $m devices), master/slave (one command port, $m devices), NCQ ($n commands per port, $m devices), port multipliers with their own bottlenecks, etc. I see a lot of common code patterns in this area, but we are all sorta doing our own thing at a low level in drivers, because of subtle (and not-so-subtle) differences in hardware queueing support. Amen. It's slow but things are being shifted from SCSI to block. EH can be shifted to block and made per-queue. Mapping the current SCSI EH architecture to it will take some work but after that changing ATA host - SCSI host mapping shouldn't be too difficult. Thanks. -- tejun - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Asynchronous scan support for libata
Last December, I posted this: http://lwn.net/Articles/213635/ Here's an updated version. It shaves 5 seconds off boot time on my configuration (qla2xxx, emulex, two ata_piix, dual fusion), but could save more or less on other setups. I think I can remove the 'sync' argument and code from ata_scsi_scan_host() now, but wanted to send out this update today. --- Some of the drivers (AHCI was mentioned to me as a culprit) take a long time to discover all the devices attached to them. Even for ones which are relatively quick, if you put a lot of them in a machine, it will take a long time in aggregate. This can be fixed by adding support for asynchronous scsi scans, which causes the time-consuming portions of initialisation to take place in threads. Signed-off-by: Matthew Wilcox [EMAIL PROTECTED] diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 60e78be..43298c0 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -6321,6 +6321,53 @@ void ata_host_init(struct ata_host *host, struct device *dev, host-ops = ops; } +void ata_scsi_scan_start(struct Scsi_Host *shost) +{ + struct ata_port *ap = ata_shost_to_port(shost); + + if (ap-ops-error_handler) { + struct ata_eh_info *ehi = ap-eh_info; + unsigned long flags; + + ata_port_probe(ap); + + /* kick EH for boot probing */ + spin_lock_irqsave(ap-lock, flags); + + ehi-probe_mask = (1 ATA_MAX_DEVICES) - 1; + ehi-action |= ATA_EH_SOFTRESET; + ehi-flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; + + ap-pflags = ~ATA_PFLAG_INITIALIZING; + ap-pflags |= ATA_PFLAG_LOADING; + ata_port_schedule_eh(ap); + + spin_unlock_irqrestore(ap-lock, flags); + + /* wait for EH to finish */ + ata_port_wait_eh(ap); + } else { + int rc; + DPRINTK(ata%u: bus probe begin\n, ap-print_id); + rc = ata_bus_probe(ap); + DPRINTK(ata%u: bus probe end\n, ap-print_id); + + if (rc) { + /* +* FIXME: do something useful here? +* Current libata behavior will tear down everything +* when the module is removed or the h/w is unplugged. +*/ + } + } +} + +int ata_scsi_scan_finished(struct Scsi_Host *shost, unsigned long time) +{ + ata_scsi_scan_host(ata_shost_to_port(shost), 1); + return 1; +} + /** * ata_host_register - register initialized ATA host * @host: ATA host to register @@ -6408,56 +6455,10 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) ata_port_printk(ap, KERN_INFO, DUMMY\n); } - /* perform each probe synchronously */ DPRINTK(probe begin\n); for (i = 0; i host-n_ports; i++) { struct ata_port *ap = host-ports[i]; - int rc; - - /* probe */ - if (ap-ops-error_handler) { - struct ata_eh_info *ehi = ap-eh_info; - unsigned long flags; - - ata_port_probe(ap); - - /* kick EH for boot probing */ - spin_lock_irqsave(ap-lock, flags); - - ehi-probe_mask = (1 ATA_MAX_DEVICES) - 1; - ehi-action |= ATA_EH_SOFTRESET; - ehi-flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; - - ap-pflags = ~ATA_PFLAG_INITIALIZING; - ap-pflags |= ATA_PFLAG_LOADING; - ata_port_schedule_eh(ap); - - spin_unlock_irqrestore(ap-lock, flags); - - /* wait for EH to finish */ - ata_port_wait_eh(ap); - } else { - DPRINTK(ata%u: bus probe begin\n, ap-print_id); - rc = ata_bus_probe(ap); - DPRINTK(ata%u: bus probe end\n, ap-print_id); - - if (rc) { - /* FIXME: do something useful here? -* Current libata behavior will -* tear down everything when -* the module is removed -* or the h/w is unplugged. -*/ - } - } - } - - /* probes are done, now scan each port's disk(s) */ - DPRINTK(host probe begin\n); - for (i = 0; i host-n_ports; i++) { - struct ata_port *ap = host-ports[i]; - - ata_scsi_scan_host(ap, 1); + scsi_scan_host(ap-scsi_host); } return 0; @@ -6927,6 +6928,8 @@