* Re: [PATCH] libata: always use polling SETXFER [not found] <20070314053338.GA15600@htj.dyndns.org> @ 2007-05-25 10:58 ` Jeff Garzik 2007-05-25 11:58 ` Tejun Heo 0 siblings, 1 reply; 4+ messages in thread From: Jeff Garzik @ 2007-05-25 10:58 UTC (permalink / raw) To: Tejun Heo; +Cc: Alan Cox, linux-ide, Linux Kernel Mailing List Tejun Heo wrote: > Several people have reported LITE-ON LTR-48246S detection failed > because SETXFER fails. It seems the device raises IRQ too early after > SETXFER. This is controller independent. The same problem has been > reported for different controllers. > > So, now we have pata_via where the controller raises IRQ before it's > ready after SETXFER and a device which does similar thing. This patch > makes libata always execute SETXFER via polling. As this only happens > during EH, performance impact is nil. Setting ATA_TFLAG_POLLING is > also moved from issue hot path to ata_dev_set_xfermode() - the only > place where SETXFER can be issued. > > Jeff Garzik suggests that, in the long term, it might be better to > modify libata HSM implementation such that we're more tolerant of > erratic ATAPI IRQ behavior - e.g. default to IRQ but falling back to > polling if the device doesn't seem ready at the point of interrupt. > Such change might be necessary to support ancient/weird ATAPI devices. > > Signed-off-by: Tejun Heo <htejun@gmail.com> Since I wrote them up in IRC, I might as well post them here and get it archived: We need to figure out a better polling solution. For SAS and advanced SATA, polling really has no meaning at all, when you consider what polling IDENTIFY DEVICE and polling SET FEATURES are trying to solve. To the advanced hardware, it's all a bunch of packets. An event that appears "late" to the eyes of the PATA world is now presented as changing data fields in the packet stream. We are going to have to deal with the HSM issue underlying the need to do SET FEATURES - XFER MODE polling, and ultimately IDENTIFY DEVICE polling too. This is the main reason why I have resisted applying "[PATCH] libata: always use polling SETXFER" -- polling implies a model that does not exist on SAS/SATA and advanced SATA. It's only luck that AHCI includes a real register to poll. To illustrate: Fixing this problem The Right Way(tm) will yield a result that would allow ahci.c to operate in an interrupt-driven mode, examining the contents of the FIS's returned. Polling status can already be replaced by examining the D2H and SDB FIS areas. And by definition, on AHCI (and sata_sil24, IIRC) the status will not change unless a new FIS has arrived. Polling is still fine on PCI IDE-like controllers (older ones), but advanced controllers require us to coalesce the polling bandaid into a test for a sequence of events. We cannot escape the "hard part." :) Jeff ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libata: always use polling SETXFER 2007-05-25 10:58 ` [PATCH] libata: always use polling SETXFER Jeff Garzik @ 2007-05-25 11:58 ` Tejun Heo 2007-05-25 12:26 ` Jeff Garzik 0 siblings, 1 reply; 4+ messages in thread From: Tejun Heo @ 2007-05-25 11:58 UTC (permalink / raw) To: Jeff Garzik; +Cc: Alan Cox, linux-ide, Linux Kernel Mailing List Hello, Jeff. Jeff Garzik wrote: > Since I wrote them up in IRC, I might as well post them here and get it > archived: Just about to reply on IRC. :-) > We need to figure out a better polling solution. > > For SAS and advanced SATA, polling really has no meaning at all, when > you consider what polling IDENTIFY DEVICE and polling SET FEATURES are > trying to solve. To the advanced hardware, it's all a bunch of packets. > An event that appears "late" to the eyes of the PATA world is now > presented as changing data fields in the packet stream. > > We are going to have to deal with the HSM issue underlying the need to > do SET FEATURES - XFER MODE polling, and ultimately IDENTIFY DEVICE > polling too. > > This is the main reason why I have resisted applying "[PATCH] libata: > always use polling SETXFER" -- polling implies a model that does not > exist on SAS/SATA and advanced SATA. It's only luck that AHCI includes > a real register to poll. > > To illustrate: Fixing this problem The Right Way(tm) will yield a > result that would allow ahci.c to operate in an interrupt-driven mode, > examining the contents of the FIS's returned. Polling status can already > be replaced by examining the D2H and SDB FIS areas. > > And by definition, on AHCI (and sata_sil24, IIRC) the status will not > change unless a new FIS has arrived. > > Polling is still fine on PCI IDE-like controllers (older ones), but > advanced controllers require us to coalesce the polling bandaid into a > test for a sequence of events. > > We cannot escape the "hard part." :) I don't think the "hard part" exists at all. 1. There are only a handful of PATA devices which raise IRQ too early. For native SATA devices, it's much more difficult to get it wrong if you consider the SATA non-data and PIO transport protocol. For PATA devices bridged to SATA, again, there's nothing much we can do. The bridge implements HSM and would send D2H Reg FIS on command completion IRQ. If the PATA shows incorrect register values at that stage, well, that's it. 3. Intelligent controllers such as AHCI and sil24 implement some part of HSM in the silicon. sil24 implements most of it, ahci a bit less, but, even for ahci, the too early interrupt can trigger internal HSM failure. I don't think we can do much in such cases. sil24 doesn't even update the TF area if command is not in progress. In the intelligent controllers, the problem polling SETXFER tries to solve is in lower layer than OS driver. So, I don't think the problem exists for SATA in the first place. At least there hasn't been any report of it and doing SETXFER by polling can handle all the existing cases. We can and probably should deal with such SATA devices when and if they come up. How are we gonna verify the controller doesn't crap itself and ahci TF register monitoring HSM can work around the weirdo when we don't have any such device? Even if we determine that we need to do HSM over intelligent SATA controller now, I think we still need to push polling SETXFER first to take care of the existing cases. Thanks. -- tejun ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libata: always use polling SETXFER 2007-05-25 11:58 ` Tejun Heo @ 2007-05-25 12:26 ` Jeff Garzik 2007-05-25 12:52 ` Tejun Heo 0 siblings, 1 reply; 4+ messages in thread From: Jeff Garzik @ 2007-05-25 12:26 UTC (permalink / raw) To: Tejun Heo; +Cc: Alan Cox, linux-ide, Linux Kernel Mailing List Tejun Heo wrote: > So, I don't think the problem exists for SATA in the first place. At > least there hasn't been any report of it and doing SETXFER by polling > can handle all the existing cases. We can and probably should deal with > such SATA devices when and if they come up. How are we gonna verify the > controller doesn't crap itself and ahci TF register monitoring HSM can > work around the weirdo when we don't have any such device? Even if we > determine that we need to do HSM over intelligent SATA controller now, I > think we still need to push polling SETXFER first to take care of the > existing cases. Doing SETXFER by polling only handles the cases where the driver actually honors ATA_TFLAG_POLLING, which is /not/ always the case. If the new policy ensures that it continues to be OK to /not/ honor ATA_TFLAG_POLLING -- thus limiting SETXFER polling assumptions to older hardware -- that's fine, and it merely needs to be documented. But let us not make the assumption that this bandaid fixes all cases, because the bandaid is not applied in all cases. Jeff ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libata: always use polling SETXFER 2007-05-25 12:26 ` Jeff Garzik @ 2007-05-25 12:52 ` Tejun Heo 0 siblings, 0 replies; 4+ messages in thread From: Tejun Heo @ 2007-05-25 12:52 UTC (permalink / raw) To: Jeff Garzik; +Cc: Alan Cox, linux-ide, Linux Kernel Mailing List Jeff Garzik wrote: > Tejun Heo wrote: >> So, I don't think the problem exists for SATA in the first place. At >> least there hasn't been any report of it and doing SETXFER by polling >> can handle all the existing cases. We can and probably should deal with >> such SATA devices when and if they come up. How are we gonna verify the >> controller doesn't crap itself and ahci TF register monitoring HSM can >> work around the weirdo when we don't have any such device? Even if we >> determine that we need to do HSM over intelligent SATA controller now, I >> think we still need to push polling SETXFER first to take care of the >> existing cases. > > Doing SETXFER by polling only handles the cases where the driver > actually honors ATA_TFLAG_POLLING, which is /not/ always the case. > > If the new policy ensures that it continues to be OK to /not/ honor > ATA_TFLAG_POLLING -- thus limiting SETXFER polling assumptions to older > hardware -- that's fine, and it merely needs to be documented. Basically this flag applies to drivers which is SFF compliant, at least at TF interface level. There also are other flags/callbacks which only apply to SFF or BMDMA. It would be nice to separate them out in the long term and yeah it needs documentation. > But let us not make the assumption that this bandaid fixes all cases, > because the bandaid is not applied in all cases. It covers all the known cases but I agree that SFF specific things certainly need documentation. Thanks. -- tejun ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-05-25 12:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20070314053338.GA15600@htj.dyndns.org>
2007-05-25 10:58 ` [PATCH] libata: always use polling SETXFER Jeff Garzik
2007-05-25 11:58 ` Tejun Heo
2007-05-25 12:26 ` Jeff Garzik
2007-05-25 12:52 ` Tejun Heo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox