]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.53/irqchip-gic-v3-its-don-t-bind-lpi-to-unavailable-numa-node.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.53 / irqchip-gic-v3-its-don-t-bind-lpi-to-unavailable-numa-node.patch
1 From c1797b11a09c8323c92b074fd48b89a936c991d0 Mon Sep 17 00:00:00 2001
2 From: Yang Yingliang <yangyingliang@huawei.com>
3 Date: Fri, 22 Jun 2018 10:52:51 +0100
4 Subject: irqchip/gic-v3-its: Don't bind LPI to unavailable NUMA node
5
6 From: Yang Yingliang <yangyingliang@huawei.com>
7
8 commit c1797b11a09c8323c92b074fd48b89a936c991d0 upstream.
9
10 On a NUMA system, if an ITS is local to an offline node, the ITS driver may
11 pick an offline CPU to bind the LPI. In this case, pick an online CPU (and
12 the first one will do).
13
14 But on some systems, binding an LPI to non-local node CPU may cause
15 deadlock (see Cavium erratum 23144). In this case, just fail the activate
16 and return an error code.
17
18 Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
19 Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
20 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
21 Cc: Jason Cooper <jason@lakedaemon.net>
22 Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
23 Cc: Sumit Garg <sumit.garg@linaro.org>
24 Cc: stable@vger.kernel.org
25 Link: https://lkml.kernel.org/r/20180622095254.5906-5-marc.zyngier@arm.com
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27
28 ---
29 drivers/irqchip/irq-gic-v3-its.c | 9 ++++++++-
30 1 file changed, 8 insertions(+), 1 deletion(-)
31
32 --- a/drivers/irqchip/irq-gic-v3-its.c
33 +++ b/drivers/irqchip/irq-gic-v3-its.c
34 @@ -2221,7 +2221,14 @@ static void its_irq_domain_activate(stru
35 cpu_mask = cpumask_of_node(its_dev->its->numa_node);
36
37 /* Bind the LPI to the first possible CPU */
38 - cpu = cpumask_first(cpu_mask);
39 + cpu = cpumask_first_and(cpu_mask, cpu_online_mask);
40 + if (cpu >= nr_cpu_ids) {
41 + if (its_dev->its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144)
42 + return;
43 +
44 + cpu = cpumask_first(cpu_online_mask);
45 + }
46 +
47 its_dev->event_map.col_map[event] = cpu;
48 irq_data_update_effective_affinity(d, cpumask_of(cpu));
49