Message ID | 1450382231-4259-12-git-send-email-himanshu.madhani@qlogic.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
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 > > Signed-off-by: Quinn Tran <quinn.tran@qlogic.com> > Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> > --- > drivers/scsi/qla2xxx/qla_isr.c | 2 +- > drivers/scsi/qla2xxx/qla_target.c | 13 ++++++++++++- > drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 ++-- > drivers/target/target_core_transport.c | 5 ++++- > include/target/target_core_base.h | 1 + > 5 files changed, 20 insertions(+), 5 deletions(-) > > diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c > index cf0fe8e..3e89122 100644 > --- a/drivers/scsi/qla2xxx/qla_isr.c > +++ b/drivers/scsi/qla2xxx/qla_isr.c > @@ -3302,7 +3302,7 @@ static void qla_irq_affinity_notify(struct irq_affinity_notify *notify, > } > } > > -void qla_irq_affinity_release(struct kref *ref) > +static void qla_irq_affinity_release(struct kref *ref) > { > struct irq_affinity_notify *notify = > container_of(ref, struct irq_affinity_notify, kref); > diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c > index 9a4aed0..d3cd271 100644 > --- a/drivers/scsi/qla2xxx/qla_target.c > +++ b/drivers/scsi/qla2xxx/qla_target.c > @@ -3982,13 +3982,24 @@ 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 = -1; Please use WORK_CPU_UNBOUND instead of -1. That will allow to convert the if (cpuid == -1) queue_work() else queue_work_on() constructs into a single queue_work_on() call. Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 12/17/2015 08:57 PM, Himanshu Madhani wrote: > diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c > index 9a4aed0..d3cd271 100644 > --- a/drivers/scsi/qla2xxx/qla_target.c > +++ b/drivers/scsi/qla2xxx/qla_target.c > @@ -3982,13 +3982,24 @@ 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 = -1; A second comment about this patch: this initialization code must be moved to the target core (transport_init_se_cmd()). Otherwise the cpuid member variable won't be initialized when target_complete_cmd() is called for another target driver than tcm_qla2xxx. Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> drivers/scsi/qla2xxx/qla_isr.c | 2 +- > drivers/scsi/qla2xxx/qla_target.c | 13 ++++++++++++- > drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 ++-- > drivers/target/target_core_transport.c | 5 ++++- > include/target/target_core_base.h | 1 + please split out target core changes from your drivers bits into a separate patch! > cmd->cmd_in_wq = 1; > cmd->cmd_flags |= BIT_0; > + cmd->se_cmd.cpuid = -1; As Bart pointed out please use the proper constants. Also make sure this is initialized in the core target code instad of here. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index cf0fe8e..3e89122 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3302,7 +3302,7 @@ static void qla_irq_affinity_notify(struct irq_affinity_notify *notify, } } -void qla_irq_affinity_release(struct kref *ref) +static void qla_irq_affinity_release(struct kref *ref) { struct irq_affinity_notify *notify = container_of(ref, struct irq_affinity_notify, kref); diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 9a4aed0..d3cd271 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -3982,13 +3982,24 @@ 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 = -1; 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); + if (ha->msix_count) { + cmd->se_cmd.cpuid = ha->tgt.rspq_vector_cpuid; + if (cmd->atio.u.isp24.fcp_cmnd.rddata) + queue_work_on(smp_processor_id(), qla_tgt_wq, + &cmd->work); + else + queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq, + &cmd->work); + } else { + queue_work(qla_tgt_wq, &cmd->work); + } return 0; } diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 2d185bc..faf0a12 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -299,7 +299,7 @@ static void tcm_qla2xxx_free_cmd(struct qla_tgt_cmd *cmd) cmd->vha->tgt_counters.core_qla_free_cmd++; cmd->cmd_in_wq = 1; INIT_WORK(&cmd->work, tcm_qla2xxx_complete_free); - queue_work(tcm_qla2xxx_free_wq, &cmd->work); + queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work); } /* @@ -504,7 +504,7 @@ static void tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd) cmd->cmd_flags |= BIT_10; cmd->cmd_in_wq = 1; INIT_WORK(&cmd->work, tcm_qla2xxx_handle_data_work); - queue_work(tcm_qla2xxx_free_wq, &cmd->work); + queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work); } static void tcm_qla2xxx_handle_dif_work(struct work_struct *work) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 4fdcee2..b5158a4 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -715,7 +715,10 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) cmd->transport_state |= (CMD_T_COMPLETE | CMD_T_ACTIVE); spin_unlock_irqrestore(&cmd->t_state_lock, flags); - queue_work(target_completion_wq, &cmd->work); + if (cmd->cpuid == -1) + queue_work(target_completion_wq, &cmd->work); + else + queue_work_on(cmd->cpuid, target_completion_wq, &cmd->work); } EXPORT_SYMBOL(target_complete_cmd); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index aabf0ac..3310ef1 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -526,6 +526,7 @@ struct se_cmd { unsigned int t_prot_nents; sense_reason_t pi_err; sector_t bad_sector; + int cpuid; }; struct se_ua {