|
Subject: Why we were seeing so many spurious NCQ completions Newsgroups: gmane.linux.ide Date: 2007-12-07 02:18:00 GMT (1 year, 29 weeks, 6 days, 16 hours and 3 minutes ago) Hello, all. This has been going on for quite some time now but I finally succeeded to reproduce the problem and find out what has been going on. It wasn't drive's or controller's fault. The spurious completion detection logic was wrong which makes all of this my fault.
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 4688dbf..9f9a658 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1664,6 +1664,10 @@ static void ahci_port_intr(struct ata_port *ap)
}
if (status & PORT_IRQ_SDB_FIS) {
+ const __le32 *f = pp->rx_fis + RX_FIS_SDB;
+ u32 t = le32_to_cpu(f[1]);
+ int i;
+
/* If SNotification is available, leave notification
* handling to sata_async_notification(). If not,
* emulate it by snooping SDB FIS RX area.
@@ -1686,6 +1690,32 @@ static void ahci_port_intr(struct ata_port *ap)
if (f0 & (1 << 15))
sata_async_notification(ap);
}
+
+ if (le32_to_cpu(f[1]) & ~pp->active_link->sactive)
+ ata_link_printk(pp->active_link, KERN_INFO,
+ "XXX issue=0x%x SAct=0x%x sactive=0x%x SDB FIS=%08x:%08x\n",
+ readl(port_mmio + PORT_CMD_ISSUE),
+ readl(port_mmio + PORT_SCR_ACT),
+ pp->active_link->sactive,
+ le32_to_cpu(f[0]), le32_to_cpu(f[1]));
+ else
+ ata_link_printk(pp->active_link, KERN_INFO,
+ "MON issue=0x%x SAct=0x%x sactive=0x%x SDB FIS=%08x:%08x\n",
+ readl(port_mmio + PORT_CMD_ISSUE),
+ readl(port_mmio + PORT_SCR_ACT),
+ pp->active_link->sactive,
+ le32_to_cpu(f[0]), le32_to_cpu(f[1]));
+
+ for (i = 0; i < 100; i++) {
+ if (t != le32_to_cpu(f[1])) {
+ ata_link_printk(pp->active_link, KERN_INFO,
+ "YYY 0x%x -> 0x%x\n",
+ t, le32_to_cpu(f[1]));
+ break;
+ }
+ udelay(1);
+ cpu_relax();
+ }
}
/* pp->active_link is valid iff any command is in flight */
@@ -1746,7 +1776,7 @@ static void ahci_port_intr(struct ata_port *ap)
* with HSM violation. EH will turn off NCQ
* after several such failures.
*/
- ata_ehi_push_desc(ehi,
+ /* ata_ehi_push_desc(ehi,
"spurious completions during NCQ "
"issue=0x%x SAct=0x%x FIS=%08x:%08x",
readl(port_mmio + PORT_CMD_ISSUE),
@@ -1754,7 +1784,7 @@ static void ahci_port_intr(struct ata_port *ap)
le32_to_cpu(f[0]), le32_to_cpu(f[1]));
ehi->err_mask |= AC_ERR_HSM;
ehi->action |= ATA_EH_SOFTRESET;
- ata_port_freeze(ap);
+ ata_port_freeze(ap);*/
} else {
if (!pp->ncq_saw_sdb)
ata_port_printk(ap, KERN_INFO,
|
|
|