From: Robert Hancock <hancockr@shaw.ca>
To: linux-ide@vger.kernel.org
Cc: jeff@garzik.org
Subject: Re: [PATCH 5/7] libata: Improve timeout handling
Date: Tue, 06 Jan 2009 18:29:44 -0600 [thread overview]
Message-ID: <4963F778.5090209@shaw.ca> (raw)
In-Reply-To: <20090105141532.28189.58209.stgit@localhost.localdomain>
Alan Cox wrote:
> From: Alan Cox <alan@redhat.com>
>
> On a timeout call a device specific handler early in the recovery so that
> we can complete and process successful commands which timed out due to IRQ
> loss or the like rather more elegantly.
>
> Signed-off-by: Alan Cox <alan@redhat.com>
(snip)
> diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
> index e74b3db..e9c09cd 100644
> --- a/drivers/ata/libata-sff.c
> +++ b/drivers/ata/libata-sff.c
> @@ -65,6 +65,8 @@ const struct ata_port_operations ata_sff_port_ops = {
> .sff_irq_on = ata_sff_irq_on,
> .sff_irq_clear = ata_sff_irq_clear,
>
> + .lost_interrupt = ata_sff_lost_interrupt,
> +
> .port_start = ata_sff_port_start,
> };
>
> @@ -1543,7 +1545,7 @@ bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc)
> * RETURNS:
> * One if interrupt was handled, zero if not (shared irq).
> */
> -inline unsigned int ata_sff_host_intr(struct ata_port *ap,
> +unsigned int ata_sff_host_intr(struct ata_port *ap,
> struct ata_queued_cmd *qc)
> {
> struct ata_eh_info *ehi = &ap->link.eh_info;
> @@ -1670,6 +1672,47 @@ irqreturn_t ata_sff_interrupt(int irq, void *dev_instance)
> }
>
> /**
> + * ata_sff_lost_interrupt - Check for an apparent lost interrupt
> + * @ap: port that appears to have timed out
> + *
> + * Called from the libata error handlers when the core code suspects
> + * an interrupt has been lost. If it has complete anything we can and
> + * then return. Interface must support altstatus for this faster
> + * recovery to occur.
> + *
> + * Locking:
> + * Caller holds host lock
> + */
> +
> +void ata_sff_lost_interrupt(struct ata_port *ap)
> +{
> + u8 status;
> + struct ata_queued_cmd *qc;
> +
> + /* Only one outstanding command per SFF channel */
> + qc = ata_qc_from_tag(ap, ap->link.active_tag);
> + /* Check we have a live one.. */
> + if (qc == NULL || !(qc->flags & ATA_QCFLAG_ACTIVE))
> + return;
> + /* We cannot lose an interrupt on a polled command */
> + if (qc->tf.flags & ATA_TFLAG_POLLING)
> + return;
> + /* See if the controller thinks it is still busy - if so the command
> + isn't a lost IRQ but is still in progress */
> + status = ata_sff_altstatus(ap);
> + if (status & ATA_BUSY)
> + return;
> +
> + /* There was a command running, we are no longer busy and we have
> + no interrupt. */
> + ata_port_printk(ap, KERN_WARNING, "lost interrupt (Status 0x%x)\n",
> + status);
> + /* Run the host interrupt logic as if the interrupt had not been
> + lost */
> + ata_sff_host_intr(ap, qc);
> +}
> +
> +/**
I suspect this may have to be more of an opt-in thing or else all
drivers inheriting the SFF port ops will have to be checked to make sure
it will work. Looking at sata_nv ADMA, it inherits from the SFF
operations but the above code won't work as expected if the timeout
happened while the controller was in ADMA mode (we're not allowed to
access the taskfile registers for one thing). There may be others that
have similar problems.
next prev parent reply other threads:[~2009-01-07 0:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-05 14:12 [PATCH 0/7] ata: Updates and improvements Alan Cox
2009-01-05 14:12 ` [PATCH 1/7] pata_hpt3x3: Workarounds for chipset Alan Cox
2009-01-05 14:13 ` [PATCH 2/7] pata_ali: force initialise a few bits Alan Cox
2009-01-05 14:13 ` [PATCH 3/7] pata_ali: Fix and workaround for FIFO DMA bug Alan Cox
2009-01-05 14:15 ` [PATCH 4/7] libata: Drain data on errors Alan Cox
2009-01-05 14:16 ` [PATCH 5/7] libata: Improve timeout handling Alan Cox
2009-01-07 0:29 ` Robert Hancock [this message]
2009-01-05 14:16 ` [PATCH 6/7] libata: clean up the SFF code for coding style Alan Cox
2009-01-05 14:16 ` [PATCH 7/7] libata: Add 32bit PIO support Alan Cox
2009-01-06 1:06 ` Robert Hancock
2009-01-06 9:46 ` Alan Cox
2009-01-06 12:47 ` Sergei Shtylyov
-- strict thread matches above, loose matches on Subject: below --
2008-12-05 19:42 [PATCH 1/7] pata_ninja32: update ID table Alan Cox
2008-12-05 19:43 ` [PATCH 5/7] libata: Improve timeout handling Alan Cox
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=4963F778.5090209@shaw.ca \
--to=hancockr@shaw.ca \
--cc=jeff@garzik.org \
--cc=linux-ide@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).