stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Alexander Gordeev <agordeev@redhat.com>,
	Tejun Heo <tj@kernel.org>,
	linux-ide@vger.kernel.org
Subject: [PATCH 3.14 36/83] ahci: Ensure "MSI Revert to Single Message" mode is not enforced
Date: Sun, 11 May 2014 21:19:37 +0200	[thread overview]
Message-ID: <20140511191911.954666115@linuxfoundation.org> (raw)
In-Reply-To: <20140511191907.024339448@linuxfoundation.org>

3.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Gordeev <agordeev@redhat.com>

commit ab0f9e78b97f5193dd38b3757b42b6fbded05fb7 upstream.

The AHCI specification allows hardware to choose to revert to
single MSI mode when fewer messages are allocated than requested.
Yet, at least ICH10 chipset reverts to single MSI mode even when
enough messages are allocated in some cases (see below).

This update forces the driver to not rely on initialization of
multiple MSIs mode alone and always check if "MSI Revert to
Single Message" (MRSM) mode was enforced by the controller and
fallback to the single MSI mode in case it did.

That prevents a situation when the driver configured multiple
per-port IRQ handlers, but the controller sends all port's
interrupts to a single IRQ, which could easily screw up the
interrupt handling and lead to delays and possibly crashes.

The fix was tested on a 6-port controller that successfully
reverted to the single MSI mode:

00:1f.2 SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA
AHCI Controller (prog-if 01 [AHCI 1.0])
	Subsystem: Super Micro Computer Inc Device 10a7
	Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 101
	I/O ports at f110 [size=8]
	I/O ports at f100 [size=4]
	I/O ports at f0f0 [size=8]
	I/O ports at f0e0 [size=4]
	I/O ports at f020 [size=32]
	Memory at fbf00000 (32-bit, non-prefetchable) [size=2K]
	Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit-
	Capabilities: [70] Power Management version 3
	Capabilities: [a8] SATA HBA v1.0
	Capabilities: [b0] PCI Advanced Features
	Kernel driver in use: ahci

With 6 ports just 8 MSI vectors should be enough, but the adapter
enforces the MRSM mode when less than 16 vectors are written to
the Multiple Messages Enable PCI register. I instigated MRSM mode
by forcing @nvec to 8 in ahci_init_interrupts().

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: linux-ide@vger.kernel.org
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/ata/ahci.c |    9 ++++++++-
 drivers/ata/ahci.h |    1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1163,7 +1163,7 @@ static inline void ahci_gtf_filter_worka
 #endif
 
 static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports,
-			 struct ahci_host_priv *hpriv)
+				struct ahci_host_priv *hpriv)
 {
 	int rc, nvec;
 
@@ -1189,6 +1189,13 @@ static int ahci_init_interrupts(struct p
 	else if (rc > 0)
 		goto single_msi;
 
+	/* fallback to single MSI mode if the controller enforced MRSM mode */
+	if (readl(hpriv->mmio + HOST_CTL) & HOST_MRSM) {
+		pci_disable_msi(pdev);
+		printk(KERN_INFO "ahci: MRSM is on, fallback to single MSI\n");
+		goto single_msi;
+	}
+
 	return nvec;
 
 single_msi:
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -91,6 +91,7 @@ enum {
 	/* HOST_CTL bits */
 	HOST_RESET		= (1 << 0),  /* reset controller; self-clear */
 	HOST_IRQ_EN		= (1 << 1),  /* global IRQ enable */
+	HOST_MRSM		= (1 << 2),  /* MSI Revert to Single Message */
 	HOST_AHCI_EN		= (1 << 31), /* AHCI enabled */
 
 	/* HOST_CAP bits */



  parent reply	other threads:[~2014-05-11 19:19 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-11 19:19 [PATCH 3.14 00/83] 3.14.4-stable review Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 01/83] drivers/tty/hvc: dont free hvc_console_setup after init Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 02/83] tty: serial: 8250_core.c Bug fix for Exar chips Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 03/83] tty: Fix lockless tty buffer race Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 04/83] n_tty: Fix n_tty_write crash when echoing in raw mode Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 05/83] floppy: ignore kernel-only members in FDRAWCMD ioctl input Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 06/83] floppy: dont write kernel-only members to FDRAWCMD ioctl output Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 07/83] KVM: ARM: vgic: Fix sgi dispatch problem Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 08/83] arm: KVM: fix possible misalignment of PGDs and bounce page Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 09/83] KVM: async_pf: mm->mm_users can not pin apf->mm Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 10/83] KVM: ioapic: fix assignment of ioapic->rtc_status.pending_eoi (CVE-2014-0155) Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 11/83] MIPS: KVM: Pass reserved instruction exceptions to guest Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 12/83] KVM: PPC: Book3S HV: Fix KVM hang with CONFIG_KVM_XICS=n Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 13/83] MIPS: Hibernate: Flush TLB entries in swsusp_arch_resume() Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 14/83] virtio_balloon: dont softlockup on huge balloon changes Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 15/83] tools/virtio: add a missing ) Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 16/83] [SCSI] virtio-scsi: Skip setting affinity on uninitialized vq Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 17/83] [SCSI] mpt2sas: Dont disable device twice at suspend Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 18/83] powerpc/compat: 32-bit little endian machine name is ppcle, not ppc Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 19/83] powerpc/tm: Disable IRQ in tm_recheckpoint Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 20/83] powerpc: Fix Oops in rtas_stop_self() Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 21/83] s390/chsc: fix SEI usage on old FW levels Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 22/83] s390/bpf,jit: initialize A register if 1st insn is BPF_S_LDX_B_MSH Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 23/83] ASoC: dapm: Fix widget double free with auto-disable DAPM kcontrol Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 24/83] ARC: Remove ARC_HAS_COH_RTSC Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 25/83] SUNRPC: Ensure that call_connect times out correctly Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 26/83] SUNRPC: Ensure call_connect_status() deals correctly with SOFTCONN tasks Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 27/83] ARC: !PREEMPT: Ensure Return to kernel mode is IRQ safe Greg Kroah-Hartman
