linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: Himanshu Madhani <himanshu.madhani@qlogic.com>,
	target-devel@vger.kernel.org, nab@linux-iscsi.org
Cc: giridhar.malavali@qlogic.com, linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2 11/16] qla2xxx: Add selective command queuing
Date: Tue, 29 Dec 2015 10:32:03 +0100	[thread overview]
Message-ID: <56825313.4080405@sandisk.com> (raw)
In-Reply-To: <1450382231-4259-12-git-send-email-himanshu.madhani@qlogic.com>

On 12/17/2015 08:57 PM, Himanshu Madhani wrote:
> From: Quinn Tran <quinn.tran@qlogic.com>
> 
> queue work element to specific process lessen cache miss

How about replacing this patch by something like the (untested) patch
below ? The advantage of the patch below is that it doesn't require to
modify other target driver to keep their current behavior.

Thanks,

Bart.

---
 drivers/scsi/qla2xxx/qla_target.c      | 5 ++++-
 drivers/scsi/qla2xxx/tcm_qla2xxx.c     | 2 +-
 drivers/target/target_core_transport.c | 4 +++-
 include/target/target_core_base.h      | 2 ++
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 83214fc..1bd1511 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3982,13 +3982,16 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha,
 
 	cmd->cmd_in_wq = 1;
 	cmd->cmd_flags |= BIT_0;
+	cmd->se_cmd.cpuid = (ha->msix_count &&
+			     !cmd->atio.u.isp24.fcp_cmnd.rddata) ?
+		ha->tgt.rspq_vector_cpuid : WORK_CPU_UNBOUND;
 
 	spin_lock(&vha->cmd_list_lock);
 	list_add_tail(&cmd->cmd_list, &vha->qla_cmd_list);
 	spin_unlock(&vha->cmd_list_lock);
 
 	INIT_WORK(&cmd->work, qlt_do_work);
-	queue_work(qla_tgt_wq, &cmd->work);
+	queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq, &cmd->work);
 	return 0;
 
 }
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index a6fd02a..e65ba34 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -419,7 +419,7 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,
 	struct se_cmd *se_cmd = &cmd->se_cmd;
 	struct se_session *se_sess;
 	struct qla_tgt_sess *sess;
-	int flags = TARGET_SCF_ACK_KREF;
+	int flags = TARGET_SCF_ACK_KREF | TARGET_SCF_USE_CPUID;
 
 	if (bidi)
 		flags |= TARGET_SCF_BIDI_OP;
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index a8e21fb..3b1a002 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -681,7 +681,7 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
 	cmd->transport_state |= CMD_T_COMPLETE;
 	spin_unlock_irqrestore(&cmd->t_state_lock, flags);
 
-	queue_work(target_completion_wq, &cmd->work);
+	queue_work_on(cmd->cpuid, target_completion_wq, &cmd->work);
 }
 EXPORT_SYMBOL(target_complete_cmd);
 
@@ -1390,6 +1390,8 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess
 	 */
 	transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess,
 				data_length, data_dir, task_attr, sense);
+	if (!(flags & TARGET_SCF_USE_CPUID))
+		se_cmd->cpuid = WORK_CPU_UNBOUND;
 	if (flags & TARGET_SCF_UNKNOWN_SIZE)
 		se_cmd->unknown_data_length = 1;
 	/*
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index e9e507a..38a1871 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -186,6 +186,7 @@ enum target_sc_flags_table {
 	TARGET_SCF_BIDI_OP		= 0x01,
 	TARGET_SCF_ACK_KREF		= 0x02,
 	TARGET_SCF_UNKNOWN_SIZE		= 0x04,
+	TARGET_SCF_USE_CPUID		= 0x08,
 };
 
 /* fabric independent task management function values */
@@ -519,6 +520,7 @@ struct se_cmd {
 	unsigned int		t_prot_nents;
 	sense_reason_t		pi_err;
 	sector_t		bad_sector;
+	int			cpuid;
 };
 
 struct se_ua {
-- 
2.1.4


  parent reply	other threads:[~2015-12-29  9:32 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17 19:56 [PATCH v2 00/16] qla2xxx: Patches for target-pending branch Himanshu Madhani
2015-12-17 19:56 ` [PATCH v2 01/16] qla2xxx: Enable Extended Logins support Himanshu Madhani
2015-12-17 19:56 ` [PATCH v2 02/16] qla2xxx: Enable Exchange offload support Himanshu Madhani
2015-12-17 19:56 ` [PATCH v2 03/16] qla2xxx: Enable Target counters in DebugFS Himanshu Madhani
2015-12-17 19:56 ` [PATCH v2 04/16] qla2xxx: Add FW resource count " Himanshu Madhani
2015-12-17 19:57 ` [PATCH v2 05/16] qla2xxx: Added interface to send explicit LOGO Himanshu Madhani
2015-12-17 19:57 ` [PATCH v2 06/16] qla2xxx: Delete session if initiator is gone from FW Himanshu Madhani
2015-12-17 19:57 ` [PATCH v2 07/16] qla2xxx: Wait for all conflicts before ack'ing PLOGI Himanshu Madhani
2015-12-17 19:57 ` [PATCH v2 08/16] qla2xxx: Replace QLA_TGT_STATE_ABORTED with a bit Himanshu Madhani
2015-12-17 19:57 ` [PATCH v2 09/16] qla2xxx: Remove dependency on hardware_lock to reduce lock contention Himanshu Madhani
2015-12-17 19:57 ` [PATCH v2 10/16] qla2xxx: Add irq affinity notification Himanshu Madhani
2015-12-17 19:57 ` [PATCH v2 11/16] qla2xxx: Add selective command queuing Himanshu Madhani
2015-12-29  8:30   ` Bart Van Assche
2015-12-29  8:38   ` Bart Van Assche
2015-12-29  9:32   ` Bart Van Assche [this message]
2016-01-04 19:04     ` Quinn Tran
2015-12-30 10:27   ` Christoph Hellwig
2015-12-17 19:57 ` [PATCH v2 12/16] qla2xxx: Move atioq to a different lock to reduce lock contention Himanshu Madhani
2015-12-17 19:57 ` [PATCH v2 13/16] qla2xxx: Disable ZIO at start time Himanshu Madhani
2015-12-17 19:57 ` [PATCH v2 14/16] qla2xxx: Set all queues to 4k Himanshu Madhani
2015-12-17 19:57 ` [PATCH v2 15/16] qla2xxx: Add bulk send for atio & ctio completion paths Himanshu Madhani
2015-12-21  7:13   ` Nicholas A. Bellinger
2016-01-04 18:27     ` Quinn Tran
2016-01-06  6:07       ` Christoph Hellwig
2015-12-17 19:57 ` [PATCH v2 16/16] qla2xxx: Check for online flag instead of active reset when transmitting responses Himanshu Madhani
2015-12-21  6:57 ` [PATCH v2 00/16] qla2xxx: Patches for target-pending branch Nicholas A. Bellinger
2016-01-06 17:00   ` Himanshu Madhani
2016-01-06 19:01     ` Nicholas A. Bellinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56825313.4080405@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=giridhar.malavali@qlogic.com \
    --cc=himanshu.madhani@qlogic.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).