Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1500903
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.8 20/37] x86/irq: Prevent force migration of irqs which are not in the vector domain |
| Date | 2016-10-14 14:30 +0200 |
| Message-ID | <ss9MC-1cq-35@gated-at.bofh.it> (permalink) |
| References | <ss9MB-1cq-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
4.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <mika.westerberg@linux.intel.com>
commit db91aa793ff984ac048e199ea1c54202543952fe upstream.
When a CPU is about to be offlined we call fixup_irqs() that resets IRQ
affinities related to the CPU in question. The same thing is also done when
the system is suspended to S-states like S3 (mem).
For each IRQ we try to complete any on-going move regardless whether the
IRQ is actually part of x86_vector_domain. For each IRQ descriptor we fetch
its chip_data, assume it is of type struct apic_chip_data and manipulate it
by clearing old_domain mask etc. For irq_chips that are not part of the
x86_vector_domain, like those created by various GPIO drivers, will find
their chip_data being changed unexpectly.
Below is an example where GPIO chip owned by pinctrl-sunrisepoint.c gets
corrupted after resume:
# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 360-511, parent: platform/INT344B:00, INT344B:00:
gpio-511 ( |sysfs ) in hi
# rtcwake -s10 -mmem
<10 seconds passes>
# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 360-511, parent: platform/INT344B:00, INT344B:00:
gpio-511 ( |sysfs ) in ?
Note '?' in the output. It means the struct gpio_chip ->get function is
NULL whereas before suspend it was there.
Fix this by first checking that the IRQ belongs to x86_vector_domain before
we try to use the chip_data as struct apic_chip_data.
Reported-and-tested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: http://lkml.kernel.org/r/20161003101708.34795-1-mika.westerberg@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kernel/apic/vector.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
--- a/arch/x86/kernel/apic/vector.c
+++ b/arch/x86/kernel/apic/vector.c
@@ -661,11 +661,28 @@ void irq_complete_move(struct irq_cfg *c
*/
void irq_force_complete_move(struct irq_desc *desc)
{
- struct irq_data *irqdata = irq_desc_get_irq_data(desc);
- struct apic_chip_data *data = apic_chip_data(irqdata);
- struct irq_cfg *cfg = data ? &data->cfg : NULL;
+ struct irq_data *irqdata;
+ struct apic_chip_data *data;
+ struct irq_cfg *cfg;
unsigned int cpu;
+ /*
+ * The function is called for all descriptors regardless of which
+ * irqdomain they belong to. For example if an IRQ is provided by
+ * an irq_chip as part of a GPIO driver, the chip data for that
+ * descriptor is specific to the irq_chip in question.
+ *
+ * Check first that the chip_data is what we expect
+ * (apic_chip_data) before touching it any further.
+ */
+ irqdata = irq_domain_get_irq_data(x86_vector_domain,
+ irq_desc_get_irq(desc));
+ if (!irqdata)
+ return;
+
+ data = apic_chip_data(irqdata);
+ cfg = data ? &data->cfg : NULL;
+
if (!cfg)
return;
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4.8 00/37] 4.8.2-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:30 +0200
[PATCH 4.8 27/37] x86/mm/pkeys: Do not skip PKRU register if debug registers are not used Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:30 +0200
[PATCH 4.8 19/37] x86/boot: Fix kdump, cleanup aborted E820_PRAM max_pfn manipulation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:30 +0200
[PATCH 4.8 24/37] x86/platform/intel-mid: Keep SRAM powered on at boot Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:30 +0200
[PATCH 4.8 17/37] KVM: PPC: BookE: Fix a sanity check Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:30 +0200
[PATCH 4.8 20/37] x86/irq: Prevent force migration of irqs which are not in the vector domain Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:30 +0200
[PATCH 4.8 01/37] usb: storage: fix runtime pm issue in usb_stor_probe2 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:30 +0200
[PATCH 4.8 18/37] arm64: fix dump_backtrace/unwind_frame with NULL tsk Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:30 +0200
[PATCH 4.8 16/37] KVM: arm/arm64: vgic: Dont flush/sync without a working vgic Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:30 +0200
[PATCH 4.8 08/37] mfd: rtsx_usb: Avoid setting ucr->current_sg.status Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 37/37] tpm_crb: fix crb_req_canceled behavior Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 26/37] arch/x86: Handle non enumerated CPU after physical hotplug Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 02/37] timekeeping: Fix __ktime_get_fast_ns() regression Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 34/37] Bluetooth: Add a new 04ca:3011 QCA_ROME device Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 22/37] x86/cpu: Rename Merrifield2 to Moorefield Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 05/37] ALSA: ali5451: Fix out-of-bound position reporting Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 36/37] tpm: fix a race condition in tpm2_unseal_trusted() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 30/37] ARM: dts: mvebu: armada-390: add missing compatibility string and bracket Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 07/37] ALSA: usb-line6: use the same declaration as definition in header for MIDI manufacturer ID Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 28/37] x86/dumpstack: Fix x86_32 kernel_stack_pointer() previous stack access Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 12/37] xen/x86: Update topology map for PV VCPUs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 35/37] ima: use file_dentry() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 06/37] ALSA: usb-audio: Extend DragonFly dB scale quirk to cover other variants Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 04/37] phy: sun4i-usb: Use spinlock to guard phyctl register access Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 09/37] mfd: atmel-hlcdc: Do not sleep in atomic context Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 03/37] usb: dwc3: fix Clear Stall EP command failure Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 23/37] x86/platform/intel-mid: Add Intel Penwell to ID table Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 33/37] ARM: cpuidle: Fix error return code Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
[PATCH 4.8 21/37] x86/pkeys: Make protection keys an "eager" feature Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 14:40 +0200
Re: [PATCH 4.8 00/37] 4.8.2-stable review Shuah Khan <shuah.kh@samsung.com> - 2016-10-14 21:00 +0200
Re: [PATCH 4.8 00/37] 4.8.2-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-15 14:10 +0200
Re: [PATCH 4.8 00/37] 4.8.2-stable review Guenter Roeck <linux@roeck-us.net> - 2016-10-14 21:20 +0200
Re: [PATCH 4.8 00/37] 4.8.2-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-15 14:10 +0200
Re: [PATCH 4.8 00/37] 4.8.2-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-15 13:40 +0200
Re: [PATCH 4.8 00/37] 4.8.2-stable review Kevin Hilman <khilman@baylibre.com> - 2016-10-17 18:50 +0200
csiph-web