2014-05-12  4:54   ` Vineet Gupta
2014-05-13 11:06     ` Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 28/83] framebuffer: fix cfb_copyarea Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 29/83] matroxfb: restore the registers M_ACCESS and M_PITCH Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 30/83] mach64: use unaligned access Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 31/83] mach64: fix cursor when character width is not a multiple of 8 pixels Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 32/83] b43: Fix machine check error due to improper access of B43_MMIO_PSM_PHY_HDR Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 33/83] Revert "net: mvneta: fix usage as a module on RGMII configurations" Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 34/83] ahci: do not request irq for dummy port Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 35/83] libata/ahci: accommodate tag ordered controllers Greg Kroah-Hartman
2014-05-11 19:19 ` Greg Kroah-Hartman [this message]
2014-05-11 19:19 ` [PATCH 3.14 37/83] ahci: Do not receive interrupts sent by dummy ports Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 38/83] libata: Update queued trim blacklist for M5x0 drives Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 39/83] iwlwifi: dvm: take mutex when sending SYNC BT config command Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 40/83] iwlwifi: mvm: disable uAPSD due to bugs in the firmware Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 41/83] crush: fix off-by-one errors in total_tries refactor Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 42/83] mac80211: fix potential use-after-free Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 43/83] mac80211: fix WPA with VLAN on AP side with ps-sta again Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 44/83] mac80211: fix suspend vs. authentication race Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 45/83] mac80211: fix software remain-on-channel implementation Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 46/83] mac80211: exclude AP_VLAN interfaces from tx power calculation Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 47/83] ath9k: fix ready time of the multicast buffer queue Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 48/83] locks: allow __break_lease to sleep even when break_time is 0 Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 49/83] rtlwifi: rtl8723ae: Fix too long disable of IRQs Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 50/83] rtlwifi: rtl8188ee: " Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 51/83] rtlwifi: rtl8192cu: " Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 52/83] rtlwifi: rtl8192se: " Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 53/83] rtlwifi: rtl8192se: Fix regression due to commit 1bf4bbb Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 54/83] rtlwifi: rtl8188ee: initialize packet_beacon Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 55/83] gpio: mxs: Allow for recursive enable_irq_wake() call Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 56/83] pinctrl: as3722: fix handling of GPIO invert bit Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 57/83] tgafb: fix mode setting with fbset Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.14 58/83] tgafb: fix data copying Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 59/83] mtd: atmel_nand: Disable subpage NAND write when using Atmel PMECC Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 60/83] mtd: diskonchip: mem resource name is not optional Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 61/83] mtd: nuc900_nand: NULL dereference in nuc900_nand_enable() Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 62/83] mtd: sm_ftl: heap corruption in sm_create_sysfs_attributes() Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 63/83] Skip intel_crt_init for Dell XPS 8700 Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 64/83] dm cache: prevent corruption caused by discard_block_size > cache_block_size Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 65/83] dm transaction manager: fix corruption due to non-atomic transaction commit Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 66/83] dm: take care to copy the space map roots before locking the superblock Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 67/83] dm thin: fix dangling bio in process_deferred_bios error path Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 68/83] dm cache: fix a lock-inversion Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 69/83] dma: edma: fix incorrect SG list handling Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 70/83] aio: v4 ensure access to ctx->ring_pages is correctly serialised for migration Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 71/83] lockd: ensure we tear down any live sockets when socket creation fails during lockd_up Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 72/83] lib/percpu_counter.c: fix bad percpu counter state during suspend Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 73/83] mmc: sdhci-bcm-kona: fix build errors when built-in Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 74/83] thinkpad_acpi: Fix inconsistent mute LED after resume Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 75/83] Input: synaptics - add min/max quirk for ThinkPad T431s, L440, L540, S1 Yoga and X1 Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 76/83] Input: synaptics - add min/max quirk for ThinkPad Edge E431 Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 77/83] cpufreq: loongson2_cpufreq: dont declare local variable as static Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 78/83] cpufreq: at32ap: " Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 79/83] ACPI / processor: Fix failure of loading acpi-cpufreq driver Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 80/83] cpufreq: unicore32: fix typo issue for clk Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 81/83] drm: cirrus: add power management support Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 82/83] drm: bochs: " Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.14 83/83] x86-64, build: Fix stack protector Makefile breakage with 32-bit userland Greg Kroah-Hartman
2014-05-11 22:52 ` [PATCH 3.14 00/83] 3.14.4-stable review Guenter Roeck
2014-05-12 20:30   ` Greg Kroah-Hartman
2014-05-12 21:53 ` Shuah Khan
2014-05-12 22:28   ` Greg Kroah-Hartman

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=20140511191911.954666115@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=agordeev@redhat.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tj@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).