lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 19 Dec 2010 17:07:43 -0800
From:	"Nicholas A. Bellinger" <nab@...ux-iscsi.org>
To:	Matthew Wilcox <matthew@....cx>
Cc:	linux-scsi <linux-scsi@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	James Bottomley <James.Bottomley@...e.de>,
	Jeff Garzik <jeff@...zik.org>, Christoph Hellwig <hch@....de>,
	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
	Hannes Reinecke <hare@...e.de>,
	Mike Christie <michaelc@...wisc.edu>,
	Mike Anderson <andmike@...ux.vnet.ibm.com>,
	Tejun Heo <tj@...nel.org>, Vasu Dev <vasu.dev@...ux.intel.com>,
	Tim Chen <tim.c.chen@...ux.intel.com>,
	Andi Kleen <ak@...ux.intel.com>,
	Ravi Anand <ravi.anand@...gic.com>,
	Andrew Vasquez <andrew.vasquez@...gic.com>,
	Joe Eykholt <jeykholt@...co.com>,
	James Smart <james.smart@...lex.com>,
	Douglas Gilbert <dgilbert@...erlog.com>,
	adam radford <aradford@...il.com>,
	Kashyap Desai <Kashyap.Desai@....com>,
	MPTFusionLinux <DL-MPTFusionLinux@....com>
Subject: Re: [PATCH 07/12] qla2xxx: Convert to host_lock less w/ interrupts
	disabled externally

On Sun, 2010-12-19 at 16:11 -0700, Matthew Wilcox wrote:
> On Sun, Dec 19, 2010 at 01:22:02PM -0800, Nicholas A. Bellinger wrote:
> > This patch converts qla2xxx to run in host_lock less mode with the new
> > IRQ_DISABLE_SCSI_QCMD() that disables interrupts while calling ->queuecommand()
> > dispatch.  It also drops the legacy host_lock unlock optimization.
> 
> I'm not sure this is the right direction to go.  Now that Jeff's done
> the pushdown and put in the compatibility macros, I don't think it makes
> sense to do another partial transition on each driver.  Much better to
> take our time, analyse each driver thoroughly, and kill the DEF_SCSI_QCMD
> in each driver without introducing IRQ_DISABLE_SCSI_QCMD.

Yes, the LLDs using IRQ_DISABLE_SCSI_QCMD in this series are the ones
that we collectively know can be looked at for further optimization to
use spin_lock_irq() around a LLD dependent lock to realize the extra
benefit of not using local_irq_save().  The conversion of DEF_SCSI_QCMD
-> IRQ_DISABLE_SCSI_QCMD is to signal this explictly to the other LLD
folks that for the move to fully lock-less operation, that they want to
be looking at what libiscsi, megaraid_sas, scsi_debug, tcm_loop and your
qla2xxx patch is doing..  ;)

> 
> In particular for this driver, it explicitly re-enables interrupts,
> so it's pretty easy to do a full conversion.  Compile-tested only.
> 

Great, I will give this a shot with ISP25xx series HW and get this added
as a incremental patch for -v3 branch, and ammended into the qla2xxx LLD
patch for v4.

Thanks Matthew!

--nab


> Convert qla2xxx driver to run without the shost lock
> 
> Signed-off-by: Matthew Wilcox <willy@...ux.intel.com>
> 
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 2c0876c..b44d986 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -513,7 +513,7 @@ qla24xx_fw_version_str(struct scsi_qla_host *vha, char *str)
>  
>  static inline srb_t *
>  qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport,
> -    struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
> +    struct scsi_cmnd *cmd)
>  {
>  	srb_t *sp;
>  	struct qla_hw_data *ha = vha->hw;
> @@ -527,16 +527,15 @@ qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport,
>  	sp->cmd = cmd;
>  	sp->flags = 0;
>  	CMD_SP(cmd) = (void *)sp;
> -	cmd->scsi_done = done;
>  	sp->ctx = NULL;
>  
>  	return sp;
>  }
>  
>  static int
> -qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
> +qla2xxx_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
>  {
> -	scsi_qla_host_t *vha = shost_priv(cmd->device->host);
> +	scsi_qla_host_t *vha = shost_priv(shost);
>  	fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
>  	struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device));
>  	struct qla_hw_data *ha = vha->hw;
> @@ -544,7 +543,6 @@ qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)
>  	srb_t *sp;
>  	int rval;
>  
> -	spin_unlock_irq(vha->host->host_lock);
>  	if (ha->flags.eeh_busy) {
>  		if (ha->flags.pci_channel_io_perm_failure)
>  			cmd->result = DID_NO_CONNECT << 16;
> @@ -577,39 +575,32 @@ qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)
>  		goto qc24_target_busy;
>  	}
>  
> -	sp = qla2x00_get_new_sp(base_vha, fcport, cmd, done);
> +	sp = qla2x00_get_new_sp(base_vha, fcport, cmd);
>  	if (!sp)
> -		goto qc24_host_busy_lock;
> +		goto qc24_host_busy;
>  
>  	rval = ha->isp_ops->start_scsi(sp);
>  	if (rval != QLA_SUCCESS)
>  		goto qc24_host_busy_free_sp;
>  
> -	spin_lock_irq(vha->host->host_lock);
> -
>  	return 0;
>  
>  qc24_host_busy_free_sp:
>  	qla2x00_sp_free_dma(sp);
>  	mempool_free(sp, ha->srb_mempool);
>  
> -qc24_host_busy_lock:
> -	spin_lock_irq(vha->host->host_lock);
> +qc24_host_busy:
>  	return SCSI_MLQUEUE_HOST_BUSY;
>  
>  qc24_target_busy:
> -	spin_lock_irq(vha->host->host_lock);
>  	return SCSI_MLQUEUE_TARGET_BUSY;
>  
>  qc24_fail_command:
> -	spin_lock_irq(vha->host->host_lock);
> -	done(cmd);
> +	cmd->scsi_done(cmd);
>  
>  	return 0;
>  }
>  
> -static DEF_SCSI_QCMD(qla2xxx_queuecommand)
> -
>  
>  /*
>   * qla2x00_eh_wait_on_command
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists