linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Himanshu Madhani <himanshu.madhani@cavium.com>
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org
Subject: Re: [PATCH v3 4/6] qla2xxx: Add multiple queue pair functionality.
Date: Mon, 5 Dec 2016 08:20:06 -0800	[thread overview]
Message-ID: <20161205162006.GD11206@infradead.org> (raw)
In-Reply-To: <1480715097-13611-5-git-send-email-himanshu.madhani@cavium.com>

>  create mode 100644 drivers/scsi/qla2xxx/qla_bottom.c
>  create mode 100644 drivers/scsi/qla2xxx/qla_mq.c
>  create mode 100644 drivers/scsi/qla2xxx/qla_top.c

What's the point of three new fairly small files, two of them very
oddly named?  Can't we keep the code together by logical groups?

> +	/* distill these fields down to 'online=0/1'
> +	 * ha->flags.eeh_busy
> +	 * ha->flags.pci_channel_io_perm_failure
> +	 * base_vha->loop_state
> +	 */
> +	uint32_t online:1;
> +	/* move vha->flags.difdix_supported here */
> +	uint32_t difdix_supported:1;
> +	uint32_t delete_in_progress:1;

These probably should be atomic bitops.

> +#define QLA_VHA_MARK_BUSY(__vha, __bail) do {		\
> +	atomic_inc(&__vha->vref_count);			\
> +	mb();						\
> +	if (__vha->flags.delete_progress) {		\
> +		atomic_dec(&__vha->vref_count);		\
> +		__bail = 1;				\
> +	} else {					\
> +		__bail = 0;				\
> +	}						\
>  } while (0)

Something like this should be an inline function, not a macro
that returns through an argument.

(and move to lower case it while at it, please).

Btw, the way vref_count is used looks incredibly buggy, instead
of the busy wait just add a waie queue to sleep on in
qla24xx_deallocate_vp_id.

> +	QLA_QPAIR_MARK_BUSY(qpair, bail);
> +	if (unlikely(bail))
> +		return NULL;
> +
> +	sp = mempool_alloc(qpair->srb_mempool, flag);
> +	if (!sp)
> +		goto done;
> +
> +	memset(sp, 0, sizeof(*sp));
> +	sp->fcport = fcport;
> +	sp->iocbs = 1;

FYI, the blk-mq model would be to allocate the srps as part of the
scsi_cmd by setting the cmd_size field in the host template.  Note
that this is also supported for the non-blk-mq path.

> +	qpair->delete_in_progress = 1;
> +	while (atomic_read(&qpair->ref_count))
> +		msleep(500);

Please use a waitqueue instead of a busy wait here as well.

> +int ql2xmqsupport;
> +module_param(ql2xmqsupport, int, S_IRUGO);
> +MODULE_PARM_DESC(ql2xmqsupport,
> +		"Enable on demand multiple queue pairs support "
> +		"Default is 0 for no support. "
> +		"Set it to 1 to turn on mq qpair support.");

Why isn't this enabled by default?

> +		ha->queue_pair_map = kzalloc(sizeof(struct qla_qpair *)
> +			* ha->max_qpairs, GFP_KERNEL);

Use kcalloc instead.

  parent reply	other threads:[~2016-12-05 16:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 21:44 [PATCH v3 0/6] qla2xxx: Feture updates for driver Himanshu Madhani
2016-12-02 21:44 ` [PATCH v3 1/6] qla2xxx: Only allow operational MBX to proceed during RESET Himanshu Madhani
2016-12-05 16:01   ` Christoph Hellwig
2016-12-05 18:36     ` Madhani, Himanshu
2016-12-06 13:57       ` Christoph Hellwig
2016-12-02 21:44 ` [PATCH v3 2/6] qla2xxx: Fix mailbox command timeout due to starvation Himanshu Madhani
2016-12-05 16:03   ` Christoph Hellwig
2016-12-05 18:37     ` Madhani, Himanshu
2016-12-07 18:49       ` Christoph Hellwig
2016-12-02 21:44 ` [PATCH v3 3/6] qla2xxx: Utilize pci_alloc_irq_vectors/pci_free_irq_vectors calls Himanshu Madhani
2016-12-05  7:19   ` Hannes Reinecke
2016-12-05 12:54     ` Christoph Hellwig
2016-12-05 16:09       ` Christoph Hellwig
2016-12-05 12:55   ` Christoph Hellwig
2016-12-05 21:20     ` Madhani, Himanshu
2016-12-02 21:44 ` [PATCH v3 4/6] qla2xxx: Add multiple queue pair functionality Himanshu Madhani
2016-12-05  7:38   ` Hannes Reinecke
2016-12-05 12:59     ` Christoph Hellwig
2016-12-05 20:43     ` Madhani, Himanshu
2016-12-05 22:08       ` Madhani, Himanshu
2016-12-05 16:20   ` Christoph Hellwig [this message]
2016-12-05 22:41     ` Madhani, Himanshu
2016-12-02 21:44 ` [PATCH v3 5/6] qla2xxx: Add Block Multi Queue functionality Himanshu Madhani
2016-12-05  7:39   ` Hannes Reinecke
2016-12-02 21:44 ` [PATCH v3 6/6] qla2xxx: Fix Target mode handling with Multiqueue changes Himanshu Madhani
2016-12-05  7:42   ` Hannes Reinecke
2016-12-05 21:06     ` Madhani, Himanshu

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=20161205162006.GD11206@infradead.org \
    --to=hch@infradead.org \
    --cc=himanshu.madhani@cavium.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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).