diff mbox series

[09/15] scsi: libsas: Resume sas host before sending SMP IOs

Message ID 1637117108-230103-10-git-send-email-chenxiang66@hisilicon.com (mailing list archive)
State Changes Requested
Headers show
Series Add runtime PM support for libsas | expand

Commit Message

chenxiang Nov. 17, 2021, 2:45 a.m. UTC
From: Xiang Chen <chenxiang66@hisilicon.com>

Need to resume sas host before sending SMP IOs to ensure that
SMP IOs are sent sucessfully.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Reviewed-by: John Garry <john.garry@huawei.com>
---
 drivers/scsi/libsas/sas_expander.c | 3 +++
 drivers/scsi/libsas/sas_internal.h | 1 +
 2 files changed, 4 insertions(+)

Comments

John Garry Dec. 13, 2021, 11:12 a.m. UTC | #1
Please consider these points:

About "scsi: libsas: Resume sas host before sending SMP IOs", just have 
"Resume host while sending SMP IOs"

On 17/11/2021 02:45, chenxiang wrote:
> From: Xiang Chen<chenxiang66@hisilicon.com>
> 
> Need to resume sas host before sending SMP IOs to ensure that
> SMP IOs are sent sucessfully.

successfully

 >

When sending SMP IOs to the host we need to ensure that that host is not 
suspended and may handle the commands. This is a better approach than 
relying on the host to resume itself to handle such commands. So use 
pm_runtime_get_sync() and pm_runtime_get_sync() calls for the host when 
executing SMP tasks.

> 
> Signed-off-by: Xiang Chen<chenxiang66@hisilicon.com>
> Reviewed-by: John Garry<john.garry@huawei.com>
chenxiang Dec. 15, 2021, 8 a.m. UTC | #2
在 2021/12/13 19:12, John Garry 写道:
> Please consider these points:
>

> About "scsi: libsas: Resume sas host before sending SMP IOs", just 
> have "Resume host while sending SMP IOs"
>
> On 17/11/2021 02:45, chenxiang wrote:
>> From: Xiang Chen<chenxiang66@hisilicon.com>
>>
>> Need to resume sas host before sending SMP IOs to ensure that
>> SMP IOs are sent sucessfully.
>
> successfully

ok

>
> >
>
> When sending SMP IOs to the host we need to ensure that that host is 
> not suspended and may handle the commands. This is a better approach 
> than relying on the host to resume itself to handle such commands. So 
> use pm_runtime_get_sync() and pm_runtime_get_sync() calls for the host 
> when executing SMP tasks.

Ok, i will rewrite it.

>
>>
>> Signed-off-by: Xiang Chen<chenxiang66@hisilicon.com>
>> Reviewed-by: John Garry<john.garry@huawei.com>
>
>
> .
>
diff mbox series

Patch

diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index c2150a818423..6abce9dfc17b 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -58,7 +58,9 @@  static int smp_execute_task_sg(struct domain_device *dev,
 	struct sas_task *task = NULL;
 	struct sas_internal *i =
 		to_sas_internal(dev->port->ha->core.shost->transportt);
+	struct sas_ha_struct *ha = dev->port->ha;
 
+	pm_runtime_get_sync(ha->dev);
 	mutex_lock(&dev->ex_dev.cmd_mutex);
 	for (retry = 0; retry < 3; retry++) {
 		if (test_bit(SAS_DEV_GONE, &dev->state)) {
@@ -131,6 +133,7 @@  static int smp_execute_task_sg(struct domain_device *dev,
 		}
 	}
 	mutex_unlock(&dev->ex_dev.cmd_mutex);
+	pm_runtime_put_sync(ha->dev);
 
 	BUG_ON(retry == 3 && task != NULL);
 	sas_free_task(task);
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h
index d7a1fb5c10c6..ad9764a976c3 100644
--- a/drivers/scsi/libsas/sas_internal.h
+++ b/drivers/scsi/libsas/sas_internal.h
@@ -14,6 +14,7 @@ 
 #include <scsi/scsi_transport_sas.h>
 #include <scsi/libsas.h>
 #include <scsi/sas_ata.h>
+#include <linux/pm_runtime.h>
 
 #ifdef pr_fmt
 #undef pr_fmt