From: Jiri Slaby <jslaby@suse.cz>
To: stable@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Helge Deller <deller@gmx.de>,
Jiri Slaby <jslaby@suse.cz>
Subject: [PATCH 3.12 56/84] parisc: Filter out spurious interrupts in PA-RISC irq handler
Date: Fri, 2 Oct 2015 15:25:01 +0200 [thread overview]
Message-ID: <768cb8d9028cc71a8b3ecc6d2de9f02db09b044f.1443792303.git.jslaby@suse.cz> (raw)
In-Reply-To: <4386f737d429451d61358f771e315ed47e2f451f.1443792303.git.jslaby@suse.cz>
In-Reply-To: <cover.1443792303.git.jslaby@suse.cz>
From: Helge Deller <deller@gmx.de>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit b1b4e435e4ef7de77f07bf2a42c8380b960c2d44 upstream.
When detecting a serial port on newer PA-RISC machines (with iosapic) we have a
long way to go to find the right IRQ line, registering it, then registering the
serial port and the irq handler for the serial port. During this phase spurious
interrupts for the serial port may happen which then crashes the kernel because
the action handler might not have been set up yet.
So, basically it's a race condition between the serial port hardware and the
CPU which sets up the necessary fields in the irq sructs. The main reason for
this race is, that we unmask the serial port irqs too early without having set
up everything properly before (which isn't easily possible because we need the
IRQ number to register the serial ports).
This patch is a work-around for this problem. It adds checks to the CPU irq
handler to verify if the IRQ action field has been initialized already. If not,
we just skip this interrupt (which isn't critical for a serial port at bootup).
The real fix would probably involve rewriting all PA-RISC specific IRQ code
(for CPU, IOSAPIC, GSC and EISA) to use IRQ domains with proper parenting of
the irq chips and proper irq enabling along this line.
This bug has been in the PA-RISC port since the beginning, but the crashes
happened very rarely with currently used hardware. But on the latest machine
which I bought (a C8000 workstation), which uses the fastest CPUs (4 x PA8900,
1GHz) and which has the largest possible L1 cache size (64MB each), the kernel
crashed at every boot because of this race. So, without this patch the machine
would currently be unuseable.
For the record, here is the flow logic:
1. serial_init_chip() in 8250_gsc.c calls iosapic_serial_irq().
2. iosapic_serial_irq() calls txn_alloc_irq() to find the irq.
3. iosapic_serial_irq() calls cpu_claim_irq() to register the CPU irq
4. cpu_claim_irq() unmasks the CPU irq (which it shouldn't!)
5. serial_init_chip() then registers the 8250 port.
Problems:
- In step 4 the CPU irq shouldn't have been registered yet, but after step 5
- If serial irq happens between 4 and 5 have finished, the kernel will crash
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/parisc/kernel/irq.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index 2e6443b1e922..c32a37e0e0d2 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -524,8 +524,8 @@ void do_cpu_irq_mask(struct pt_regs *regs)
struct pt_regs *old_regs;
unsigned long eirr_val;
int irq, cpu = smp_processor_id();
-#ifdef CONFIG_SMP
struct irq_desc *desc;
+#ifdef CONFIG_SMP
cpumask_t dest;
#endif
@@ -538,8 +538,12 @@ void do_cpu_irq_mask(struct pt_regs *regs)
goto set_out;
irq = eirr_to_irq(eirr_val);
-#ifdef CONFIG_SMP
+ /* Filter out spurious interrupts, mostly from serial port at bootup */
desc = irq_to_desc(irq);
+ if (unlikely(!desc->action))
+ goto set_out;
+
+#ifdef CONFIG_SMP
cpumask_copy(&dest, desc->irq_data.affinity);
if (irqd_is_per_cpu(&desc->irq_data) &&
!cpu_isset(smp_processor_id(), dest)) {
--
2.6.0
next prev parent reply other threads:[~2015-10-02 13:26 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 01/84] PCI: Add dev_flags bit to access VPD through function 0 Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 02/84] PCI: Add VPD function 0 quirk for Intel Ethernet devices Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 03/84] staging: comedi: usbduxsigma: don't clobber ai_timer in command test Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 04/84] staging: comedi: usbduxsigma: don't clobber ao_timer " Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 05/84] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230 Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 06/84] ext4: move check under lock scope to close a race Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 07/84] libfc: Fix fc_fcp_cleanup_each_cmd() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 08/84] regmap: regcache-rbtree: Clean new present bits on present bitmap resize Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 09/84] crypto: caam - fix memory corruption in ahash_final_ctx Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 10/84] arm64: KVM: Fix host crash when injecting a fault into a 32bit guest Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 11/84] DRM - radeon: Don't link train DisplayPort on HPD until we get the dpcd Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 12/84] drm/qxl: validate monitors config modes Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 13/84] iio: Add inverse unit conversion macros Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 14/84] iio: adis16480: Fix scale factors Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 15/84] clk: versatile: off by one in clk_sp810_timerclken_of_get() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 16/84] PCI: Fix TI816X class code quirk Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 17/84] USB: symbolserial: Use usb_get_serial_port_data Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 18/84] USB: ftdi_sio: Added custom PID for CustomWare products Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 19/84] usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 20/84] usb: host: ehci-sys: delete useless bus_to_hcd conversion Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 21/84] serial: 8250: don't bind to SMSC IrCC IR port Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 22/84] crypto: ghash-clmulni: specify context size for ghash async algorithm Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 23/84] HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 24/84] KVM: MMU: fix validation of mmio page fault Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 25/84] xtensa: fix threadptr reload on return to userspace Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 26/84] xtensa: fix kernel register spilling Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 27/84] devres: fix devres_get() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 28/84] auxdisplay: ks0108: fix refcount Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 29/84] of/address: Don't loop forever in of_find_matching_node_by_address() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 30/84] ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 31/84] drivercore: Fix unregistration path of platform devices Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 32/84] hpfs: update ctime and mtime on directory modification Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 33/84] tty/vt: don't set font mappings on vc not supporting this Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 34/84] unshare: Unsharing a thread does not require unsharing a vm Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 35/84] rtlwifi: rtl8192cu: Add new device ID Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 36/84] tg3: Fix temperature reporting Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 37/84] mac80211: enable assoc check for mesh interfaces Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 38/84] arm64: kconfig: Move LIST_POISON to a safe value Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 39/84] arm64: compat: fix vfp save/restore across signal handlers in big-endian Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 40/84] arm64: head.S: initialise mdcr_el2 in el2_setup Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 41/84] arm64: errata: add module build workaround for erratum #843419 Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 42/84] arm64: KVM: Disable virtual timer even if the guest is not using it Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 43/84] Input: evdev - do not report errors form flush() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 44/84] ALSA: hda - Enable headphone jack detect on old Fujitsu laptops Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 45/84] ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437 Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 46/84] powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 47/84] powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 48/84] powerpc/mm: Recompute hash value after a failed update Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 49/84] Add radeon suspend/resume quirk for HP Compaq dc5750 Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 50/84] x86/mm: Initialize pmd_idx in page_table_range_init_count() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 51/84] rc-core: fix remove uevent generation Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 52/84] v4l: omap3isp: Fix sub-device power management code Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 53/84] Btrfs: check if previous transaction aborted to avoid fs corruption Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 54/84] NFSv4: don't set SETATTR for O_RDONLY|O_EXCL Jiri Slaby
2015-10-02 13:25 ` [PATCH 3.12 55/84] NFS: nfs_set_pgio_error sometimes misses errors Jiri Slaby
2015-10-02 13:25 ` Jiri Slaby [this message]
2015-10-02 13:25 ` [PATCH 3.12 57/84] vmscan: fix increasing nr_isolated incurred by putback unevictable pages Jiri Slaby
2015-10-02 13:25 ` [PATCH 3.12 58/84] fs: if a coredump already exists, unlink and recreate with O_EXCL Jiri Slaby
2015-10-02 15:34 ` [PATCH 3.12 00/84] 3.12.49-stable review Shuah Khan
2015-10-06 8:40 ` Jiri Slaby
2015-10-02 16:09 ` Guenter Roeck
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=768cb8d9028cc71a8b3ecc6d2de9f02db09b044f.1443792303.git.jslaby@suse.cz \
--to=jslaby@suse.cz \
--cc=deller@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®