From: James Bottomley <jbottomley@parallels.com>
To: Shaohua Li <shaohua.li@intel.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@infradead.org>, "Ted Ts'o" <tytso@mit.edu>,
"Wu, Fengguang" <fengguang.wu@intel.com>,
"Darrick J. Wong" <djwong@us.ibm.com>
Subject: Re: [patch 1/2]scsi: scsi_run_queue() doesn't use local list to handle starved sdev
Date: Thu, 22 Dec 2011 18:27:29 +0000 [thread overview]
Message-ID: <1324578449.9709.15.camel@dabdike.int.hansenpartnership.com> (raw)
In-Reply-To: <1324523412.22361.471.camel@sli10-conroe>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1881 bytes --]
On Thu, 2011-12-22 at 11:10 +0800, Shaohua Li wrote:
> scsi_run_queue() picks off all sdev from host starved_list to a local list,
> then handle them. If there are multiple threads running scsi_run_queue(),
> the starved_list will get messed. This is quite common, because request
> rq_affinity is on by default.
>
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
> ---
> drivers/scsi/scsi_lib.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> Index: linux/drivers/scsi/scsi_lib.c
> ===================================================================
> --- linux.orig/drivers/scsi/scsi_lib.c 2011-12-21 16:56:23.000000000 +0800
> +++ linux/drivers/scsi/scsi_lib.c 2011-12-22 09:33:09.000000000 +0800
> @@ -401,9 +401,8 @@ static inline int scsi_host_is_busy(stru
> */
> static void scsi_run_queue(struct request_queue *q)
> {
> - struct scsi_device *sdev = q->queuedata;
> + struct scsi_device *sdev = q->queuedata, *head_sdev = NULL;
> struct Scsi_Host *shost;
> - LIST_HEAD(starved_list);
> unsigned long flags;
>
> /* if the device is dead, sdev will be NULL, so no queue to run */
> @@ -415,9 +414,8 @@ static void scsi_run_queue(struct reques
> scsi_single_lun_run(sdev);
>
> spin_lock_irqsave(shost->host_lock, flags);
> - list_splice_init(&shost->starved_list, &starved_list);
>
> - while (!list_empty(&starved_list)) {
> + while (!list_empty(&shost->starved_list)) {
The original reason for working from a copy instead of the original list
was that the device can end up back on the starved list because of a
variety of conditions in the HBA and so this would cause the loop not to
exit, so this piece of the patch doesn't look right to me.
James
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2011-12-22 18:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-22 3:10 [patch 1/2]scsi: scsi_run_queue() doesn't use local list to handle starved sdev Shaohua Li
2011-12-22 18:27 ` James Bottomley [this message]
2011-12-23 0:40 ` Shaohua Li
2011-12-23 1:17 ` James Bottomley
2011-12-23 1:53 ` Shaohua Li
2012-01-09 7:31 ` Shaohua Li
2012-01-09 17:30 ` James Bottomley
2012-01-10 3:27 ` Shaohua Li
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=1324578449.9709.15.camel@dabdike.int.hansenpartnership.com \
--to=jbottomley@parallels.com \
--cc=axboe@kernel.dk \
--cc=djwong@us.ibm.com \
--cc=fengguang.wu@intel.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=shaohua.li@intel.com \
--cc=tytso@mit.edu \
/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).