Message ID | 20231027180302.418676-10-kartilak@cisco.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Introduce support for multiqueue (MQ) in fnic | expand |
On 10/27/23 20:02, Karan Tilak Kumar wrote: > Remove usage of host_lock. > Replace with fnic_lock, where necessary. > > Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com> > Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com> > Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com> > --- > drivers/scsi/fnic/fnic_scsi.c | 27 ++++++--------------------- > 1 file changed, 6 insertions(+), 21 deletions(-) > > diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c > index f32781f8fdd0..9a1beb3e7269 100644 > --- a/drivers/scsi/fnic/fnic_scsi.c > +++ b/drivers/scsi/fnic/fnic_scsi.c > @@ -170,17 +170,14 @@ __fnic_set_state_flags(struct fnic *fnic, unsigned long st_flags, > unsigned long clearbits) > { > unsigned long flags = 0; > - unsigned long host_lock_flags = 0; > > spin_lock_irqsave(&fnic->fnic_lock, flags); > - spin_lock_irqsave(fnic->lport->host->host_lock, host_lock_flags); > > if (clearbits) > fnic->state_flags &= ~st_flags; > else > fnic->state_flags |= st_flags; > > - spin_unlock_irqrestore(fnic->lport->host->host_lock, host_lock_flags); > spin_unlock_irqrestore(&fnic->fnic_lock, flags); > > return; > @@ -479,12 +476,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) > > atomic_inc(&fnic->in_flight); > > - /* > - * Release host lock, use driver resource specific locks from here. > - * Don't re-enable interrupts in case they were disabled prior to the > - * caller disabling them. > - */ > - spin_unlock(lp->host->host_lock); > fnic_priv(sc)->state = FNIC_IOREQ_NOT_INITED; > fnic_priv(sc)->flags = FNIC_NO_FLAGS; > > @@ -569,8 +560,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) > mempool_free(io_req, fnic->io_req_pool); > } > atomic_dec(&fnic->in_flight); > - /* acquire host lock before returning to SCSI */ > - spin_lock(lp->host->host_lock); > return ret; > } else { > atomic64_inc(&fnic_stats->io_stats.active_ios); > @@ -598,8 +587,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) > spin_unlock_irqrestore(io_lock, flags); > > atomic_dec(&fnic->in_flight); > - /* acquire host lock before returning to SCSI */ > - spin_lock(lp->host->host_lock); > return ret; > } > If you remove the need for the host_lock during queuecommand() in your driver please rename 'fnic_queuecommand_lck()' to 'fnic_queuecommand()' and remove the line DEF_SCSI_QCMD(fnic_queuecommand) Cheers, Hannes
On Thursday, November 2, 2023 12:53 AM, Hannes Reinecke <hare@suse.de> wrote: > If you remove the need for the host_lock during queuecommand() in your driver please rename 'fnic_queuecommand_lck()' to 'fnic_queuecommand()' > and remove the line > > DEF_SCSI_QCMD(fnic_queuecommand) This change has been made in patch 12/13. In v3, I've merged patch 9(scsi: fnic: Remove usage of host_lock) with patch 11 (scsi: fnic: Use fnic_lock to protect fnic structures in queuecommand). Regards, Karan
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index f32781f8fdd0..9a1beb3e7269 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -170,17 +170,14 @@ __fnic_set_state_flags(struct fnic *fnic, unsigned long st_flags, unsigned long clearbits) { unsigned long flags = 0; - unsigned long host_lock_flags = 0; spin_lock_irqsave(&fnic->fnic_lock, flags); - spin_lock_irqsave(fnic->lport->host->host_lock, host_lock_flags); if (clearbits) fnic->state_flags &= ~st_flags; else fnic->state_flags |= st_flags; - spin_unlock_irqrestore(fnic->lport->host->host_lock, host_lock_flags); spin_unlock_irqrestore(&fnic->fnic_lock, flags); return; @@ -479,12 +476,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) atomic_inc(&fnic->in_flight); - /* - * Release host lock, use driver resource specific locks from here. - * Don't re-enable interrupts in case they were disabled prior to the - * caller disabling them. - */ - spin_unlock(lp->host->host_lock); fnic_priv(sc)->state = FNIC_IOREQ_NOT_INITED; fnic_priv(sc)->flags = FNIC_NO_FLAGS; @@ -569,8 +560,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) mempool_free(io_req, fnic->io_req_pool); } atomic_dec(&fnic->in_flight); - /* acquire host lock before returning to SCSI */ - spin_lock(lp->host->host_lock); return ret; } else { atomic64_inc(&fnic_stats->io_stats.active_ios); @@ -598,8 +587,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) spin_unlock_irqrestore(io_lock, flags); atomic_dec(&fnic->in_flight); - /* acquire host lock before returning to SCSI */ - spin_lock(lp->host->host_lock); return ret; } @@ -1477,18 +1464,17 @@ static inline int fnic_queue_abort_io_req(struct fnic *fnic, int tag, struct fnic_io_req *io_req) { struct vnic_wq_copy *wq = &fnic->hw_copy_wq[0]; - struct Scsi_Host *host = fnic->lport->host; struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats; unsigned long flags; - spin_lock_irqsave(host->host_lock, flags); + spin_lock_irqsave(&fnic->fnic_lock, flags); if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED))) { - spin_unlock_irqrestore(host->host_lock, flags); + spin_unlock_irqrestore(&fnic->fnic_lock, flags); return 1; } else atomic_inc(&fnic->in_flight); - spin_unlock_irqrestore(host->host_lock, flags); + spin_unlock_irqrestore(&fnic->fnic_lock, flags); spin_lock_irqsave(&fnic->wq_copy_lock[0], flags); @@ -1923,20 +1909,19 @@ static inline int fnic_queue_dr_io_req(struct fnic *fnic, struct fnic_io_req *io_req) { struct vnic_wq_copy *wq = &fnic->hw_copy_wq[0]; - struct Scsi_Host *host = fnic->lport->host; struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats; struct scsi_lun fc_lun; int ret = 0; unsigned long intr_flags; - spin_lock_irqsave(host->host_lock, intr_flags); + spin_lock_irqsave(&fnic->fnic_lock, intr_flags); if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED))) { - spin_unlock_irqrestore(host->host_lock, intr_flags); + spin_unlock_irqrestore(&fnic->fnic_lock, intr_flags); return FAILED; } else atomic_inc(&fnic->in_flight); - spin_unlock_irqrestore(host->host_lock, intr_flags); + spin_unlock_irqrestore(&fnic->fnic_lock, intr_flags); spin_lock_irqsave(&fnic->wq_copy_lock[0], intr_flags);