From: Ming Lei <ming.lei@redhat.com>
To: Bart Van Assche <Bart.VanAssche@wdc.com>
Cc: "axboe@fb.com" <axboe@fb.com>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"snitzer@redhat.com" <snitzer@redhat.com>,
"hch@lst.de" <hch@lst.de>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
"hare@suse.de" <hare@suse.de>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"don.brace@microsemi.com" <don.brace@microsemi.com>,
"james.bottomley@hansenpartnership.com"
<james.bottomley@hansenpartnership.com>,
"osandov@fb.com" <osandov@fb.com>,
"loberman@redhat.com" <loberman@redhat.com>,
"kashyap.desai@broadcom.com" <kashyap.desai@broadcom.com>
Subject: Re: [PATCH 3/3] scsi: avoid to hold host-wide counter of host_busy for scsi_mq
Date: Sat, 28 Apr 2018 16:26:44 +0800 [thread overview]
Message-ID: <20180428082638.GB7325@ming.t460p> (raw)
In-Reply-To: <cf84baf9bd61fd1a3ab34aa956d496d164aef44f.camel@wdc.com>
On Fri, Apr 27, 2018 at 04:16:48PM +0000, Bart Van Assche wrote:
> On Fri, 2018-04-20 at 14:57 +0800, Ming Lei wrote:
> > +struct scsi_host_mq_in_flight {
> > + int cnt;
> > +};
> > +
> > +static void scsi_host_check_in_flight(struct request *rq, void *data,
> > + bool reserved)
> > +{
> > + struct scsi_host_mq_in_flight *in_flight = data;
> > +
> > + if (blk_mq_request_started(rq))
> > + in_flight->cnt++;
> > +}
> > +
> > /**
> > * scsi_host_busy - Return the host busy counter
> > * @shost: Pointer to Scsi_Host to inc.
> > **/
> > int scsi_host_busy(struct Scsi_Host *shost)
> > {
> > - return atomic_read(&shost->host_busy);
> > + struct scsi_host_mq_in_flight in_flight = {
> > + .cnt = 0,
> > + };
> > +
> > + if (!shost->use_blk_mq)
> > + return atomic_read(&shost->host_busy);
> > +
> > + blk_mq_tagset_busy_iter(&shost->tag_set, scsi_host_check_in_flight,
> > + &in_flight);
> > + return in_flight.cnt;
> > }
> > EXPORT_SYMBOL(scsi_host_busy);
>
> This patch introduces a subtle behavior change that has not been explained
> in the commit message. If a SCSI request gets requeued that results in a
> decrease of the .host_busy counter by scsi_device_unbusy() before the request
> is requeued and an increase of the host_busy counter when scsi_queue_rq() is
> called again. During that time such requests have the state MQ_RQ_COMPLETE and
> hence blk_mq_request_started() will return true and scsi_host_check_in_flight()
No, __blk_mq_requeue_request() will change the rq state into MQ_RQ_IDLE,
so such issue you worried about, please look at scsi_mq_requeue_cmd(),
which calls blk_mq_requeue_request(), which puts driver tag and updates
rq's state to IDLE.
> will include these requests. In other words, this patch introduces a subtle
> behavior change that has not been explained in the commit message. Hence I'm
> doubt that this change is correct.
As I explained above, no such issue.
Thanks,
Ming
next prev parent reply other threads:[~2018-04-28 8:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-20 6:57 [PATCH 0/3] scsi: scsi-mq: don't hold host_busy in IO path Ming Lei
2018-04-20 6:57 ` [PATCH 1/3] scsi: introduce scsi_host_busy() Ming Lei
2018-04-27 15:47 ` Bart Van Assche
2018-04-20 6:57 ` [PATCH 2/3] scsi: read host_busy via scsi_host_busy() Ming Lei
2018-04-27 15:51 ` Bart Van Assche
2018-04-28 8:17 ` Ming Lei
2018-04-20 6:57 ` [PATCH 3/3] scsi: avoid to hold host-wide counter of host_busy for scsi_mq Ming Lei
2018-04-27 16:16 ` Bart Van Assche
2018-04-28 8:26 ` Ming Lei [this message]
2018-04-27 15:31 ` [PATCH 0/3] scsi: scsi-mq: don't hold host_busy in IO path Bart Van Assche
2018-04-27 15:39 ` Jens Axboe
2018-04-27 15:48 ` Bart Van Assche
2018-04-27 15:55 ` Laurence Oberman
2018-04-27 16:19 ` Jens Axboe
2018-04-28 8:47 ` Ming Lei
2018-06-22 15:29 ` Bart Van Assche
2018-06-22 21:43 ` Ming Lei
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=20180428082638.GB7325@ming.t460p \
--to=ming.lei@redhat.com \
--cc=Bart.VanAssche@wdc.com \
--cc=axboe@fb.com \
--cc=don.brace@microsemi.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=kashyap.desai@broadcom.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=loberman@redhat.com \
--cc=martin.petersen@oracle.com \
--cc=osandov@fb.com \
--cc=snitzer@redhat.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