]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
x86/irq: Prevent force migration of irqs which are not in the vector domain
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 3 Oct 2016 10:17:08 +0000 (13:17 +0300)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 8 Nov 2016 16:44:25 +0000 (16:44 +0000)
commit28f19d82c63e3af29894f00add00750bfb3cb7cd
tree388e1311a9934fa971554f137b4ded1a3f74a7e6
parente30f87825bbdd545681dcb6ba15090ceece3e6dd
x86/irq: Prevent force migration of irqs which are not in the vector domain

BugLink: http://bugs.launchpad.net/bugs/1634153
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>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
arch/x86/kernel/apic/vector.c