libsas, sas_ata: update for 3.5
Subsystems (6)
cover libsas, sas_ata: update for 3.5
1/ libsas suspend/resume support
2/ finish off the conversion of the strategy handlers to enforce only
invoking them in eh context (to meet libata's expectations).
3/ a collection of discovery fixes, error handling fixes, and
miscellaneous cleanups
All of these patches, save for patch 18, are on their 2nd or 3rd resend. These have been soaking in -next since before the 3.4 merge window opened.
[PATCH 01/18] libsas: cleanup spurious calls to scsi_schedule_eh [PATCH 02/18] libata, libsas: introduce sched_eh and end_eh port ops [PATCH 03/18] scsi: fix eh wakeup (scsi_schedule_eh vs scsi_restart_operations) [PATCH 04/18] scsi_transport_sas: fix delete vs scan race
[PATCH 05/18] libsas: enforce eh strategy handlers only in eh context [PATCH 06/18] libsas: add sas_eh_abort_handler
[PATCH 07/18] libsas: use ->lldd_I_T_nexus_reset for ->eh_bus_reset_handler [PATCH 08/18] isci: use sas eh strategy handlers
[PATCH 09/18] libsas: trim sas_task of slow path infrastructure [PATCH 10/18] libsas: sas_rediscover_dev did not look at the SMP exec status. [PATCH 11/18] mvsas: remove unused variable in mvs_task_exec() [PATCH 12/18] libata: reset once
[PATCH 13/18] libsas: continue revalidation
[PATCH 14/18] libata: export ata_port suspend/resume infrastructure for sas [PATCH 15/18] libsas: drop sata port multiplier infrastructure [PATCH 16/18] scsi, sd: limit the scope of the async probe domain [PATCH 17/18] libsas: suspend / resume support
[PATCH 18/18] scsi: cleanup setting task state in scsi_error_handler()
Documentation/kernel-parameters.txt | 3 + drivers/ata/libata-core.c | 63 +++++++++-- drivers/ata/libata-eh.c | 59 +++++++++-- drivers/scsi/isci/init.c | 3 + drivers/scsi/libsas/sas_ata.c | 125 ++++++++++++++++++++++ drivers/scsi/libsas/sas_discover.c | 92 +++++++++++++---- drivers/scsi/libsas/sas_dump.c | 1 drivers/scsi/libsas/sas_event.c | 16 +-- drivers/scsi/libsas/sas_expander.c | 35 ++++-- drivers/scsi/libsas/sas_init.c | 129 +++++++++++++++++++++-- drivers/scsi/libsas/sas_internal.h | 1 drivers/scsi/libsas/sas_phy.c | 21 ++++ drivers/scsi/libsas/sas_port.c | 52 +++++++++ drivers/scsi/libsas/sas_scsi_host.c | 195 +++++++++++++++++++++++++++++++---- drivers/scsi/mvsas/mv_sas.c | 21 ++-- drivers/scsi/pm8001/pm8001_sas.c | 37 +++---- drivers/scsi/scsi.c | 4 + drivers/scsi/scsi_error.c | 19 +++ drivers/scsi/scsi_lib.c | 10 +- drivers/scsi/scsi_pm.c | 2 drivers/scsi/scsi_priv.h | 2 drivers/scsi/scsi_transport_sas.c | 6 + drivers/scsi/sd.c | 5 + include/linux/libata.h | 16 +++ include/scsi/libsas.h | 50 +++++++-- include/scsi/sas_ata.h | 15 +++ 26 files changed, 827 insertions(+), 155 deletions(-)
PATCH 1/18 libsas: cleanup spurious calls to scsi_schedule_eh
From: Maciej Trela <[email protected]>
eh is woken up automatically by the presence of failed commands, scsi_schedule_eh is reserved for cases where there are no failed commands. This guarantees that host_eh_sceduled is only incremented when an explicit eh request is made.
--- drivers/scsi/libsas/sas_ata.c | 1 - drivers/scsi/libsas/sas_scsi_host.c | 1 - 2 files changed, 2 deletions(-)
drivers/scsi/libsas/sas_ata.c +0 -1
@@ -591,7 +591,6 @@ void sas_ata_task_abort(struct sas_task *task)spin_lock_irqsave (q->queue_lock, flags);blk_abort_request (qc->scsicmd->request);spin_unlock_irqrestore (q->queue_lock, flags); -scsi_schedule_eh (qc->scsicmd->device->host);return ; }
drivers/scsi/libsas/sas_scsi_host.c +0 -1
@@ -1003,7 +1003,6 @@ void sas_task_abort(struct sas_task *task)spin_lock_irqsave (q->queue_lock, flags);blk_abort_request (sc->request);spin_unlock_irqrestore (q->queue_lock, flags); -scsi_schedule_eh (sc->device->host); } }
PATCH 2/18 libata, libsas: introduce sched_eh and end_eh port ops
In reply to Dan WilliamsWhen managing shost->host_eh_scheduled libata assumes that there is a 1:1 shost-to-ata_port relationship. libsas creates a 1:N relationship so it needs to manage host_eh_scheduled cumulatively at the host level. The sched_eh and end_eh port port ops allow libsas to track when domain devices enter/leave the "eh-pending" state under ha->lock (previously named ha->state_lock, but it is no longer just a lock for ha->state changes).
Since host_eh_scheduled indicates eh without backing commands pinning the device it can be deallocated at any time. Move the taking of the domain_device reference under the port_lock to guarantee that the ata_port stays around for the duration of eh.
--- drivers/ata/libata-core.c | 4 ++ drivers/ata/libata-eh.c | 57 ++++++++++++++++++++++++++++------- drivers/scsi/libsas/sas_ata.c | 38 +++++++++++++++++++++-- drivers/scsi/libsas/sas_discover.c | 6 ++-- drivers/scsi/libsas/sas_event.c | 12 ++++--- drivers/scsi/libsas/sas_init.c | 14 ++++----- drivers/scsi/libsas/sas_scsi_host.c | 27 +++++++++++++---- include/linux/libata.h | 4 ++ include/scsi/libsas.h | 4 ++ include/scsi/sas_ata.h | 5 +++ 10 files changed, 134 insertions(+), 37 deletions(-)
drivers/ata/libata-core.c +4 -0
@@ -80,6 +80,8 @@ const struct ata_port_operations ata_base_port_ops = { .prereset = ata_std_prereset, .postreset = ata_std_postreset, .error_handler = ata_std_error_handler, + .sched_eh = ata_std_sched_eh, + .end_eh = ata_std_end_eh, };const struct ata_port_operations sata_port_ops = {
@@ -6635,6 +6637,8 @@ struct ata_port_operations ata_dummy_port_ops = { .qc_prep = ata_noop_qc_prep, .qc_issue = ata_dummy_qc_issue, .error_handler = ata_dummy_error_handler, + .sched_eh = ata_std_sched_eh, + .end_eh = ata_std_end_eh, };const struct ata_port_info ata_dummy_port_info = {
drivers/ata/libata-eh.c +46 -11
80 lines not on this page · raw message
drivers/scsi/libsas/sas_ata.c +34 -4
@@ -523,6 +523,31 @@ static void sas_ata_set_dmamode(struct ata_port *ap, struct ata_device *ata_dev) i->dft->lldd_ata_set_dmamode (dev); } +static void sas_ata_sched_eh (struct ata_port *ap) +{ +struct domain_device *dev = ap->private_data; +struct sas_ha_struct *ha = dev->port->ha; +unsigned long flags; + +spin_lock_irqsave (&ha->lock, flags); +if (!test_and_set_bit (SAS_DEV_EH_PENDING , &dev->state)) + ha->eh_active++; +ata_std_sched_eh (ap); +spin_unlock_irqrestore (&ha->lock, flags); +} + +void sas_ata_end_eh (struct ata_port *ap) +{ +struct domain_device *dev = ap->private_data; +struct sas_ha_struct *ha = dev->port->ha; +unsigned long flags; + +spin_lock_irqsave (&ha->lock, flags); +if (test_and_clear_bit (SAS_DEV_EH_PENDING , &dev->state)) + ha->eh_active--; +spin_unlock_irqrestore (&ha->lock, flags); +} +static struct ata_port_operations sas_sata_ops = { .prereset = ata_std_prereset, .hardreset = sas_ata_hard_reset,
@@ -536,6 +561,8 @@ static struct ata_port_operations sas_sata_ops = { .port_start = ata_sas_port_start, .port_stop = ata_sas_port_stop, .set_dmamode = sas_ata_set_dmamode, + .sched_eh = sas_ata_sched_eh, + .end_eh = sas_ata_end_eh, };static struct ata_port_info sata_port_info = {
@@ -707,10 +734,6 @@ static void async_sas_ata_eh(void *data, async_cookie_t cookie)struct ata_port *ap = dev->sata_dev.ap;struct sas_ha_struct *ha = dev->port->ha; -/* hold a reference over eh since we may be racing with final -* remove once all commands are completed -*/ -kref_get (&dev->kref);sas_ata_printk (KERN_DEBUG , dev,"dev error handler\n" );ata_scsi_port_error_handler (ha->core.shost, ap);sas_put_device (dev);
@@ -741,6 +764,13 @@ void sas_ata_strategy_handler(struct Scsi_Host *shost)list_for_each_entry (dev, &port->dev_list, dev_list_node) {if (!dev_is_sata (dev))continue ; + +/* hold a reference over eh since we may be +* racing with final remove once all commands +* are completed +*/ +kref_get (&dev->kref); +async_schedule_domain (async_sas_ata_eh, dev, &async); }spin_unlock (&port->dev_list_lock);
drivers/scsi/libsas/sas_discover.c +4 -2
@@ -294,6 +294,8 @@ static void sas_unregister_common_dev(struct asd_sas_port *port, struct domain_dspin_lock_irq (&port->dev_list_lock);list_del_init (&dev->dev_list_node); +if (dev_is_sata (dev)) +sas_ata_end_eh (dev->sata_dev.ap);spin_unlock_irq (&port->dev_list_lock);sas_put_device (dev);
@@ -488,9 +490,9 @@ static void sas_chain_event(int event, unsigned long *pending,if (!test_and_set_bit (event, pending)) {unsigned long flags; -spin_lock_irqsave (&ha->state_lock, flags); +spin_lock_irqsave (&ha->lock, flags);sas_chain_work (ha, sw); -spin_unlock_irqrestore (&ha->state_lock, flags); +spin_unlock_irqrestore (&ha->lock, flags); } }
drivers/scsi/libsas/sas_event.c +6 -6
@@ -47,9 +47,9 @@ static void sas_queue_event(int event, unsigned long *pending,if (!test_and_set_bit (event, pending)) {unsigned long flags; -spin_lock_irqsave (&ha->state_lock, flags); +spin_lock_irqsave (&ha->lock, flags);sas_queue_work (ha, work); -spin_unlock_irqrestore (&ha->state_lock, flags); +spin_unlock_irqrestore (&ha->lock, flags); } }
@@ -61,18 +61,18 @@ void __sas_drain_work(struct sas_ha_struct *ha)set_bit (SAS_HA_DRAINING , &ha->state);/* flush submitters */ -spin_lock_irq (&ha->state_lock); -spin_unlock_irq (&ha->state_lock); +spin_lock_irq (&ha->lock); +spin_unlock_irq (&ha->lock);drain_workqueue (wq); -spin_lock_irq (&ha->state_lock); +spin_lock_irq (&ha->lock);clear_bit (SAS_HA_DRAINING , &ha->state);list_for_each_entry_safe (sw, _sw, &ha->defer_q, drain_node) {list_del_init (&sw->drain_node);sas_queue_work (ha, sw); } -spin_unlock_irq (&ha->state_lock); +spin_unlock_irq (&ha->lock); }int sas_drain_work (struct sas_ha_struct *ha)
drivers/scsi/libsas/sas_init.c +7 -7
@@ -114,7 +114,7 @@ int sas_register_ha(struct sas_ha_struct *sas_ha) sas_ha->lldd_queue_size =128 ;/* Sanity */ set_bit (SAS_HA_REGISTERED , &sas_ha->state); -spin_lock_init (&sas_ha->state_lock); +spin_lock_init (&sas_ha->lock);mutex_init (&sas_ha->drain_mutex);INIT_LIST_HEAD (&sas_ha->defer_q);
@@ -163,9 +163,9 @@ int sas_unregister_ha(struct sas_ha_struct *sas_ha)* events to be queued, and flush any in-progress drainers */ mutex_lock (&sas_ha->drain_mutex); -spin_lock_irq (&sas_ha->state_lock); +spin_lock_irq (&sas_ha->lock);clear_bit (SAS_HA_REGISTERED , &sas_ha->state); -spin_unlock_irq (&sas_ha->state_lock); +spin_unlock_irq (&sas_ha->lock);__sas_drain_work (sas_ha);mutex_unlock (&sas_ha->drain_mutex);
@@ -411,9 +411,9 @@ static int queue_phy_reset(struct sas_phy *phy, int hard_reset) d->reset_result =0 ; d->hard_reset = hard_reset; -spin_lock_irq (&ha->state_lock); +spin_lock_irq (&ha->lock);sas_queue_work (ha, &d->reset_work); -spin_unlock_irq (&ha->state_lock); +spin_unlock_irq (&ha->lock); rc =sas_drain_work (ha);if (rc ==0 )
@@ -438,9 +438,9 @@ static int queue_phy_enable(struct sas_phy *phy, int enable) d->enable_result =0 ; d->enable = enable; -spin_lock_irq (&ha->state_lock); +spin_lock_irq (&ha->lock);sas_queue_work (ha, &d->enable_work); -spin_unlock_irq (&ha->state_lock); +spin_unlock_irq (&ha->lock); rc =sas_drain_work (ha);if (rc ==0 )
drivers/scsi/libsas/sas_scsi_host.c +21 -6
@@ -667,16 +667,20 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head * goto out; } +void sas_scsi_recover_host (struct Scsi_Host *shost) {struct sas_ha_struct *ha =SHOST_TO_SAS_HA (shost); -unsigned long flags;LIST_HEAD (eh_work_q); +int tries =0 ; +bool retry; -spin_lock_irqsave (shost->host_lock, flags); +retry: + tries++; + retry = true; +spin_lock_irq (shost->host_lock);list_splice_init (&shost->eh_cmd_q, &eh_work_q); - shost->host_eh_scheduled =0 ; -spin_unlock_irqrestore (shost->host_lock, flags); +spin_unlock_irq (shost->host_lock);SAS_DPRINTK ("Enter %s busy: %d failed: %d\n" , __func__, shost->host_busy, shost->host_failed);
@@ -710,8 +714,19 @@ out:scsi_eh_flush_done_q (&ha->eh_done_q); -SAS_DPRINTK ("--- Exit %s: busy: %d failed: %d\n" , - __func__, shost->host_busy, shost->host_failed); +/* check if any new eh work was scheduled during the last run */ +spin_lock_irq (&ha->lock); +if (ha->eh_active ==0 ) { + shost->host_eh_scheduled =0 ; + retry = false; + } +spin_unlock_irq (&ha->lock); + +if (retry) + goto retry; + +SAS_DPRINTK ("--- Exit %s: busy: %d failed: %d tries: %d\n" , + __func__, shost->host_busy, shost->host_failed, tries); }enum blk_eh_timer_return sas_scsi_timed_out (struct scsi_cmnd *cmd)
include/linux/libata.h +4 -0
@@ -845,6 +845,8 @@ struct ata_port_operations {void (*error_handler)(struct ata_port *ap);void (*lost_interrupt)(struct ata_port *ap);void (*post_internal_cmd)(struct ata_queued_cmd *qc); +void (*sched_eh)(struct ata_port *ap); +void (*end_eh)(struct ata_port *ap);/* * Optional features
@@ -1166,6 +1168,8 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, ata_reset_fn_t softreset, ata_reset_fn_t hardreset, ata_postreset_fn_t postreset);extern void ata_std_error_handler (struct ata_port *ap); +extern void ata_std_sched_eh (struct ata_port *ap); +extern void ata_std_end_eh (struct ata_port *ap);extern int ata_link_nr_enabled (struct ata_link *link);/*
include/scsi/libsas.h +3 -1
@@ -177,6 +177,7 @@ struct sata_device {enum {SAS_DEV_GONE ,SAS_DEV_DESTROY , +SAS_DEV_EH_PENDING , };struct domain_device {
@@ -384,7 +385,8 @@ struct sas_ha_struct {struct list_head defer_q;/* work queued while draining */ struct mutex drain_mutex;unsigned long state; -spinlock_t state_lock; +spinlock_t lock; +int eh_active;struct mutex disco_mutex;
include/scsi/sas_ata.h +5 -0
@@ -45,6 +45,7 @@ void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,void sas_ata_schedule_reset (struct domain_device *dev);void sas_ata_wait_eh (struct domain_device *dev);void sas_probe_sata (struct asd_sas_port *port); +void sas_ata_end_eh (struct ata_port *ap);#else
@@ -85,6 +86,10 @@ static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy {return 0 ; } + +static inline void sas_ata_end_eh (struct ata_port *ap) +{ +}#endif #endif /* _SAS_ATA_H_ */
PATCH 3/18 scsi: fix eh wakeup (scsi_schedule_eh vs scsi_restart_operations)
In reply to Dan WilliamsRapid ata hotplug on a libsas controller results in cases where libsas is waiting indefinitely on eh to perform an ata probe.
A race exists between scsi_schedule_eh() and scsi_restart_operations() in the case when scsi_restart_operations() issues i/o to other devices in the sas domain. When this happens the host state transitions from SHOST_RECOVERY (set by scsi_schedule_eh) back to SHOST_RUNNING and ->host_busy is non-zero so we put the eh thread to sleep even though ->host_eh_scheduled is active.
Before putting the error handler to sleep we need to check if the host_state needs to return to SHOST_RECOVERY for another trip through eh.
--- drivers/scsi/scsi_error.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/scsi/scsi_error.c +14 -0
@@ -1687,6 +1687,20 @@ static void scsi_restart_operations(struct Scsi_Host *shost)* requests are started. */ scsi_run_host_queues (shost); + +/* +* if eh is active and host_eh_scheduled is pending we need to re-run +* recovery. we do this check after scsi_run_host_queues() to allow +* everything pent up since the last eh run a chance to make forward +* progress before we sync again. Either we'll immediately re-run +* recovery or scsi_device_unbusy() will wake us again when these +* pending commands complete. +*/ +spin_lock_irqsave (shost->host_lock, flags); +if (shost->host_eh_scheduled) +if (scsi_host_set_state (shost,SHOST_RECOVERY )) +WARN_ON (scsi_host_set_state (shost,SHOST_CANCEL_RECOVERY )); +spin_unlock_irqrestore (shost->host_lock, flags); }/**
PATCH 4/18 scsi_transport_sas: fix delete vs scan race
In reply to Dan WilliamsThe following crash results from cases where the end_device has been removed before scsi_sysfs_add_sdev has had a chance to run.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000098 IP: [<ffffffff8115e100>] sysfs_create_dir+0x32/0xb6 ... Call Trace: [<ffffffff8125e4a8>] kobject_add_internal+0x120/0x1e3 [<ffffffff81075149>] ? trace_hardirqs_on+0xd/0xf [<ffffffff8125e641>] kobject_add_varg+0x41/0x50 [<ffffffff8125e70b>] kobject_add+0x64/0x66 [<ffffffff8131122b>] device_add+0x12d/0x63a [<ffffffff814b65ea>] ? _raw_spin_unlock_irqrestore+0x47/0x56 [<ffffffff8107de15>] ? module_refcount+0x89/0xa0 [<ffffffff8132f348>] scsi_sysfs_add_sdev+0x4e/0x28a [<ffffffff8132dcbb>] do_scan_async+0x9c/0x145
...teach sas_rphy_remove to wait for async scanning to quiesce before removing the end_device. It seems this is a more general problem [1], but this patch only addresses sas transport.
[1]: 23edb6e [SCSI] mpt2sas: Do not set sas_device->starget to NULL from the slave_destroy callback when all the LUNS have been deleted
--- drivers/scsi/scsi_transport_sas.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/scsi_transport_sas.c +5 -1
@@ -33,8 +33,9 @@#include <linux/bsg.h> #include <scsi/scsi.h> -#include <scsi/scsi_device.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_scan.h> +#include <scsi/scsi_device.h> #include <scsi/scsi_transport.h> #include <scsi/scsi_transport_sas.h>
@@ -1667,6 +1668,9 @@ sas_rphy_remove(struct sas_rphy *rphy) {struct device *dev = &rphy->dev; +/* prevent device_del() while child device_add() may be in-flight */ +scsi_complete_async_scans (); +switch (rphy->identify.device_type) {case SAS_END_DEVICE :scsi_remove_target (dev);
PATCH 5/18 libsas: enforce eh strategy handlers only in eh context
In reply to Dan WilliamsThe strategy handlers may be called in places that are problematic for libsas (i.e. sata resets outside of domain revalidation filtering / libata link recovery), or problematic for userspace (non-blocking ioctl to sleeping reset functions). However, these routines are also called for eh escalations and recovery of scsi_eh_prep_cmnd(), so permit them as long as we are running in the host's error handler, otherwise arrange for them to be triggered in eh_context.
--- drivers/scsi/libsas/sas_discover.c | 11 +++ drivers/scsi/libsas/sas_init.c | 2 + drivers/scsi/libsas/sas_scsi_host.c | 121 ++++++++++++++++++++++++++++++++++- include/scsi/libsas.h | 10 +++ 4 files changed, 140 insertions(+), 4 deletions(-)
drivers/scsi/libsas/sas_discover.c +11 -0
@@ -39,6 +39,7 @@ void sas_init_dev(struct domain_device *dev) {switch (dev->dev_type) {case SAS_END_DEV : +INIT_LIST_HEAD (&dev->ssp_dev.eh_list_node);break ;case EDGE_DEV :case FANOUT_DEV :
@@ -286,6 +287,8 @@ void sas_free_device(struct kref *kref)static void sas_unregister_common_dev (struct asd_sas_port *port,struct domain_device *dev) { +struct sas_ha_struct *ha = port->ha; +sas_notify_lldd_dev_gone (dev);if (!dev->parent) dev->port->port_dev =NULL ;
@@ -298,6 +301,14 @@ static void sas_unregister_common_dev(struct asd_sas_port *port, struct domain_dsas_ata_end_eh (dev->sata_dev.ap);spin_unlock_irq (&port->dev_list_lock); +spin_lock_irq (&ha->lock); +if (dev->dev_type ==SAS_END_DEV && + !list_empty (&dev->ssp_dev.eh_list_node)) { +list_del_init (&dev->ssp_dev.eh_list_node); + ha->eh_active--; + } +spin_unlock_irq (&ha->lock); +sas_put_device (dev); }
drivers/scsi/libsas/sas_init.c +2 -0
@@ -116,7 +116,9 @@ int sas_register_ha(struct sas_ha_struct *sas_ha)set_bit (SAS_HA_REGISTERED , &sas_ha->state);spin_lock_init (&sas_ha->lock);mutex_init (&sas_ha->drain_mutex); +init_waitqueue_head (&sas_ha->eh_wait_q);INIT_LIST_HEAD (&sas_ha->defer_q); +INIT_LIST_HEAD (&sas_ha->eh_dev_q); error =sas_register_phys (sas_ha);if (error) {
drivers/scsi/libsas/sas_scsi_host.c +117 -4
151 lines not on this page · raw message
include/scsi/libsas.h +10 -0
@@ -174,10 +174,17 @@ struct sata_device {struct ata_taskfile tf; }; +struct ssp_device { +struct list_head eh_list_node;/* pending a user requested eh action */ +struct scsi_lun reset_lun; +}; +enum {SAS_DEV_GONE ,SAS_DEV_DESTROY ,SAS_DEV_EH_PENDING , +SAS_DEV_LU_RESET , +SAS_DEV_RESET , };struct domain_device {
@@ -211,6 +218,7 @@ struct domain_device {union {struct expander_device ex_dev;struct sata_device sata_dev;/* STP & directly attached */ +struct ssp_device ssp_dev; };void *lldd_dev;
@@ -387,6 +395,8 @@ struct sas_ha_struct {unsigned long state;spinlock_t lock;int eh_active; +wait_queue_head_t eh_wait_q; +struct list_head eh_dev_q;struct mutex disco_mutex;
PATCH 6/18 libsas: add sas_eh_abort_handler
In reply to Dan WilliamsWhen recovering failed eh-cmnds let the lldd attempt an abort via scsi_abort_eh_cmnd before escalating.
--- drivers/scsi/libsas/sas_scsi_host.c | 21 +++++++++++++++++++++ include/scsi/libsas.h | 1 + 2 files changed, 22 insertions(+)
drivers/scsi/libsas/sas_scsi_host.c +21 -0
@@ -531,6 +531,27 @@ static int sas_queue_reset(struct domain_device *dev, int reset_type, int lun, ireturn FAILED ; } +int sas_eh_abort_handler (struct scsi_cmnd *cmd) +{ +int res; +struct sas_task *task =TO_SAS_TASK (cmd); +struct Scsi_Host *host = cmd->device->host; +struct sas_internal *i =to_sas_internal (host->transportt); + +if (current != host->ehandler) +return FAILED ; + +if (!i->dft->lldd_abort_task) +return FAILED ; + + res = i->dft->lldd_abort_task (task); +if (res ==TMF_RESP_FUNC_SUCC || res ==TMF_RESP_FUNC_COMPLETE ) +return SUCCESS ; + +return FAILED ; +} +EXPORT_SYMBOL_GPL (sas_eh_abort_handler); +/* Attempt to send a LUN reset message to a device */ int sas_eh_device_reset_handler (struct scsi_cmnd *cmd) {
include/scsi/libsas.h +1 -0
@@ -718,6 +718,7 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *);void sas_init_dev (struct domain_device *);void sas_task_abort (struct sas_task *); +int sas_eh_abort_handler (struct scsi_cmnd *cmd);int sas_eh_device_reset_handler (struct scsi_cmnd *cmd);int sas_eh_bus_reset_handler (struct scsi_cmnd *cmd);
PATCH 7/18 libsas: use ->lldd_I_T_nexus_reset for ->eh_bus_reset_handler
In reply to Dan Williamssas_eh_bus_reset_handler() amounts to sas_phy_reset() without notification of the reset to the lldd. If this is triggered from eh-cmnd recovery there may be sas_tasks for the lldd to terminate, so ->lldd_I_T_nexus_reset is warranted.
--- drivers/scsi/libsas/sas_scsi_host.c | 19 ++++++++----------- drivers/scsi/pm8001/pm8001_sas.c | 3 ++- 2 files changed, 10 insertions(+), 12 deletions(-)
drivers/scsi/libsas/sas_scsi_host.c +8 -11
@@ -576,25 +576,22 @@ int sas_eh_device_reset_handler(struct scsi_cmnd *cmd)return FAILED ; } -/* Attempt to send a phy (bus) reset */ int sas_eh_bus_reset_handler (struct scsi_cmnd *cmd) { -struct domain_device *dev =cmd_to_domain_dev (cmd); -struct sas_phy *phy =sas_get_local_phy (dev); -struct Scsi_Host *host = cmd->device->host;int res; +struct Scsi_Host *host = cmd->device->host; +struct domain_device *dev =cmd_to_domain_dev (cmd); +struct sas_internal *i =to_sas_internal (host->transportt);if (current != host->ehandler)return sas_queue_reset (dev,SAS_DEV_RESET ,0 ,0 ); - res =sas_phy_reset (phy,1 ); -if (res) -SAS_DPRINTK ("Bus reset of %s failed 0x%x\n" , -kobject_name (&phy->dev.kobj), - res); -sas_put_local_phy (phy); +if (!i->dft->lldd_I_T_nexus_reset) +return FAILED ; -if (res ==TMF_RESP_FUNC_SUCC || res ==TMF_RESP_FUNC_COMPLETE ) + res = i->dft->lldd_I_T_nexus_reset (dev); +if (res ==TMF_RESP_FUNC_SUCC || res ==TMF_RESP_FUNC_COMPLETE || + res == -ENODEV )return SUCCESS ;return FAILED ;
drivers/scsi/pm8001/pm8001_sas.c +2 -1
@@ -962,8 +962,9 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev)struct pm8001_device *pm8001_dev;struct pm8001_hba_info *pm8001_ha;struct sas_phy *phy; +if (!dev || !dev->lldd_dev) -return -1 ; +return -ENODEV ; pm8001_dev = dev->lldd_dev; pm8001_ha =pm8001_find_ha_by_dev (dev);
PATCH 8/18 isci: use sas eh strategy handlers
In reply to Dan Williams...now that the strategy handlers guarantee eh context and notify the driver of bus reset.
--- drivers/scsi/isci/init.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/isci/init.c +3 -0
@@ -166,6 +166,9 @@ static struct scsi_host_template isci_sht = { .sg_tablesize = SG_ALL, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, + .eh_abort_handler = sas_eh_abort_handler, + .eh_device_reset_handler = sas_eh_device_reset_handler, + .eh_bus_reset_handler = sas_eh_bus_reset_handler, .target_destroy = sas_target_destroy, .ioctl = sas_ioctl, .shost_attrs = isci_host_attrs,
PATCH 9/18 libsas: trim sas_task of slow path infrastructure
In reply to Dan WilliamsThe timer and the completion are only used for slow path tasks (smp, and lldd tmfs), yet we incur the allocation space and cpu setup time for every fast path task.
--- drivers/scsi/libsas/sas_expander.c | 20 ++++++++++---------- drivers/scsi/libsas/sas_init.c | 23 +++++++++++++++++++++-- drivers/scsi/libsas/sas_scsi_host.c | 8 ++++++-- drivers/scsi/mvsas/mv_sas.c | 20 ++++++++++---------- drivers/scsi/pm8001/pm8001_sas.c | 34 +++++++++++++++++----------------- include/scsi/libsas.h | 14 +++++++++----- 6 files changed, 73 insertions(+), 46 deletions(-)
drivers/scsi/libsas/sas_expander.c +10 -10
@@ -51,14 +51,14 @@ static void smp_task_timedout(unsigned long _task) task->task_state_flags |=SAS_TASK_STATE_ABORTED ;spin_unlock_irqrestore (&task->task_state_lock, flags); -complete (&task->completion); +complete (&task->slow_task->completion); }static void smp_task_done (struct sas_task *task) { -if (!del_timer (&task->timer)) +if (!del_timer (&task->slow_task->timer))return ; -complete (&task->completion); +complete (&task->slow_task->completion); }/* Give it some long enough timeout. In seconds. */
@@ -79,7 +79,7 @@ static int smp_execute_task(struct domain_device *dev, void *req, int req_size,break ; } - task =sas_alloc_task (GFP_KERNEL ); + task =sas_alloc_slow_task (GFP_KERNEL );if (!task) { res = -ENOMEM ;break ;
@@ -91,20 +91,20 @@ static int smp_execute_task(struct domain_device *dev, void *req, int req_size, task->task_done = smp_task_done; - task->timer.data = (unsigned long ) task; - task->timer.function = smp_task_timedout; - task->timer.expires = jiffies +SMP_TIMEOUT *HZ ; -add_timer (&task->timer); + task->slow_task->timer.data = (unsigned long ) task; + task->slow_task->timer.function = smp_task_timedout; + task->slow_task->timer.expires = jiffies +SMP_TIMEOUT *HZ ; +add_timer (&task->slow_task->timer); res = i->dft->lldd_execute_task (task,1 ,GFP_KERNEL );if (res) { -del_timer (&task->timer); +del_timer (&task->slow_task->timer);SAS_DPRINTK ("executing SMP task failed:%d\n" , res);break ; } -wait_for_completion (&task->completion); +wait_for_completion (&task->slow_task->completion); res = -ECOMM ;if ((task->task_state_flags &SAS_TASK_STATE_ABORTED )) {SAS_DPRINTK ("smp task timed out or aborted\n" );
drivers/scsi/libsas/sas_init.c +21 -2
@@ -48,18 +48,37 @@ struct sas_task *sas_alloc_task(gfp_t flags)INIT_LIST_HEAD (&task->list);spin_lock_init (&task->task_state_lock); task->task_state_flags =SAS_TASK_STATE_PENDING ; -init_timer (&task->timer); -init_completion (&task->completion); }return task; }EXPORT_SYMBOL_GPL (sas_alloc_task); +struct sas_task *sas_alloc_slow_task (gfp_t flags) +{ +struct sas_task *task =sas_alloc_task (flags); +struct sas_task_slow *slow =kmalloc (sizeof (*slow), flags); + +if (!task || !slow) { +if (task) +kmem_cache_free (sas_task_cache, task); +kfree (slow); +return NULL ; + } + + task->slow_task = slow; +init_timer (&slow->timer); +init_completion (&slow->completion); + +return task; +} +EXPORT_SYMBOL_GPL (sas_alloc_slow_task); +void sas_free_task (struct sas_task *task) {if (task) {BUG_ON (!list_empty (&task->list)); +kfree (task->slow_task);kmem_cache_free (sas_task_cache, task); } }
drivers/scsi/libsas/sas_scsi_host.c +6 -2
@@ -1134,9 +1134,13 @@ void sas_task_abort(struct sas_task *task)/* Escape for libsas internal commands */ if (!sc) { -if (!del_timer (&task->timer)) +struct sas_task_slow *slow = task->slow_task; + +if (!slow) +return ; +if (!del_timer (&slow->timer))return ; - task->timer.function (task->timer.data); + slow->timer.function (slow->timer.data);return ; }
drivers/scsi/mvsas/mv_sas.c +10 -10
@@ -1365,9 +1365,9 @@ void mvs_dev_gone(struct domain_device *dev)static void mvs_task_done (struct sas_task *task) { -if (!del_timer (&task->timer)) +if (!del_timer (&task->slow_task->timer))return ; -complete (&task->completion); +complete (&task->slow_task->completion); }static void mvs_tmf_timedout (unsigned long data)
@@ -1375,7 +1375,7 @@ static void mvs_tmf_timedout(unsigned long data)struct sas_task *task = (struct sas_task *)data; task->task_state_flags |=SAS_TASK_STATE_ABORTED ; -complete (&task->completion); +complete (&task->slow_task->completion); }#define MVS_TASK_TIMEOUT 20
@@ -1386,7 +1386,7 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,struct sas_task *task =NULL ;for (retry =0 ; retry <3 ; retry++) { - task =sas_alloc_task (GFP_KERNEL ); + task =sas_alloc_slow_task (GFP_KERNEL );if (!task)return -ENOMEM ;
@@ -1396,20 +1396,20 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,memcpy (&task->ssp_task, parameter, para_len); task->task_done = mvs_task_done; - task->timer.data = (unsigned long ) task; - task->timer.function = mvs_tmf_timedout; - task->timer.expires = jiffies +MVS_TASK_TIMEOUT *HZ ; -add_timer (&task->timer); + task->slow_task->timer.data = (unsigned long ) task; + task->slow_task->timer.function = mvs_tmf_timedout; + task->slow_task->timer.expires = jiffies +MVS_TASK_TIMEOUT *HZ ; +add_timer (&task->slow_task->timer); res =mvs_task_exec (task,1 ,GFP_KERNEL ,NULL ,1 , tmf);if (res) { -del_timer (&task->timer); +del_timer (&task->slow_task->timer);mv_printk ("executing internel task failed:%d\n" , res); goto ex_err; } -wait_for_completion (&task->completion); +wait_for_completion (&task->slow_task->completion); res =TMF_RESP_FUNC_FAILED ;/* Even TMF timed out, return direct. */ if ((task->task_state_flags &SAS_TASK_STATE_ABORTED )) {
drivers/scsi/pm8001/pm8001_sas.c +17 -17
@@ -650,9 +650,9 @@ int pm8001_dev_found(struct domain_device *dev)static void pm8001_task_done (struct sas_task *task) { -if (!del_timer (&task->timer)) +if (!del_timer (&task->slow_task->timer))return ; -complete (&task->completion); +complete (&task->slow_task->completion); }static void pm8001_tmf_timedout (unsigned long data)
@@ -660,7 +660,7 @@ static void pm8001_tmf_timedout(unsigned long data)struct sas_task *task = (struct sas_task *)data; task->task_state_flags |=SAS_TASK_STATE_ABORTED ; -complete (&task->completion); +complete (&task->slow_task->completion); }#define PM8001_TASK_TIMEOUT 20
@@ -683,7 +683,7 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev,struct pm8001_hba_info *pm8001_ha =pm8001_find_ha_by_dev (dev);for (retry =0 ; retry <3 ; retry++) { - task =sas_alloc_task (GFP_KERNEL ); + task =sas_alloc_slow_task (GFP_KERNEL );if (!task)return -ENOMEM ;
@@ -691,21 +691,21 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev, task->task_proto = dev->tproto;memcpy (&task->ssp_task, parameter, para_len); task->task_done = pm8001_task_done; - task->timer.data = (unsigned long )task; - task->timer.function = pm8001_tmf_timedout; - task->timer.expires = jiffies +PM8001_TASK_TIMEOUT *HZ ; -add_timer (&task->timer); + task->slow_task->timer.data = (unsigned long )task; + task->slow_task->timer.function = pm8001_tmf_timedout; + task->slow_task->timer.expires = jiffies +PM8001_TASK_TIMEOUT *HZ ; +add_timer (&task->slow_task->timer); res =pm8001_task_exec (task,1 ,GFP_KERNEL ,1 , tmf);if (res) { -del_timer (&task->timer); +del_timer (&task->slow_task->timer);PM8001_FAIL_DBG (pm8001_ha,pm8001_printk ("Executing internal task " "failed\n" )); goto ex_err; } -wait_for_completion (&task->completion); +wait_for_completion (&task->slow_task->completion); res = -TMF_RESP_FUNC_FAILED ;/* Even TMF timed out, return direct. */ if ((task->task_state_flags &SAS_TASK_STATE_ABORTED )) {
@@ -765,17 +765,17 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,struct sas_task *task =NULL ;for (retry =0 ; retry <3 ; retry++) { - task =sas_alloc_task (GFP_KERNEL ); + task =sas_alloc_slow_task (GFP_KERNEL );if (!task)return -ENOMEM ; task->dev = dev; task->task_proto = dev->tproto; task->task_done = pm8001_task_done; - task->timer.data = (unsigned long )task; - task->timer.function = pm8001_tmf_timedout; - task->timer.expires = jiffies +PM8001_TASK_TIMEOUT *HZ ; -add_timer (&task->timer); + task->slow_task->timer.data = (unsigned long )task; + task->slow_task->timer.function = pm8001_tmf_timedout; + task->slow_task->timer.expires = jiffies +PM8001_TASK_TIMEOUT *HZ ; +add_timer (&task->slow_task->timer); res =pm8001_tag_alloc (pm8001_ha, &ccb_tag);if (res)
@@ -789,13 +789,13 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha, pm8001_dev, flag, task_tag, ccb_tag);if (res) { -del_timer (&task->timer); +del_timer (&task->slow_task->timer);PM8001_FAIL_DBG (pm8001_ha,pm8001_printk ("Executing internal task " "failed\n" )); goto ex_err; } -wait_for_completion (&task->completion); +wait_for_completion (&task->slow_task->completion); res =TMF_RESP_FUNC_FAILED ;/* Even TMF timed out, return direct. */ if ((task->task_state_flags &SAS_TASK_STATE_ABORTED )) {
include/scsi/libsas.h +9 -5
@@ -612,10 +612,6 @@ struct sas_task {enum sas_protocol task_proto; -/* Used by the discovery code. */ -struct timer_list timer; -struct completion completion; -union {struct sas_ata_task ata_task;struct sas_smp_task smp_task;
@@ -632,8 +628,15 @@ struct sas_task {void *lldd_task;/* for use by LLDDs */ void *uldd_task; +struct sas_task_slow *slow_task; +}; -struct work_struct abort_work; +struct sas_task_slow { +/* standard/extra infrastructure for slow path commands (SMP and +* internal lldd commands +*/ +struct timer_list timer; +struct completion completion; };#define SAS_TASK_STATE_PENDING 1
@@ -643,6 +646,7 @@ struct sas_task {#define SAS_TASK_AT_INITIATOR 16extern struct sas_task *sas_alloc_task (gfp_t flags); +extern struct sas_task *sas_alloc_slow_task (gfp_t flags);extern void sas_free_task (struct sas_task *task);struct sas_domain_function_template {
PATCH 10/18 libsas: sas_rediscover_dev did not look at the SMP exec status.
In reply to Dan WilliamsFrom: Jeff Skirvin <[email protected]>
The discovery function "sas_rediscover_dev" had two bugs: 1) it did not pay attention to the return status from the SMP task execution;
2) the stack variable used for the returned SAS address was compared against 0 without being initialized.
--- drivers/scsi/libsas/sas_expander.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/libsas/sas_expander.c +6 -1
@@ -2005,6 +2005,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)u8 sas_addr[8 ];int res; +memset (sas_addr,0 ,8 ); res =sas_get_phy_attached_dev (dev, phy_id, sas_addr, &type);switch (res) {case SMP_RESP_NO_PHY :
@@ -2017,9 +2018,13 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)return res;case SMP_RESP_FUNC_ACC :break ; +case -ECOMM : +break ; +default : +return res; } -if (SAS_ADDR (sas_addr) ==0 ) { +if ((SAS_ADDR (sas_addr) ==0 ) || (res == -ECOMM )) { phy->phy_state =PHY_EMPTY ;sas_unregister_devs_sas_addr (dev, phy_id, last);return res;
PATCH 11/18 mvsas: remove unused variable in mvs_task_exec()
In reply to Dan WilliamsFrom: Dan Carpenter <[email protected]>
We don't use "dev" any more after 07ec747a5f ("libsas: remove ata_port.lock management duties from lldds") and it causes a compile warning.
--- drivers/scsi/mvsas/mv_sas.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/mvsas/mv_sas.c +0 -1
@@ -885,7 +885,6 @@ static int mvs_task_exec(struct sas_task *task, const int num, gfp_t gfp_flags, struct completion *completion, int is_tmf, struct mvs_tmf_task *tmf) { - struct domain_device *dev = task->dev; struct mvs_info *mvi = NULL;u32 rc =0 ;u32 pass =0 ;
PATCH 12/18 libata: reset once
In reply to Dan WilliamsHotplug testing with libsas currently encounters a 55 second wait for link recovery to give up. In the case where the user trusts the response time of their devices permit the recovery attempts to be limited to one.
--- Documentation/kernel-parameters.txt | 3 +++ drivers/ata/libata-core.c | 1 + drivers/ata/libata-eh.c | 2 ++ include/linux/libata.h | 1 + 4 files changed, 7 insertions(+)
Documentation/kernel-parameters.txt +3 -0
@@ -1319,6 +1319,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted. * nohrst, nosrst, norst: suppress hard, soft and both resets. + * rstonce: only attempt one reset during + hot-unplug link recovery + * dump_id: dump IDENTIFY data. If there are multiple matching configurations changing
drivers/ata/libata-core.c +1 -0
@@ -6381,6 +6381,7 @@ static int __init ata_parse_force_one(char **cur, { "nohrst", .lflags = ATA_LFLAG_NO_HRST }, { "nosrst", .lflags = ATA_LFLAG_NO_SRST }, { "norst", .lflags = ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST }, + { "rstonce", .lflags = ATA_LFLAG_RST_ONCE }, };char *start = *cur, *p = *cur;char *id, *val, *endp;
drivers/ata/libata-eh.c +2 -0
@@ -2605,6 +2605,8 @@ int ata_eh_reset(struct ata_link *link, int classify,*/ while (ata_eh_reset_timeouts[max_tries] !=ULONG_MAX ) max_tries++; +if (link->flags &ATA_LFLAG_RST_ONCE ) + max_tries =1 ;if (link->flags &ATA_LFLAG_NO_HRST ) hardreset =NULL ;if (link->flags &ATA_LFLAG_NO_SRST )
include/linux/libata.h +1 -0
@@ -182,6 +182,7 @@ enum {ATA_LFLAG_DISABLED = (1 <<6 ),/* link is disabled */ ATA_LFLAG_SW_ACTIVITY = (1 <<7 ),/* keep activity stats */ ATA_LFLAG_NO_LPM = (1 <<8 ),/* disable LPM on this link */ +ATA_LFLAG_RST_ONCE = (1 <<9 ),/* limit recovery to one reset */ /* struct ata_port flags */ ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
PATCH 13/18 libsas: continue revalidation
In reply to Dan WilliamsContinue running revalidation until no more broadcast devices are discovered.
--- drivers/scsi/libsas/sas_expander.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/libsas/sas_expander.c +4 -4
@@ -2114,9 +2114,7 @@ int sas_ex_revalidate_domain(struct domain_device *port_dev)struct domain_device *dev =NULL ; res =sas_find_bcast_dev (port_dev, &dev); -if (res) - goto out; -if (dev) { +while (res ==0 && dev) {struct expander_device *ex = &dev->ex_dev;int i =0 , phy_id;
@@ -2128,8 +2126,10 @@ int sas_ex_revalidate_domain(struct domain_device *port_dev) res =sas_rediscover (dev, phy_id); i = phy_id +1 ; }while (i < ex->num_phys); + + dev =NULL ; + res =sas_find_bcast_dev (port_dev, &dev); } -out:return res; }
PATCH 14/18 libata: export ata_port suspend/resume infrastructure for sas
In reply to Dan WilliamsReuse ata_port_{suspend|resume}_common for sas. This path is chosen over adding coordination between ata-tranport and sas-transport because libsas wants to revalidate the domain at resume-time at the host level. It can not validate links have resumed properly until libata has had a chance to perform its revalidation, and any sane placing of an ata_port in the sas-transport model would delay it's resumption until after the host.
Export the common portion of port suspend/resume (bypass pm_runtime), and allow sas to perform these operations asynchronously (similar to the libsas async-ata probe implmentation). Async operation is determined by having an external, rather than stack based, location for storing the result of the operation.
--- drivers/ata/libata-core.c | 58 ++++++++++++++++++++++++++++++++++++--------- include/linux/libata.h | 11 +++++++++ 2 files changed, 57 insertions(+), 12 deletions(-)
drivers/ata/libata-core.c +46 -12
@@ -5241,16 +5241,20 @@ bool ata_link_offline(struct ata_link *link)#ifdef CONFIG_PM static int ata_port_request_pm (struct ata_port *ap,pm_message_t mesg,unsigned int action,unsigned int ehi_flags, -int wait) +int *async) {struct ata_link *link;unsigned long flags; -int rc; +int rc =0 ;/* Previous resume operation might still be in * progress. Wait for PM_PENDING to clear. */ if (ap->pflags &ATA_PFLAG_PM_PENDING ) { +if (async) { + *async = -EAGAIN ; +return 0 ; + }ata_port_wait_eh (ap);WARN_ON (ap->pflags &ATA_PFLAG_PM_PENDING ); }
@@ -5259,10 +5263,10 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,spin_lock_irqsave (ap->lock, flags); ap->pm_mesg = mesg; -if (wait) { - rc =0 ; +if (async) + ap->pm_result = async; +else ap->pm_result = &rc; - } ap->pflags |=ATA_PFLAG_PM_PENDING ;ata_for_each_link (link, ap,HOST_FIRST ) {
@@ -5275,7 +5279,7 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,spin_unlock_irqrestore (ap->lock, flags);/* wait and check result */ -if (wait) { +if (!async) {ata_port_wait_eh (ap);WARN_ON (ap->pflags &ATA_PFLAG_PM_PENDING ); }
@@ -5285,9 +5289,8 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,#define to_ata_port (d) container_of(d, struct ata_port, tdev) -static int ata_port_suspend_common (struct device *dev,pm_message_t mesg) +static int __ata_port_suspend_common (struct ata_port *ap,pm_message_t mesg,int *async) { -struct ata_port *ap =to_ata_port (dev);unsigned int ehi_flags =ATA_EHI_QUIET ;int rc;
@@ -5302,10 +5305,17 @@ static int ata_port_suspend_common(struct device *dev, pm_message_t mesg)if (mesg.event ==PM_EVENT_SUSPEND ) ehi_flags |=ATA_EHI_NO_AUTOPSY |ATA_EHI_NO_RECOVERY ; - rc =ata_port_request_pm (ap, mesg,0 , ehi_flags,1 ); + rc =ata_port_request_pm (ap, mesg,0 , ehi_flags, async);return rc; } +static int ata_port_suspend_common (struct device *dev,pm_message_t mesg) +{ +struct ata_port *ap =to_ata_port (dev); + +return __ata_port_suspend_common (ap, mesg,NULL ); +} +static int ata_port_suspend (struct device *dev) {if (pm_runtime_suspended (dev))
@@ -5330,16 +5340,22 @@ static int ata_port_poweroff(struct device *dev)return ata_port_suspend_common (dev,PMSG_HIBERNATE ); } -static int ata_port_resume_common (struct device *dev) +static int __ata_port_resume_common (struct ata_port *ap,int *async) { -struct ata_port *ap =to_ata_port (dev);int rc; rc =ata_port_request_pm (ap,PMSG_ON ,ATA_EH_RESET , -ATA_EHI_NO_AUTOPSY |ATA_EHI_QUIET ,1 ); +ATA_EHI_NO_AUTOPSY |ATA_EHI_QUIET , async);return rc; } +static int ata_port_resume_common (struct device *dev) +{ +struct ata_port *ap =to_ata_port (dev); + +return __ata_port_resume_common (ap,NULL ); +} +static int ata_port_resume (struct device *dev) {int rc;
@@ -5372,6 +5388,24 @@ static const struct dev_pm_ops ata_port_pm_ops = { .runtime_idle = ata_port_runtime_idle, }; +/* sas ports don't participate in pm runtime management of ata_ports, +* and need to resume ata devices at the domain level, not the per-port +* level. sas suspend/resume is async to allow parallel port recovery +* since sas has multiple ata_port instances per Scsi_Host. +*/ +int ata_sas_port_async_suspend (struct ata_port *ap,int *async) +{ +return __ata_port_suspend_common (ap,PMSG_SUSPEND , async); +} +EXPORT_SYMBOL_GPL (ata_sas_port_async_suspend); + +int ata_sas_port_async_resume (struct ata_port *ap,int *async) +{ +return __ata_port_resume_common (ap, async); +} +EXPORT_SYMBOL_GPL (ata_sas_port_async_resume); + +/** * ata_host_suspend - suspend host * @host: host to suspend
include/linux/libata.h +11 -0
@@ -1015,6 +1015,17 @@ extern bool ata_link_offline(struct ata_link *link);#ifdef CONFIG_PM extern int ata_host_suspend (struct ata_host *host,pm_message_t mesg);extern void ata_host_resume (struct ata_host *host); +extern int ata_sas_port_async_suspend (struct ata_port *ap,int *async); +extern int ata_sas_port_async_resume (struct ata_port *ap,int *async); +#else +static inline int ata_sas_port_async_suspend (struct ata_port *ap,int *async) +{ +return 0 ; +} +static inline int ata_sas_port_async_resume (struct ata_port *ap,int *async) +{ +return 0 ; +}#endif extern int ata_ratelimit (void );extern void ata_msleep (struct ata_port *ap,unsigned int msecs);
PATCH 15/18 libsas: drop sata port multiplier infrastructure
In reply to Dan WilliamsOn the way to add a new sata_device field, noticed that libsas is carrying port multiplier infrastructure that is explicitly disabled by sas_discover_sata(). The aic94xx touches the unused port_no, so leave that field in case there was some use for it.
--- drivers/scsi/libsas/sas_discover.c | 6 ------ include/scsi/libsas.h | 1 - 2 files changed, 7 deletions(-)
drivers/scsi/libsas/sas_discover.c +0 -6
@@ -46,12 +46,6 @@ void sas_init_dev(struct domain_device *dev)INIT_LIST_HEAD (&dev->ex_dev.children);mutex_init (&dev->ex_dev.cmd_mutex);break ; -case SATA_DEV : -case SATA_PM : -case SATA_PM_PORT : -case SATA_PENDING : -INIT_LIST_HEAD (&dev->sata_dev.children); -break ;default :break ; }
include/scsi/libsas.h +0 -1
@@ -167,7 +167,6 @@ struct sata_device {enum ata_command_set command_set;struct smp_resp rps_resp;/* report_phy_sata_resp */ u8 port_no;/* port number, if this is a PM (Port) */ -struct list_head children;/* PM Ports if this is a PM */ struct ata_port *ap;struct ata_host ata_host;
PATCH 16/18 scsi, sd: limit the scope of the async probe domain
In reply to Dan Williamssd injects and synchronizes probe work on the global kernel-wide domain. This runs into conflict with PM that wants to perform resume actions in async context:
[ 494.237079] INFO: task kworker/u:3:554 blocked for more than 120 seconds. [ 494.294396] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 494.360809] kworker/u:3 D 0000000000000000 0 554 2 0x00000000 [ 494.420739] ffff88012e4d3af0 0000000000000046 ffff88013200c160 ffff88012e4d3fd8 [ 494.484392] ffff88012e4d3fd8 0000000000012500 ffff8801394ea0b0 ffff88013200c160 [ 494.548038] ffff88012e4d3ae0 00000000000001e3 ffffffff81a249e0 ffff8801321c5398 [ 494.611685] Call Trace: [ 494.632649] [<ffffffff8149dd25>] schedule+0x5a/0x5c [ 494.674687] [<ffffffff8104b968>] async_synchronize_cookie_domain+0xb6/0x112 [ 494.734177] [<ffffffff810461ff>] ? __init_waitqueue_head+0x50/0x50 [ 494.787134] [<ffffffff8131a224>] ? scsi_remove_target+0x48/0x48 [ 494.837900] [<ffffffff8104b9d9>] async_synchronize_cookie+0x15/0x17 [ 494.891567] [<ffffffff8104ba49>] async_synchronize_full+0x54/0x70 <-- here we wait for async contexts to complete [ 494.943783] [<ffffffff8104b9f5>] ? async_synchronize_full_domain+0x1a/0x1a [ 495.002547] [<ffffffffa00114b1>] sd_remove+0x2c/0xa2 [sd_mod] [ 495.051861] [<ffffffff812fe94f>] __device_release_driver+0x86/0xcf [ 495.104807] [<ffffffff812fe9bd>] device_release_driver+0x25/0x32 <-- here we take device_lock()
[ 853.511341] INFO: task kworker/u:4:549 blocked for more than 120 seconds. [ 853.568693] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 853.635119] kworker/u:4 D ffff88013097b5d0 0 549 2 0x00000000 [ 853.695129] ffff880132773c40 0000000000000046 ffff880130790000 ffff880132773fd8 [ 853.758990] ffff880132773fd8 0000000000012500 ffff88013288a0b0 ffff880130790000 [ 853.822796] 0000000000000246 0000000000000040 ffff88013097b5c8 ffff880130790000 [ 853.886633] Call Trace: [ 853.907631] [<ffffffff8149dd25>] schedule+0x5a/0x5c [ 853.949670] [<ffffffff8149cc44>] __mutex_lock_common+0x220/0x351 [ 854.001225] [<ffffffff81304bd7>] ? device_resume+0x58/0x1c4 [ 854.049082] [<ffffffff81304bd7>] ? device_resume+0x58/0x1c4 [ 854.097011] [<ffffffff8149ce48>] mutex_lock_nested+0x2f/0x36 <-- here we wait for device_lock() [ 854.145591] [<ffffffff81304bd7>] device_resume+0x58/0x1c4 [ 854.192066] [<ffffffff81304d61>] async_resume+0x1e/0x45 [ 854.237019] [<ffffffff8104bc93>] async_run_entry_fn+0xc6/0x173 <-- ...while running in async context
Provide a 'scsi_sd_probe_domain' so that async probe actions actions can be flushed without regard for the state of PM, and allow for the resume path to handle devices that have transitioned from SDEV_QUIESCE to SDEV_DEL prior to resume.
--- drivers/scsi/scsi.c | 4 ++++ drivers/scsi/scsi_lib.c | 10 +++++++--- drivers/scsi/scsi_pm.c | 2 +- drivers/scsi/scsi_priv.h | 2 ++ drivers/scsi/sd.c | 5 +++-- 5 files changed, 17 insertions(+), 6 deletions(-)
drivers/scsi/scsi.c +4 -0
@@ -90,6 +90,10 @@ unsigned int scsi_logging_level;EXPORT_SYMBOL (scsi_logging_level);#endif +/* sd and scsi_pm need to coordinate flushing async actions */ +LIST_HEAD (scsi_sd_probe_domain); +EXPORT_SYMBOL (scsi_sd_probe_domain); +/* NB: These are exposed through /proc/scsi/scsi and form part of the ABI. * You may not alter any existing entry (although adding new ones is * encouraged once assigned by ANSI/INCITS T10
drivers/scsi/scsi_lib.c +7 -3
@@ -2348,10 +2348,14 @@ EXPORT_SYMBOL(scsi_device_quiesce);* * Must be called with user context, may sleep. */ -void -scsi_device_resume (struct scsi_device *sdev) +void scsi_device_resume (struct scsi_device *sdev) { -if (scsi_device_set_state (sdev,SDEV_RUNNING )) +/* check if the device state was mutated prior to resume, and if +* so assume the state is being managed elsewhere (for example +* device deleted during suspend) +*/ +if (sdev->sdev_state !=SDEV_QUIESCE || +scsi_device_set_state (sdev,SDEV_RUNNING ))return ;scsi_run_queue (sdev->request_queue); }
drivers/scsi/scsi_pm.c +1 -1
@@ -97,7 +97,7 @@ static int scsi_bus_prepare(struct device *dev) {if (scsi_is_sdev_device (dev)) {/* sd probing uses async_schedule. Wait until it finishes. */ -async_synchronize_full (); +async_synchronize_full_domain (&scsi_sd_probe_domain); }else if (scsi_is_host_device (dev)) {/* Wait until async scanning is finished */
drivers/scsi/scsi_priv.h +2 -0
@@ -163,6 +163,8 @@ static inline int scsi_autopm_get_host(struct Scsi_Host *h) { return 0; }static inline void scsi_autopm_put_host (struct Scsi_Host *h) {}#endif /* CONFIG_PM_RUNTIME */ +extern struct list_head scsi_sd_probe_domain; +/* * internal scsi timeout functions: for use by mid-layer and transport * classes.
drivers/scsi/sd.c +3 -2
@@ -65,6 +65,7 @@#include <scsi/scsicam.h> #include "sd.h" +#include "scsi_priv.h" #include "scsi_logging.h" MODULE_AUTHOR ("Eric Youngdale" );
@@ -2722,7 +2723,7 @@ static int sd_probe(struct device *dev)dev_set_drvdata (dev, sdkp);get_device (&sdkp->dev);/* prevent release before async_schedule */ -async_schedule (sd_probe_async, sdkp); +async_schedule_domain (sd_probe_async, sdkp, &scsi_sd_probe_domain);return 0 ;
@@ -2756,7 +2757,7 @@ static int sd_remove(struct device *dev) sdkp =dev_get_drvdata (dev);scsi_autopm_get_device (sdkp->device); -async_synchronize_full (); +async_synchronize_full_domain (&scsi_sd_probe_domain);blk_queue_prep_rq (sdkp->device->request_queue, scsi_prep_fn);blk_queue_unprep_rq (sdkp->device->request_queue,NULL );device_del (&sdkp->dev);
PATCH 17/18 libsas: suspend / resume support
In reply to Dan Williamslibsas power management routines to suspend and recover the sas domain based on a model where the lldd is allowed and expected to be "forgetful".
sas_suspend_ha - disable event processing allowing the lldd to take down
links without concern for causing hotplug events. Regardless of whether the lldd actually posts link down messages libsas notifies the lldd that all domain_devices are gone.
sas_prep_resume_ha - on the way back up before the lldd starts link
training clean out any spurious events that were generated on the way down, and re-enable event processing
sas_resume_ha - after the lldd has started and decided that all phys
have posted link-up events this routine is called to let libsas start it's own timeout of any phys that did not resume. After the timeout an lldd can cancel the phy teardown by posting a link-up event.
Storage for ex_change_count (u16) and phy_change_count (u8) are changed to int so they can be set to -1 to indicate 'invalidated'.
--- drivers/scsi/libsas/sas_ata.c | 86 ++++++++++++++++++++++++++++++++++ drivers/scsi/libsas/sas_discover.c | 69 ++++++++++++++++++++++++---- drivers/scsi/libsas/sas_dump.c | 1 drivers/scsi/libsas/sas_event.c | 4 +- drivers/scsi/libsas/sas_init.c | 90 ++++++++++++++++++++++++++++++++++++ drivers/scsi/libsas/sas_internal.h | 1 drivers/scsi/libsas/sas_phy.c | 21 ++++++++ drivers/scsi/libsas/sas_port.c | 52 ++++++++++++++++++++- include/scsi/libsas.h | 20 ++++++-- include/scsi/sas_ata.h | 10 ++++ 10 files changed, 335 insertions(+), 19 deletions(-)
drivers/scsi/libsas/sas_ata.c +86 -0
@@ -700,6 +700,92 @@ void sas_probe_sata(struct asd_sas_port *port)if (ata_dev_disabled (sas_to_ata_dev (dev)))sas_fail_probe (dev, __func__, -ENODEV ); } + +} + +static bool sas_ata_flush_pm_eh (struct asd_sas_port *port,const char *func) +{ +struct domain_device *dev, *n; +bool retry = false; + +list_for_each_entry_safe (dev, n, &port->dev_list, dev_list_node) { +int rc; + +if (!dev_is_sata (dev)) +continue ; + +sas_ata_wait_eh (dev); + rc = dev->sata_dev.pm_result; +if (rc == -EAGAIN ) + retry = true; +else if (rc) { +/* since we don't have a +* ->port_{suspend|resume} routine in our +* ata_port ops, and no entanglements with +* acpi, suspend should just be mechanical trip +* through eh, catch cases where these +* assumptions are invalidated +*/ +WARN_ONCE (1 ,"failed %s %s error: %d\n" , func, +dev_name (&dev->rphy->dev), rc); + } + +/* if libata failed to power manage the device, tear it down */ +if (ata_dev_disabled (sas_to_ata_dev (dev))) +sas_fail_probe (dev, func, -ENODEV ); + } + +return retry; +} + +void sas_suspend_sata (struct asd_sas_port *port) +{ +struct domain_device *dev; + + retry: +mutex_lock (&port->ha->disco_mutex); +list_for_each_entry (dev, &port->dev_list, dev_list_node) { +struct sata_device *sata; + +if (!dev_is_sata (dev)) +continue ; + + sata = &dev->sata_dev; +if (sata->ap->pm_mesg.event ==PM_EVENT_SUSPEND ) +continue ; + + sata->pm_result = -EIO ; +ata_sas_port_async_suspend (sata->ap, &sata->pm_result); + } +mutex_unlock (&port->ha->disco_mutex); + +if (sas_ata_flush_pm_eh (port, __func__)) + goto retry; +} + +void sas_resume_sata (struct asd_sas_port *port) +{ +struct domain_device *dev; + + retry: +mutex_lock (&port->ha->disco_mutex); +list_for_each_entry (dev, &port->dev_list, dev_list_node) { +struct sata_device *sata; + +if (!dev_is_sata (dev)) +continue ; + + sata = &dev->sata_dev; +if (sata->ap->pm_mesg.event ==PM_EVENT_ON ) +continue ; + + sata->pm_result = -EIO ; +ata_sas_port_async_resume (sata->ap, &sata->pm_result); + } +mutex_unlock (&port->ha->disco_mutex); + +if (sas_ata_flush_pm_eh (port, __func__)) + goto retry; }/**
drivers/scsi/libsas/sas_discover.c +59 -10
100 lines not on this page · raw message
drivers/scsi/libsas/sas_dump.c +1 -0
@@ -41,6 +41,7 @@ static const char *sas_phye_str[] = { [1] = "PHYE_OOB_DONE", [2] = "PHYE_OOB_ERROR", [3] = "PHYE_SPINUP_HOLD", + [4] = "PHYE_RESUME_TIMEOUT", };void sas_dprint_porte (int phyid,enum port_event pe)
drivers/scsi/libsas/sas_event.c +2 -2
@@ -134,7 +134,7 @@ static void notify_port_event(struct asd_sas_phy *phy, enum port_event event) &phy->port_events[event].work, ha); } -static void notify_phy_event (struct asd_sas_phy *phy,enum phy_event event) +void sas_notify_phy_event (struct asd_sas_phy *phy,enum phy_event event) {struct sas_ha_struct *ha = phy->ha;
@@ -159,7 +159,7 @@ int sas_init_events(struct sas_ha_struct *sas_ha) sas_ha->notify_ha_event = notify_ha_event; sas_ha->notify_port_event = notify_port_event; - sas_ha->notify_phy_event = notify_phy_event; + sas_ha->notify_phy_event = sas_notify_phy_event;return 0 ; }
drivers/scsi/libsas/sas_init.c +89 -1
109 lines not on this page · raw message
drivers/scsi/libsas/sas_internal.h +1 -0
@@ -89,6 +89,7 @@ int sas_smp_phy_control(struct domain_device *dev, int phy_id, enum phy_func phy_func, struct sas_phy_linkrates *);int sas_smp_get_phy_events (struct sas_phy *phy); +void sas_notify_phy_event (struct asd_sas_phy *phy,enum phy_event event);void sas_device_set_phy (struct domain_device *dev,struct sas_port *port);struct domain_device *sas_find_dev_by_rphy (struct sas_rphy *rphy);struct domain_device *sas_ex_to_ata (struct domain_device *ex_dev,int phy_id);
drivers/scsi/libsas/sas_phy.c +21 -0
@@ -94,6 +94,25 @@ static void sas_phye_spinup_hold(struct work_struct *work) i->dft->lldd_control_phy (phy,PHY_FUNC_RELEASE_SPINUP_HOLD ,NULL ); } +static void sas_phye_resume_timeout (struct work_struct *work) +{ +struct asd_sas_event *ev =to_asd_sas_event (work); +struct asd_sas_phy *phy = ev->phy; + +clear_bit (PHYE_RESUME_TIMEOUT , &phy->phy_events_pending); + +/* phew, lldd got the phy back in the nick of time */ +if (!phy->suspended) { +dev_info (&phy->phy->dev,"resume timeout cancelled\n" ); +return ; + } + + phy->error =0 ; + phy->suspended =0 ; +sas_deform_port (phy,1 ); +} + +/* ---------- Phy class registration ---------- */ int sas_register_phys (struct sas_ha_struct *sas_ha)
@@ -105,6 +124,8 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) [PHYE_OOB_DONE] = sas_phye_oob_done, [PHYE_OOB_ERROR] = sas_phye_oob_error, [PHYE_SPINUP_HOLD] = sas_phye_spinup_hold, + [PHYE_RESUME_TIMEOUT] = sas_phye_resume_timeout, + };static const work_func_t sas_port_event_fns[PORT_NUM_EVENTS ] = {
drivers/scsi/libsas/sas_port.c +51 -1
64 lines not on this page · raw message
include/scsi/libsas.h +15 -5
@@ -79,7 +79,8 @@ enum phy_event {PHYE_OOB_DONE =1 ,PHYE_OOB_ERROR =2 ,PHYE_SPINUP_HOLD =3 ,/* hot plug SATA, no COMWAKE sent */ - PHY_NUM_EVENTS = 4, +PHYE_RESUME_TIMEOUT =4 , + PHY_NUM_EVENTS = 5, }; enum discover_event {
@@ -87,8 +88,10 @@ enum discover_event {DISCE_REVALIDATE_DOMAIN =1 ,DISCE_PORT_GONE =2 ,DISCE_PROBE =3 , -DISCE_DESTRUCT =4 , - DISC_NUM_EVENTS = 5, +DISCE_SUSPEND =4 , +DISCE_RESUME =5 , +DISCE_DESTRUCT =6 , + DISC_NUM_EVENTS = 7, };/* ---------- Expander Devices ---------- */
@@ -128,7 +131,7 @@ struct ex_phy {u8 attached_sas_addr[SAS_ADDR_SIZE ];u8 attached_phy_id; -u8 phy_change_count; +int phy_change_count;enum routing_attribute routing_attr; u8 virtual:1;
@@ -141,7 +144,7 @@ struct ex_phy {struct expander_device {struct list_head children; -u16 ex_change_count; +int ex_change_count;u16 max_route_indexes;u8 num_phys;
@@ -167,6 +170,7 @@ struct sata_device {enum ata_command_set command_set;struct smp_resp rps_resp;/* report_phy_sata_resp */ u8 port_no;/* port number, if this is a PM (Port) */ +int pm_result;struct ata_port *ap;struct ata_host ata_host;
@@ -180,6 +184,7 @@ struct ssp_device {enum {SAS_DEV_GONE , +SAS_DEV_FOUND ,/* device notified to lldd */ SAS_DEV_DESTROY ,SAS_DEV_EH_PENDING ,SAS_DEV_LU_RESET ,
@@ -271,6 +276,7 @@ struct asd_sas_port {enum sas_linkrate linkrate;struct sas_work work; +int suspended;/* public: */ int id;
@@ -319,6 +325,7 @@ struct asd_sas_phy {unsigned long phy_events_pending;int error; +int suspended;struct sas_phy *phy;
@@ -685,6 +692,9 @@ struct sas_domain_function_template {extern int sas_register_ha (struct sas_ha_struct *);extern int sas_unregister_ha (struct sas_ha_struct *); +extern void sas_prep_resume_ha (struct sas_ha_struct *sas_ha); +extern void sas_resume_ha (struct sas_ha_struct *sas_ha); +extern void sas_suspend_ha (struct sas_ha_struct *sas_ha);int sas_set_phy_speed (struct sas_phy *phy,struct sas_phy_linkrates *rates);
include/scsi/sas_ata.h +10 -0
@@ -45,6 +45,8 @@ void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,void sas_ata_schedule_reset (struct domain_device *dev);void sas_ata_wait_eh (struct domain_device *dev);void sas_probe_sata (struct asd_sas_port *port); +void sas_suspend_sata (struct asd_sas_port *port); +void sas_resume_sata (struct asd_sas_port *port);void sas_ata_end_eh (struct ata_port *ap);#else
@@ -82,6 +84,14 @@ static inline void sas_probe_sata(struct asd_sas_port *port) { } +static inline void sas_suspend_sata (struct asd_sas_port *port) +{ +} + +static inline void sas_resume_sata (struct asd_sas_port *port) +{ +} +static inline int sas_get_ata_info (struct domain_device *dev,struct ex_phy *phy) {return 0 ;
PATCH 18/18 scsi: cleanup setting task state in scsi_error_handler()
In reply to Dan WilliamsReading scsi_error_handler() one could easily come away with the impression that it does its wakeup event check while the task state is TASK_RUNNING. In fact it sets TASK_INTERRUPTIBLE at the bottom of the loop, but that is ~50 lines down.
Just set TASK_INTERRUPTIBLE at the top of loop and be done.
--- drivers/scsi/scsi_error.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/scsi_error.c +1 -4
@@ -1818,15 +1818,14 @@ int scsi_error_handler(void *data)* We never actually get interrupted because kthread_run * disables signal delivery for the created thread. */ -set_current_state (TASK_INTERRUPTIBLE );while (!kthread_should_stop ()) { +set_current_state (TASK_INTERRUPTIBLE );if ((shost->host_failed ==0 && shost->host_eh_scheduled ==0 ) || shost->host_failed != shost->host_busy) {SCSI_LOG_ERROR_RECOVERY (1 ,printk ("Error handler scsi_eh_%d sleeping\n" , shost->host_no));schedule (); -set_current_state (TASK_INTERRUPTIBLE );continue ; }
@@ -1863,9 +1862,7 @@ int scsi_error_handler(void *data)scsi_restart_operations (shost);if (!shost->eh_noresume)scsi_autopm_put_host (shost); -set_current_state (TASK_INTERRUPTIBLE ); } -__set_current_state (TASK_RUNNING );SCSI_LOG_ERROR_RECOVERY (1 ,printk ("Error handler scsi_eh_%d exiting\n" , shost->host_no));
Quoted 11 lines · Dan Williams
1/ libsas suspend/resume support
2/ finish off the conversion of the strategy handlers to enforce only invoking them in eh context (to meet libata's expectations).
3/ a collection of discovery fixes, error handling fixes, and miscellaneous cleanups
All of these patches, save for patch 18, are on their 2nd or 3rd resend. These have been soaking in -next since before the 3.4 merge window opened.
...and it seems these will get to sit out another kernel
Please comment on these, I'd like to know which are NAK'd vs just ran out of time to be integrated this round. Jeff, some comments about patch 12 and 14 below for you.
Can we at least get libsas suspend / resume support applied for 3.5? If that's agreeable I'll put together a pared down pull-request??
Quoted 1 line
[PATCH 01/18] libsas: cleanup spurious calls to
scsi_schedule_eh
A misuse of scsi_schedule_eh(), part of the effort to make sure host_eh_scheduled is managed properly, but for now it's just cleanup material because I have not root caused a test failure back to this misuse.
Quoted 1 line
[PATCH 02/18] libata, libsas: introduce
sched_ehandend_ehport ops
This was acked-by Jeff, not sure what the hold up is.
Quoted 1 line
[PATCH 03/18] scsi: fix eh wakeup (
scsi_schedule_ehvsscsi_restart_operations)
You had comments about this patch, I responded and then the communication stopped.
Quoted 1 line
[PATCH 04/18]
scsi_transport_sas: fix delete vs scan race
I have a new version under test after review feedback from Mike.
Quoted 4 lines
[PATCH 05/18] libsas: enforce eh strategy handlers only in eh context [PATCH 06/18] libsas: add
sas_eh_abort_handler
[PATCH 07/18] libsas: use ->lldd_I_T_nexus_reset for ->eh_bus_reset_handler [PATCH 08/18] isci: use sas eh strategy handlers
These are fixups to make sure the eh strategy handlers are called in the proper context and that tasks are not terminated outside of visibilty of the lldd.
Quoted 3 lines
[PATCH 09/18] libsas: trim
sas_taskof slow path infrastructure [PATCH 10/18] libsas:sas_rediscover_devdid not look at the SMP exec status. [PATCH 11/18] mvsas: remove unused variable inmvs_task_exec()
Minor clean up and fixlets.
Quoted 1 line
[PATCH 12/18] libata: reset once
Jeff, any objections on this one?
Quoted 1 line
[PATCH 13/18] libsas: continue revalidation
Discovery ends too early in some configurations, this could be -stable material.
Quoted 1 line
[PATCH 14/18] libata: export
ata_portsuspend/resume infrastructure for sas
This plus patch 17 and a small enabling patch for isci and we have our first tested libsas suspend / resume implementation in the kernel. Needs an ack from Jeff.
Quoted 1 line
[PATCH 15/18] libsas: drop sata port multiplier infrastructure
Minor cleanup.
Quoted 1 line
[PATCH 16/18] scsi, sd: limit the scope of the async probe domain
Yea! 1 for 18 going upstream! Sorry, couldn't resist :-).
Quoted 1 line
[PATCH 17/18] libsas: suspend / resume support
The aforementioned suspend / resume support. I believe pm8001 is ready to take advantage of this because their current hack is not reliably working.
Quoted 1 line
[PATCH 18/18] scsi: cleanup setting task state in
scsi_error_handler()
Just a cleanup, whenever it goes in is fine.
--
Dan
Quoted 6 lines
Quoted 1 line
[PATCH 17/18] libsas: suspend / resume support
The aforementioned suspend / resume support. I believe pm8001 is ready to take advantage of this because their current hack is not reliably working.
[Jack Wang] Yes, this really help to fix suspend/resume support in pm8001, I'll be glad to see this patch and all this patch set in, just my 0.007 cent.