All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Tejun Heo <htejun@gmail.com>
Cc: albertcc@tw.ibm.com, linux-ide@vger.kernel.org
Subject: Re: [PATCH libata-dev-2.6:upstream 00/02] atapi: packet task vs. intr race fix
Date: Sun, 21 Aug 2005 20:27:38 -0400	[thread overview]
Message-ID: <43091BFA.2020101@pobox.com> (raw)
In-Reply-To: <20050821235149.GA14097@htj.dyndns.org>

Tejun Heo wrote:
>  For example, ATA_PROT_NODATA is processed as follows.

You mean ATA_PROT_ATAPI_NODATA, I presume.

>    Driver				Controller
>    -------------------------------------------------------------------------
> 1. issue ATA_CMD_PACKET
> 2.					Turns on BSY and sends H2D regs
> 3. atapi_packet_task poll for BSY
> 4.					D2H regs FIS (!BSY, DRQ)
> 5. packet_task sends CDB
> 6.					Turns on BSY and sends DATA FIS

but first PIO Setup FIS


> 7.					D2H regs FIS (!BSY, DRDY, INTR)
> 8. intr handler completes the cmd
> 
>  In step #3, we're waiting for BSY to clear - command is active and
> NIEN is clear.  After step #4 but before #5, command is active, BSY
> clear and DRQ set, if an interrupt from the other port occurs here, it
> will incorrectly fail this qc causing EH to kick in for sense data.

Agreed, that is a problem w/ libata's ATAPI HSM.  Two problems actually:

(a) [what you found] at that point in the HSM, unexpected interrupts can 
incorrectly complete a command
(b) [a 'todo' item'] at that point in the HSM, there may actually be an 
expected interrupt, before which the CDB should not be sent, per ATA/ATAPI-4


>  The problem is that the current interrupt handler is unaware of the
> HSM state where NIEN and BSY are clear but interrupts are not
> expected.  So, the problem is that the interrupt handler doesn't know
> enough about HSM state to be able to determine that the interrupt is
> not its.

Agreed.


> The flag I've mentioned is to tell just that to the
> interrupt handler.

>  Otherwise, I think we can implement something like ap->ata_state and
> fully record where the HSM is, which would also be useful to implement
> interrupt-driven PIO.  What do you think?

I tend to prefer ap->ata_state method, since I definitely would like to 
implement interrupt-driven PIO.  But if the patch is too ugly, maybe a 
bit flag would be OK.

Long term, PIO w/ interrupts is probably the best thing to do under 
SATA.  That prevents problems with PATA->SATA emulation that lead to 
screaming interrupts.  For SATA, it seems like polling is a bad idea in 
all cases [save suspend/resume edge cases].

SATA technology is inherently more suited to an interrupt-driven 
architecture anyway.  Polling makes less sense, and needlessly increases 
PCI bus traffic.

	Jeff


  reply	other threads:[~2005-08-22 23:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-20  9:17 [PATCH libata-dev-2.6:upstream 00/02] atapi: packet task vs. intr race fix Tejun Heo
2005-08-20  9:17 ` [PATCH libata-dev-2.6:upstream 01/02] atapi: update ata_irq_on Tejun Heo
2005-08-20  9:17 ` [PATCH libata-dev-2.6:upstream 02/02] atapi: fix atapi_packet_task vs. ata_host_intr race Tejun Heo
2005-08-21 19:47 ` [PATCH libata-dev-2.6:upstream 00/02] atapi: packet task vs. intr race fix Jeff Garzik
2005-08-21 20:17   ` Tejun Heo
2005-08-21 20:23     ` Jeff Garzik
2005-08-21 20:40       ` Tejun Heo
2005-08-21 21:24         ` Jeff Garzik
2005-08-21 21:38           ` Tejun Heo
2005-08-21 21:59             ` Jeff Garzik
2005-08-21 23:51               ` Tejun Heo
2005-08-22  0:27                 ` Jeff Garzik [this message]
2005-08-22  3:57                   ` Tejun Heo
2005-08-22  4:01                     ` Jeff Garzik
2005-08-22  3:59                   ` [PATCH libata:upstream] fix atapi_packet_task vs. intr race Tejun Heo
2005-08-22  4:15                     ` Jeff Garzik
2005-08-22  5:59                       ` [PATCH libata:upstream] fix atapi_packet_task vs. intr race (take 2) Tejun Heo
2005-08-22  6:54                         ` Jeff Garzik
2005-08-22  7:06                           ` Tejun Heo
2005-08-23  5:06                         ` Jeff Garzik
2005-08-21 20:25     ` [PATCH libata-dev-2.6:upstream 00/02] atapi: packet task vs. intr race fix Jeff Garzik
2005-08-22 14:48     ` Mark Lord

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=43091BFA.2020101@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=albertcc@tw.ibm.com \
    --cc=htejun@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.