From: Kashyap Desai <kashyap.desai@broadcom.com>
To: dgilbert@interlog.com, linux-scsi@vger.kernel.org
Cc: linux-block@vger.kernel.org
Subject: RE: [PATCH v1 3/3] scsi_debug: iouring iopoll support
Date: Mon, 30 Nov 2020 14:36:45 +0530 [thread overview]
Message-ID: <1d8b5c319efd67aadd411632ee519295@mail.gmail.com> (raw)
In-Reply-To: <56c55fed-3034-9fbf-b089-a07e74d9b05b@interlog.com>
[-- Attachment #1: Type: text/plain, Size: 4133 bytes --]
>
> On 2020-10-15 9:37 a.m., Kashyap Desai wrote:
> > Add support of iouring iopoll interface in scsi_debug.
> > This feature requires shared hosttag support in kernel and driver.
>
> I am continuing to test this patch. There is one fix shown inline below
> plus a
> question near the end.
Hi Doug, I have created add-on patch which includes all your comment. I am
also able to see the issue you reported and below patch fix it.
I will hold V2 revision of the series and I will wait for your Review-by and
Tested-by Tag.
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 4d9cc6af588c..fb328253086d 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -5675,6 +5675,7 @@ MODULE_PARM_DESC(opt_xferlen_exp, "optimal transfer
length granularity exponent
MODULE_PARM_DESC(opts, "1->noise, 2->medium_err, 4->timeout,
8->recovered_err... (def=0)");
MODULE_PARM_DESC(per_host_store, "If set, next positive add_host will get
new store (def=0)");
MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)");
+MODULE_PARM_DESC(poll_queues, "support for iouring iopoll queues (1 to
max(submit_queues - 1)");
MODULE_PARM_DESC(ptype, "SCSI peripheral type(def=0[disk])");
MODULE_PARM_DESC(random, "If set, uniformly randomize command duration
between 0 and delay_in_ns");
MODULE_PARM_DESC(removable, "claim to have removable media (def=0)");
@@ -5683,7 +5684,6 @@ MODULE_PARM_DESC(sector_size, "logical block size in
bytes (def=512)");
MODULE_PARM_DESC(statistics, "collect statistics on commands, queues
(def=0)");
MODULE_PARM_DESC(strict, "stricter checks: reserved field in cdb (def=0)");
MODULE_PARM_DESC(submit_queues, "support for block multi-queue (def=1)");
-MODULE_PARM_DESC(poll_queues, "support for iouring iopoll queues");
MODULE_PARM_DESC(tur_ms_to_ready, "TEST UNIT READY millisecs before initial
good status (def=0)");
MODULE_PARM_DESC(unmap_alignment, "lowest aligned thin provisioning lba
(def=0)");
MODULE_PARM_DESC(unmap_granularity, "thin provisioning granularity in
blocks (def=1)");
@@ -7199,7 +7199,7 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost,
unsigned int queue_num)
do {
spin_lock_irqsave(&sqp->qc_lock, iflags);
qc_idx = find_first_bit(sqp->in_use_bm, sdebug_max_queue);
- if (unlikely((qc_idx < 0) || (qc_idx >= SDEBUG_CANQUEUE)))
+ if (unlikely((qc_idx < 0) || (qc_idx >= sdebug_max_queue)))
goto out;
sqcp = &sqp->qc_arr[qc_idx];
@@ -7477,10 +7477,17 @@ static int sdebug_driver_probe(struct device *dev)
hpnt->host_tagset = 1;
/* poll queues are possible for nr_hw_queues > 1 */
- if (hpnt->nr_hw_queues == 1)
+ if (hpnt->nr_hw_queues == 1 || (poll_queues < 1)) {
+ pr_warn("%s: trim poll_queues to 0. poll_q/nr_hw = (%d/%d)
\n",
+ my_name, poll_queues, hpnt->nr_hw_queues);
poll_queues = 0;
+ }
- /* poll queues */
+ /*
+ * Poll queues don't need interrupts, but we need at least one I/O
queue
+ * left over for non-polled I/O.
+ * If condition not met, trim poll_queues to 1 (just for
simplicity).
+ */
if (poll_queues >= submit_queues) {
pr_warn("%s: trim poll_queues to 1\n", my_name);
poll_queues = 1;
> > + do {
> > + spin_lock_irqsave(&sqp->qc_lock, iflags);
> > + qc_idx = find_first_bit(sqp->in_use_bm, sdebug_max_queue);
> > + if (unlikely((qc_idx < 0) || (qc_idx >= SDEBUG_CANQUEUE)))
>
> The above line IMO needs to be:
> if (unlikely((qc_idx < 0) || (qc_idx >= sdebug_max_queue)))
>
> If not, when sdebug_max_queue < SDEBUG_CANQUEUE and there is no
> request waiting then "scp is NULL, ..." is reported suggesting there is an
> error.
BTW - Is below piece of code at sdebug_q_cmd_complete() requires similar
change ?
Use sdebug_max_queue instead of SDEBUG_CANQUEUE
if (unlikely((qc_idx < 0) || (qc_idx >= SDEBUG_CANQUEUE))) {
pr_err("wild qc_idx=%d\n", qc_idx);
return;
}
Kashyap
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4169 bytes --]
next prev parent reply other threads:[~2020-11-30 9:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-15 13:37 [PATCH v1 3/3] scsi_debug: iouring iopoll support Kashyap Desai
2020-11-13 10:50 ` Kashyap Desai
2020-11-15 16:04 ` Douglas Gilbert
2020-11-24 16:38 ` Douglas Gilbert
2020-11-30 9:06 ` Kashyap Desai [this message]
2020-11-30 19:42 ` Douglas Gilbert
2020-12-01 16:56 ` Douglas Gilbert
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=1d8b5c319efd67aadd411632ee519295@mail.gmail.com \
--to=kashyap.desai@broadcom.com \
--cc=dgilbert@interlog.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@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).