From: Jeff Garzik <jgarzik@pobox.com>
To: Albert Lee <albertcc@tw.ibm.com>
Cc: "Ralf Müller" <ralf@bj-ig.de>, "Doug Maxey" <dwm@maxeymade.com>,
"Linux IDE" <linux-ide@vger.kernel.org>
Subject: Re: [PATCH/RFC] libata-dev: update timeout for PIO polling
Date: Tue, 17 Jan 2006 19:52:00 -0500 [thread overview]
Message-ID: <43CD9130.4000600@pobox.com> (raw)
In-Reply-To: <43BDE6EB.9090106@tw.ibm.com>
Albert Lee wrote:
> Jeff,
>
> In the bug reported by Ralf Müller:
> (http://marc.theaimsgroup.com/?l=linux-ide&m=113629906809278&w=2)
>
> When the command times out, the qc is completed by the time
> out handler. This might cause null pointer dereference if
> the command is running in the PIO polling thread.
>
> Changes:
> - Update the timeout for PIO polling to 5 minutes.
> This should be long enough to prevent the timeout handler from
> interfering with the PIO polling thread.
>
> Patch against the libata-dev irq-pio branch
> (61420e147a706ee7c7a902008045547fb2a2a330).
>
> For your review, thanks.
>
> Albert
> Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
>
> ==========
>
> --- irq-pio/include/linux/libata.h 2006-01-05 15:16:32.000000000 +0800
> +++ update_tmout/include/linux/libata.h 2006-01-06 10:17:34.000000000 +0800
> @@ -141,6 +141,7 @@ enum {
> ATA_TMOUT_CDB_QUICK = 5 * HZ,
> ATA_TMOUT_INTERNAL = 30 * HZ,
> ATA_TMOUT_INTERNAL_QUICK = 5 * HZ,
> + ATA_TMOUT_LONG = 300 * HZ, /* looks long enough */
>
> /* ATA bus states */
> BUS_UNKNOWN = 0,
> --- irq-pio/drivers/scsi/libata-core.c 2006-01-05 15:16:29.000000000 +0800
> +++ update_tmout/drivers/scsi/libata-core.c 2006-01-06 10:41:23.000000000 +0800
> @@ -3866,6 +3866,21 @@ int ata_qc_issue_prot(struct ata_queued_
> }
> }
>
> + /* The PIO polling thread has its own timeout handling.
> + * It won't loop forever. Even if it takes a long time,
> + * we can wait the PIO polling thread to finish its work.
> + * No need to stop the polling thread from the timeout handler.
> + * So the timeout is updated to a long time here. This can prevent
> + * the timeout handler from interfering with the PIO polling thread.
> + */
> + if (qc->tf.flags & ATA_TFLAG_POLLING &&
> + qc->scsicmd &&
> + qc->scsicmd->eh_timeout.function) {
> + DPRINTK("ata%u: timer updated for PIO polling\n", ap->id);
> + mod_timer(&qc->scsicmd->eh_timeout,
> + jiffies + ATA_TMOUT_LONG);
> + }
While this may solve the problem, unfortunately we really don't want to
be directly touching the scsi EH timer.
A better method would be to implement ->eh_timed_out() SCSI host
template hook, which is the preferred way to accomplish what you are
attempting here.
Jeff
next prev parent reply other threads:[~2006-01-18 0:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-03 14:32 Kernel Oops with 2.6.15 Ralf Müller
2006-01-04 3:10 ` Albert Lee
2006-01-04 9:29 ` Ralf Müller
2006-01-06 3:41 ` [PATCH/RFC] libata-dev: update timeout for PIO polling Albert Lee
2006-01-18 0:52 ` Jeff Garzik [this message]
2006-01-20 14:19 ` [PATCH/RFC] libata-dev: update timer for PIO polling - revised Albert Lee
2006-01-21 1:05 ` Tejun Heo
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=43CD9130.4000600@pobox.com \
--to=jgarzik@pobox.com \
--cc=albertcc@tw.ibm.com \
--cc=dwm@maxeymade.com \
--cc=linux-ide@vger.kernel.org \
--cc=ralf@bj-ig.de \
/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).