From: Brian King <brking@linux.vnet.ibm.com>
To: Bart Van Assche <Bart.VanAssche@wdc.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"abdhalee@linux.vnet.ibm.com" <abdhalee@linux.vnet.ibm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"hch@lst.de" <hch@lst.de>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
"sachinp@linux.vnet.ibm.com" <sachinp@linux.vnet.ibm.com>,
"linux-next@vger.kernel.org" <linux-next@vger.kernel.org>,
"hare@suse.com" <hare@suse.com>,
"mpe@ellerman.id.au" <mpe@ellerman.id.au>
Subject: [PATCHv2 1/2] scsi: Move scsi_cmd->jiffies_at_alloc initialization to allocation time
Date: Mon, 21 Aug 2017 17:40:14 -0500 [thread overview]
Message-ID: <e605bd0d-b193-0a7c-a7f3-63d7cc49e9b9@linux.vnet.ibm.com> (raw)
In-Reply-To: <21928108-3a20-577e-99c8-6da05637c158@linux.vnet.ibm.com>
This second version also sets up jiffies_at_alloc in scsi_init_request.
This has been tested without the second patch in the series and
I've confirmed I now see the following in the logs after booting:
[ 121.718088] sd 1:2:0:0: timing out command, waited 120s
[ 121.798081] sd 1:2:1:0: timing out command, waited 120s
Without this patch I was never seeing these messages, indicating
the retry timer code wasn't working. Also, after seeing these
messages, I've confirmed there are no longer any hung tasks
in the kernel with sysrq-w, while before, without this patch,
I would see hung tasks for the scsi_report_opcodes calls which
were getting retried forever.
8<
Move the initialization of scsi_cmd->jiffies_at_alloc to allocation
time rather than prep time. Also ensure that jiffies_at_alloc
is preserved when we go through prep. This lets us send retries
through prep again and not break the overall retry timer logic
in scsi_softirq_done.
Suggested-by: Bart Van Assche <Bart.VanAssche@wdc.com>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---
Index: linux-2.6.git/drivers/scsi/scsi_lib.c
===================================================================
--- linux-2.6.git.orig/drivers/scsi/scsi_lib.c
+++ linux-2.6.git/drivers/scsi/scsi_lib.c
@@ -1154,6 +1154,7 @@ void scsi_init_command(struct scsi_devic
void *buf = cmd->sense_buffer;
void *prot = cmd->prot_sdb;
unsigned int unchecked_isa_dma = cmd->flags & SCMD_UNCHECKED_ISA_DMA;
+ unsigned long jiffies_at_alloc = cmd->jiffies_at_alloc;
/* zero out the cmd, except for the embedded scsi_request */
memset((char *)cmd + sizeof(cmd->req), 0,
@@ -1164,7 +1165,7 @@ void scsi_init_command(struct scsi_devic
cmd->prot_sdb = prot;
cmd->flags = unchecked_isa_dma;
INIT_DELAYED_WORK(&cmd->abort_work, scmd_eh_abort_handler);
- cmd->jiffies_at_alloc = jiffies;
+ cmd->jiffies_at_alloc = jiffies_at_alloc;
scsi_add_cmd_to_list(cmd);
}
@@ -2016,6 +2017,7 @@ static int scsi_init_request(struct blk_
if (!cmd->sense_buffer)
return -ENOMEM;
cmd->req.sense = cmd->sense_buffer;
+ cmd->jiffies_at_alloc = jiffies;
if (scsi_host_get_prot(shost)) {
sg = (void *)cmd + sizeof(struct scsi_cmnd) +
@@ -2119,6 +2121,7 @@ static int scsi_init_rq(struct request_q
if (!cmd->sense_buffer)
goto fail;
cmd->req.sense = cmd->sense_buffer;
+ cmd->jiffies_at_alloc = jiffies;
if (scsi_host_get_prot(shost) >= SHOST_DIX_TYPE0_PROTECTION) {
cmd->prot_sdb = kmem_cache_zalloc(scsi_sdb_cache, gfp);
next prev parent reply other threads:[~2017-08-21 22:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 17:00 [BUG][bisected 270065e] linux-next fails to boot on powerpc Abdul Haleem
2017-08-16 17:21 ` Bart Van Assche
2017-08-16 23:18 ` Brian King
2017-08-17 15:52 ` Bart Van Assche
2017-08-18 21:04 ` Brian King
2017-08-18 21:17 ` [PATCH] ipr: Set no_report_opcodes for RAID arrays Brian King
2017-08-21 20:22 ` Martin K. Petersen
2017-08-18 21:41 ` [BUG][bisected 270065e] linux-next fails to boot on powerpc Bart Van Assche
2017-08-18 21:57 ` Brian King
2017-08-18 22:13 ` Bart Van Assche
2017-08-21 22:11 ` [PATCH 0/2] Allow scsi_prep_fn to occur for retried commands Brian King
2017-08-21 22:13 ` [PATCH 1/2] scsi: Move scsi_cmd->jiffies_at_alloc initialization to allocation time Brian King
2017-08-21 22:16 ` Brian King
2017-08-21 22:40 ` Brian King [this message]
2017-08-22 6:51 ` hch
2017-08-21 22:14 ` [PATCH 2/2] scsi: Preserve retry counter through scsi_prep_fn Brian King
2017-08-22 6:51 ` hch
2017-08-22 6:42 ` [PATCH 0/2] Allow scsi_prep_fn to occur for retried commands Abdul Haleem
2017-08-21 20:27 ` [BUG][bisected 270065e] linux-next fails to boot on powerpc Martin K. Petersen
2017-08-17 1:33 ` Michael Ellerman
2017-08-16 20:25 ` Bart Van Assche
2017-08-17 7:06 ` Michael Ellerman
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=e605bd0d-b193-0a7c-a7f3-63d7cc49e9b9@linux.vnet.ibm.com \
--to=brking@linux.vnet.ibm.com \
--cc=Bart.VanAssche@wdc.com \
--cc=abdhalee@linux.vnet.ibm.com \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=sachinp@linux.vnet.ibm.com \
--cc=sfr@canb.auug.org.au \
/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).