public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org,
	IDE/ATA development list <linux-ide@vger.kernel.org>
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	Domenico Andreoli <cavokz@gmail.com>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Michael Tokarev <mjt@tls.msk.ru>,
	Jeff Garzik <jeff@garzik.org>,
	Diego Torres <dtorres@coral.dnsalias.org>,
	Tejun Heo <htejun@gmail.com>
Subject: [patch 56/60] libata: kill spurious NCQ completion detection
Date: Wed, 12 Dec 2007 22:53:41 -0800	[thread overview]
Message-ID: <20071213065341.GF6867@kroah.com> (raw)
In-Reply-To: <20071213065039.GA6867@kroah.com>

[-- Attachment #1: libata-kill-spurious-ncq-completion-detection.patch --]
[-- Type: text/plain, Size: 6324 bytes --]

2.6.23-stable review patch.  If anyone has any objections, please let us
know.

------------------
From: Tejun Heo <htejun@gmail.com>

patch 459ad68893a84fb0881e57919340b97edbbc3dc7 in mainline.

Spurious NCQ completion detection implemented in ahci was incorrect.
On AHCI receving and processing FISes and raising interrupts are not
interlocked and spurious interrupts are expected.

For example, if an interrupt occurs while interrupt handler is running
and the running interrupt handler handles the event the new IRQ
indicated, after IRQ handler finishes, it will be executed again
because IRQ pending bit is set by the new interrupt but there won't be
anything to process.

Please read the following message for more information.

  http://article.gmane.org/gmane.linux.ide/26012

This patch...

* Removes all spurious IRQ whining from ahci.  Spurious NCQ completion
  detection was completely wrong.  Spurious D2H Register FIS taught us
  that some early drives send spurious D2H Register FIS with I bit set
  while NCQ commands are in progress but none of recent drives does
  that and even the ones which show such behavior can do NCQ fine.

* Kills all NCQ blacklist entries which were added because of spurious
  NCQ completions.  I tracked down each commit and verified all
  removed ones are actually added because of spurious completions.

  WD740ADFD-00NLR1 wasn't deleted but moved upward because the drive
  not only had spurious NCQ completions but also is slow on sequential
  data transfers if NCQ is enabled.

  Maxtor 7V300F0 was added by 0e3dbc01d53940fe10e5a5cfec15ede3e929c918
  from Alan Cox.  I can only find evidences that the drive only had
  troubles with spuruious completions by searching the mailing list.
  This entry needs to be verified and removed if it doesn't have other
  NCQ related problems.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/ata/ahci.c        |   65 ----------------------------------------------
 drivers/ata/libata-core.c |   17 ------------
 2 files changed, 2 insertions(+), 80 deletions(-)

--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1432,7 +1432,7 @@ static void ahci_port_intr(struct ata_po
 	struct ata_eh_info *ehi = &ap->eh_info;
 	struct ahci_port_priv *pp = ap->private_data;
 	u32 status, qc_active;
-	int rc, known_irq = 0;
+	int rc;
 
 	status = readl(port_mmio + PORT_IRQ_STAT);
 	writel(status, port_mmio + PORT_IRQ_STAT);
@@ -1448,74 +1448,11 @@ static void ahci_port_intr(struct ata_po
 		qc_active = readl(port_mmio + PORT_CMD_ISSUE);
 
 	rc = ata_qc_complete_multiple(ap, qc_active, NULL);
-	if (rc > 0)
-		return;
 	if (rc < 0) {
 		ehi->err_mask |= AC_ERR_HSM;
 		ehi->action |= ATA_EH_SOFTRESET;
 		ata_port_freeze(ap);
-		return;
-	}
-
-	/* hmmm... a spurious interupt */
-
-	/* if !NCQ, ignore.  No modern ATA device has broken HSM
-	 * implementation for non-NCQ commands.
-	 */
-	if (!ap->sactive)
-		return;
-
-	if (status & PORT_IRQ_D2H_REG_FIS) {
-		if (!pp->ncq_saw_d2h)
-			ata_port_printk(ap, KERN_INFO,
-				"D2H reg with I during NCQ, "
-				"this message won't be printed again\n");
-		pp->ncq_saw_d2h = 1;
-		known_irq = 1;
-	}
-
-	if (status & PORT_IRQ_DMAS_FIS) {
-		if (!pp->ncq_saw_dmas)
-			ata_port_printk(ap, KERN_INFO,
-				"DMAS FIS during NCQ, "
-				"this message won't be printed again\n");
-		pp->ncq_saw_dmas = 1;
-		known_irq = 1;
-	}
-
-	if (status & PORT_IRQ_SDB_FIS) {
-		const __le32 *f = pp->rx_fis + RX_FIS_SDB;
-
-		if (le32_to_cpu(f[1])) {
-			/* SDB FIS containing spurious completions
-			 * might be dangerous, whine and fail commands
-			 * with HSM violation.  EH will turn off NCQ
-			 * after several such failures.
-			 */
-			ata_ehi_push_desc(ehi,
-				"spurious completions during NCQ "
-				"issue=0x%x SAct=0x%x FIS=%08x:%08x",
-				readl(port_mmio + PORT_CMD_ISSUE),
-				readl(port_mmio + PORT_SCR_ACT),
-				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);
-		} else {
-			if (!pp->ncq_saw_sdb)
-				ata_port_printk(ap, KERN_INFO,
-					"spurious SDB FIS %08x:%08x during NCQ, "
-					"this message won't be printed again\n",
-					le32_to_cpu(f[0]), le32_to_cpu(f[1]));
-			pp->ncq_saw_sdb = 1;
-		}
-		known_irq = 1;
 	}
-
-	if (!known_irq)
-		ata_port_printk(ap, KERN_INFO, "spurious interrupt "
-				"(irq_stat 0x%x active_tag 0x%x sactive 0x%x)\n",
-				status, ap->active_tag, ap->sactive);
 }
 
 static void ahci_irq_clear(struct ata_port *ap)
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3772,6 +3772,7 @@ static const struct ata_blacklist_entry 
 	/* Devices where NCQ should be avoided */
 	/* NCQ is slow */
         { "WDC WD740ADFD-00",   NULL,		ATA_HORKAGE_NONCQ },
+	{ "WDC WD740ADFD-00NLR1", NULL,		ATA_HORKAGE_NONCQ, },
 	/* http://thread.gmane.org/gmane.linux.ide/14907 */
 	{ "FUJITSU MHT2060BH",	NULL,		ATA_HORKAGE_NONCQ },
 	/* NCQ is broken */
@@ -3790,22 +3791,6 @@ static const struct ata_blacklist_entry 
 	{ "HTS541060G9SA00",    "MB3OC60D",     ATA_HORKAGE_NONCQ, },
 	{ "HTS541080G9SA00",    "MB4OC60D",     ATA_HORKAGE_NONCQ, },
 	{ "HTS541010G9SA00",    "MBZOC60D",     ATA_HORKAGE_NONCQ, },
-	/* Drives which do spurious command completion */
-	{ "HTS541680J9SA00",	"SB2IC7EP",	ATA_HORKAGE_NONCQ, },
-	{ "HTS541612J9SA00",	"SBDIC7JP",	ATA_HORKAGE_NONCQ, },
-	{ "HDT722516DLA380",	"V43OA96A",	ATA_HORKAGE_NONCQ, },
-	{ "Hitachi HTS541616J9SA00", "SB4OC70P", ATA_HORKAGE_NONCQ, },
-	{ "Hitachi HTS542525K9SA00", "BBFOC31P", ATA_HORKAGE_NONCQ, },
-	{ "WDC WD740ADFD-00NLR1", NULL,		ATA_HORKAGE_NONCQ, },
-	{ "WDC WD3200AAJS-00RYA0", "12.01B01",	ATA_HORKAGE_NONCQ, },
-	{ "FUJITSU MHV2080BH",	"00840028",	ATA_HORKAGE_NONCQ, },
-	{ "ST9120822AS",	"3.CLF",	ATA_HORKAGE_NONCQ, },
-	{ "ST9160821AS",	"3.CLF",	ATA_HORKAGE_NONCQ, },
-	{ "ST9160821AS",	"3.ALD",	ATA_HORKAGE_NONCQ, },
-	{ "ST9160821AS",	"3.CCD",	ATA_HORKAGE_NONCQ, },
-	{ "ST3160812AS",	"3.ADJ",	ATA_HORKAGE_NONCQ, },
-	{ "ST980813AS",		"3.ADB",	ATA_HORKAGE_NONCQ, },
-	{ "SAMSUNG HD401LJ",	"ZZ100-15",	ATA_HORKAGE_NONCQ, },
 
 	/* devices which puke on READ_NATIVE_MAX */
 	{ "HDS724040KLSA80",	"KFAOA20N",	ATA_HORKAGE_BROKEN_HPA, },

-- 

  parent reply	other threads:[~2007-12-13  7:19 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20071213064518.328162328@mini.kroah.org>
2007-12-13  6:50 ` [patch 00/60] 2.6.23-stable review Greg KH
2007-12-13  6:50   ` [patch 01/60] libertas: properly account for queue commands Greg KH
2007-12-13  6:51   ` [patch 02/60] NET: random : secure_tcp_sequence_number should not assume CONFIG_KTIME_SCALAR Greg KH
2007-12-13  6:51   ` [patch 03/60] NETFILTER: Fix NULL pointer dereference in nf_nat_move_storage() Greg KH
2007-12-13  6:51   ` [patch 04/60] rd: fix data corruption on memory pressure Future of Linux 2.6.22.y series Greg KH
2007-12-13  6:51   ` [patch 05/60] sched: some proc entries are missed in sched_domain sys_ctl debug code Greg KH
2007-12-13  6:51   ` [patch 06/60] PKT_SCHED: Check subqueue status before calling hard_start_xmit Greg KH
2007-12-13  6:51   ` [patch 07/60] Fix synchronize_irq races with IRQ handler Greg KH
2007-12-13  6:51   ` [patch 08/60] Input: ALPS - add support for model found in Dell Vostro 1400 Greg KH
2007-12-13  6:51   ` [patch 09/60] Input: ALPS - add signature for ThinkPad R61 Greg KH
2007-12-13 13:41     ` Dmitry Torokhov
2007-12-13 16:38       ` Greg KH
2007-12-13  6:51   ` [patch 10/60] USB: make the microtek driver and HAL cooperate Greg KH
2007-12-13  6:51   ` [patch 11/60] USB: fix up EHCI startup synchronization Greg KH
2007-12-13  6:51   ` [patch 12/60] tmpfs: restore missing clear_highpage Greg KH
2007-12-13  6:51   ` [patch 13/60] I4L: fix isdn_ioctl memory overrun vulnerability Greg KH
2007-12-13  6:51   ` [patch 14/60] forcedeth: new mcp79 pci ids Greg KH
2007-12-13  6:51   ` [patch 15/60] forcedeth boot delay fix Greg KH
2007-12-13  6:51   ` [patch 16/60] hrtimers: avoid overflow for large relative timeouts (CVE-2007-5966) Greg KH
2007-12-13  6:51   ` [patch 17/60] KVM: x86 emulator: implement movnti mem, reg Greg KH
2007-12-13  6:51   ` [patch 18/60] KVM: x86 emulator: fix access registers for instructions with ModR/M byte and Mod = 3 Greg KH
2007-12-13  6:51   ` [patch 19/60] KVM: x86 emulator: invd instruction Greg KH
2007-12-13  6:51   ` [patch 20/60] KVM: SVM: Intercept the invd and wbinvd instructions Greg KH
2007-12-13  6:52   ` [patch 21/60] KVM: x86 emulator: Use emulator_write_emulated and not emulator_write_std Greg KH
2007-12-13  6:52   ` [patch 22/60] KVM: Fix hang on uniprocessor Greg KH
2007-12-13  6:52   ` [patch 23/60] KVM: SVM: Fix FPU leak while emulating clts Greg KH
2007-12-13  6:52   ` [patch 24/60] KVM: Skip pio instruction when it is emulated, not executed Greg KH
2007-12-13  6:52   ` [patch 25/60] KVM: VMX: Force vm86 mode if setting flags during real mode Greg KH
2007-12-13  6:52   ` [patch 26/60] KVM: VMX: Reset mmu context when entering " Greg KH
2007-12-13  6:52   ` [patch 27/60] x86 setup: add a near jump to serialize %cr0 on 386/486 Greg KH
2007-12-13  6:52   ` [patch 28/60] isdn: avoid copying overly-long strings Greg KH
2007-12-13  6:52   ` [patch 29/60] futex: fix for futex_wait signal stack corruption Greg KH
2007-12-13  6:52   ` [patch 30/60] Freezer: Fix APM emulation breakage Greg KH
2007-12-13  6:52   ` [patch 31/60] PNP: increase the maximum number of resources Greg KH
2007-12-13  6:52   ` [patch 32/60] wait_task_stopped(): pass correct exit_code to wait_noreap_copyout() Greg KH
2007-12-13  6:52   ` Greg KH
2007-12-13  6:52   ` [patch 33/60] fb_ddc: fix DDC lines quirk Greg KH
2007-12-13  6:52   ` [patch 34/60] revert "dpt_i2o: convert to SCSI hotplug model" Greg KH
2007-12-13  6:52   ` [patch 35/60] esp_scsi: fix reset cleanup spinlock recursion Greg KH
2007-12-13  6:52   ` [patch 36/60] nf_nat: fix memset error Greg KH
2007-12-13  6:52   ` [patch 37/60] netfilter: Fix kernel panic with REDIRECT target Greg KH
2007-12-13  6:52   ` [patch 38/60] create /sys/.../power when CONFIG_PM is set Greg KH
2007-12-13  6:52   ` [patch 39/60] NET: Corrects a bug in ip_rt_acct_read() Greg KH
2007-12-13  6:53   ` [patch 40/60] IPV4: Remove bogus ifdef mess in arp_process Greg KH
2007-12-13  6:53   ` [patch 41/60] ATM: initialize lock and tasklet earlier Greg KH
2007-12-13  6:53   ` [patch 42/60] TCP: Problem bug with sysctl_tcp_congestion_control function Greg KH
2007-12-13  6:53   ` [patch 43/60] CRYPTO api: Fix potential race in crypto_remove_spawn Greg KH
2007-12-13  6:53   ` [patch 44/60] TCP: Fix TCP header misalignment Greg KH
2007-12-13  6:53   ` [patch 45/60] TCP: MTUprobe: fix potential sk_send_head corruption Greg KH
2007-12-13  6:53   ` [patch 46/60] PFKEY: Sending an SADB_GET responds with an SADB_GET Greg KH
2007-12-13  6:53   ` [patch 47/60] BRIDGE: Lost call to br_fdb_fini() in br_init() error path Greg KH
2007-12-13  6:53   ` [patch 48/60] RXRPC: Add missing select on CRYPTO Greg KH
2007-12-13  6:53   ` [patch 49/60] TEXTSEARCH: Do not allow zero length patterns in the textsearch infrastructure Greg KH
2007-12-13  6:53   ` [patch 50/60] VLAN: Fix nested VLAN transmit bug Greg KH
2007-12-13  6:53   ` [patch 51/60] DECNET: dn_nl_deladdr() almost always returns no error Greg KH
2007-12-13  6:53   ` [patch 52/60] IPV6: Restore IPv6 when MTU is big enough Greg KH
2007-12-13  6:53   ` [patch 53/60] TCP: illinois: Incorrect beta usage Greg KH
2007-12-13  6:53   ` [patch 54/60] UNIX: EOF on non-blocking SOCK_SEQPACKET Greg KH
2007-12-13  6:53   ` [patch 55/60] NETFILTER: fix forgotten module release in xt_CONNMARK and xt_CONNSECMARK Greg KH
2007-12-13  6:53   ` Greg KH [this message]
2007-12-13  6:53   ` [patch 57/60] XFRM: Fix leak of expired xfrm_states Greg KH
2007-12-13  6:53   ` [patch 58/60] NETFILTER: xt_TCPMSS: remove network triggerable WARN_ON Greg KH
2007-12-13  6:53   ` [patch 59/60] BRIDGE: Properly dereference the br_should_route_hook Greg KH
2007-12-13  6:53   ` [patch 60/60] XFS: Make xfsbufd threads freezable Greg KH
2007-12-13  7:02   ` [patch 00/60] 2.6.23-stable review Greg KH
2007-12-15 16:09   ` Jan Evert van Grootheest
2007-12-15 18:08     ` Greg KH
2007-12-27 10:11       ` Jan Evert van Grootheest
2007-12-27 18:25         ` Jan Engelhardt

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=20071213065341.GF6867@kroah.com \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cavokz@gmail.com \
    --cc=cebbert@redhat.com \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=dtorres@coral.dnsalias.org \
    --cc=htejun@gmail.com \
    --cc=jeff@garzik.org \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjt@tls.msk.ru \
    --cc=mkrufky@linuxtv.org \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=zwane@arm.linux.org.uk \
    /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