All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: register sysfs for scsi workqueue
@ 2020-06-03  7:06 Bob Liu
  2020-06-04 16:33 ` Mike Christie
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Liu @ 2020-06-03  7:06 UTC (permalink / raw)
  To: linux-scsi; +Cc: martin.petersen, Bob Liu

This patch enable setting cpu affinity through "cpumask" for scsi workqueues
(scsi_wq_* and scsi_tmf_*), so as to get better isolation.

The max number of active worker was changed form 1 to 2, since "cpumask" of
ordered workqueue isn't allowed to change.

__WQ_LEGACY was left because of
23d11a5(workqueue: skip flush dependency checks for legacy workqueues)

Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
 drivers/scsi/hosts.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 1d669e4..aa48142 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -272,8 +272,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 	if (shost->transportt->create_work_queue) {
 		snprintf(shost->work_q_name, sizeof(shost->work_q_name),
 			 "scsi_wq_%d", shost->host_no);
-		shost->work_q = create_singlethread_workqueue(
-					shost->work_q_name);
+		shost->work_q = alloc_workqueue("%s",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
+			2, shost->work_q_name);
+
 		if (!shost->work_q) {
 			error = -EINVAL;
 			goto out_free_shost_data;
@@ -487,8 +489,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	}
 
 	shost->tmf_work_q = alloc_workqueue("scsi_tmf_%d",
-					    WQ_UNBOUND | WQ_MEM_RECLAIM,
-					   1, shost->host_no);
+			WQ_SYSFS | WQ_UNBOUND | WQ_MEM_RECLAIM, 2, shost->host_no);
 	if (!shost->tmf_work_q) {
 		shost_printk(KERN_WARNING, shost,
 			     "failed to create tmf workq\n");
-- 
2.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: register sysfs for scsi workqueue
  2020-06-03  7:06 [PATCH] scsi: register sysfs for scsi workqueue Bob Liu
@ 2020-06-04 16:33 ` Mike Christie
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Christie @ 2020-06-04 16:33 UTC (permalink / raw)
  To: Bob Liu, linux-scsi; +Cc: martin.petersen



On 6/3/20 2:06 AM, Bob Liu wrote:
> This patch enable setting cpu affinity through "cpumask" for scsi workqueues
> (scsi_wq_* and scsi_tmf_*), so as to get better isolation.
> 
> The max number of active worker was changed form 1 to 2, since "cpumask" of
> ordered workqueue isn't allowed to change.

Do we just want to set it to 0? For all users but iscsi we use it for 
scanning. With 0, we can multiple rports/sessions in parallel.

For iscsi we do scanning and also unbinding (target removal) from it. It 
looks like we have the big iscsi_host mutex, so it would not help.

For the fc drivers that only scan through the fc class, we look ok. I 
think we want to flush/cancel the specific scan work item instead of 
flushing the entire workqueue when we are only concerned with a specific 
port in fc_rport_final_delete (the host removal we want to still do the 
entire workqueue). I think we want to do the same in snic snic_tgt_del.

For zfcp, I have no idea. You should cc them.


> 
> __WQ_LEGACY was left because of
> 23d11a5(workqueue: skip flush dependency checks for legacy workqueues)
> 
> Signed-off-by: Bob Liu <bob.liu@oracle.com>
> ---
>   drivers/scsi/hosts.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
> index 1d669e4..aa48142 100644
> --- a/drivers/scsi/hosts.c
> +++ b/drivers/scsi/hosts.c
> @@ -272,8 +272,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
>   	if (shost->transportt->create_work_queue) {
>   		snprintf(shost->work_q_name, sizeof(shost->work_q_name),
>   			 "scsi_wq_%d", shost->host_no);
> -		shost->work_q = create_singlethread_workqueue(
> -					shost->work_q_name);
> +		shost->work_q = alloc_workqueue("%s",
> +			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
> +			2, shost->work_q_name);
> +
>   		if (!shost->work_q) {
>   			error = -EINVAL;
>   			goto out_free_shost_data;
> @@ -487,8 +489,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
>   	}
>   
>   	shost->tmf_work_q = alloc_workqueue("scsi_tmf_%d",
> -					    WQ_UNBOUND | WQ_MEM_RECLAIM,
> -					   1, shost->host_no);
> +			WQ_SYSFS | WQ_UNBOUND | WQ_MEM_RECLAIM, 2, shost->host_no);
>   	if (!shost->tmf_work_q) {
>   		shost_printk(KERN_WARNING, shost,
>   			     "failed to create tmf workq\n");
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-04 16:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03  7:06 [PATCH] scsi: register sysfs for scsi workqueue Bob Liu
2020-06-04 16:33 ` Mike Christie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.