linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Yang Yingliang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: sumit.garg@linaro.org, alexandre.belloni@bootlin.com,
	yangyingliang@huawei.com, linux-kernel@vger.kernel.org,
	jason@lakedaemon.net, hpa@zytor.com, mingo@kernel.org,
	tglx@linutronix.de, marc.zyngier@arm.com
Subject: [tip:irq/urgent] irqchip/gic-v3-its: Don't bind LPI to unavailable NUMA node
Date: Fri, 22 Jun 2018 05:26:32 -0700	[thread overview]
Message-ID: <tip-c1797b11a09c8323c92b074fd48b89a936c991d0@git.kernel.org> (raw)
In-Reply-To: <20180622095254.5906-5-marc.zyngier@arm.com>

Commit-ID:  c1797b11a09c8323c92b074fd48b89a936c991d0
Gitweb:     https://git.kernel.org/tip/c1797b11a09c8323c92b074fd48b89a936c991d0
Author:     Yang Yingliang <yangyingliang@huawei.com>
AuthorDate: Fri, 22 Jun 2018 10:52:51 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 22 Jun 2018 14:22:01 +0200

irqchip/gic-v3-its: Don't bind LPI to unavailable NUMA node

On a NUMA system, if an ITS is local to an offline node, the ITS driver may
pick an offline CPU to bind the LPI.  In this case, pick an online CPU (and
the first one will do).

But on some systems, binding an LPI to non-local node CPU may cause
deadlock (see Cavium erratum 23144).  In this case, just fail the activate
and return an error code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Sumit Garg <sumit.garg@linaro.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20180622095254.5906-5-marc.zyngier@arm.com

---
 drivers/irqchip/irq-gic-v3-its.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 5377d7e2afba..cae53937feeb 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -2310,7 +2310,14 @@ static int its_irq_domain_activate(struct irq_domain *domain,
 		cpu_mask = cpumask_of_node(its_dev->its->numa_node);
 
 	/* Bind the LPI to the first possible CPU */
-	cpu = cpumask_first(cpu_mask);
+	cpu = cpumask_first_and(cpu_mask, cpu_online_mask);
+	if (cpu >= nr_cpu_ids) {
+		if (its_dev->its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144)
+			return -EINVAL;
+
+		cpu = cpumask_first(cpu_online_mask);
+	}
+
 	its_dev->event_map.col_map[event] = cpu;
 	irq_data_update_effective_affinity(d, cpumask_of(cpu));
 

  reply	other threads:[~2018-06-22 12:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22  9:52 [PATCH v2 0/7] irqchip: v4.18-rc1 fixes Marc Zyngier
2018-06-22  9:52 ` [PATCH v2 1/7] genirq/debugfs: Add missing IRQCHIP_SUPPORTS_LEVEL_MSI debug Marc Zyngier
2018-06-22 12:25   ` [tip:irq/urgent] " tip-bot for Marc Zyngier
2018-06-22  9:52 ` [PATCH v2 2/7] irqchip/ls-scfg-msi: Fix MSI affinity handling Marc Zyngier
2018-06-22 11:02   ` Alexandre Belloni
2018-06-22 12:25   ` [tip:irq/urgent] " tip-bot for Marc Zyngier
2018-06-22  9:52 ` [PATCH v2 3/7] irqchip/gic-v2m: Fix SPI release on error path Marc Zyngier
2018-06-22 12:26   ` [tip:irq/urgent] " tip-bot for Marc Zyngier
2018-06-22  9:52 ` [PATCH v2 4/7] irqchip/gic-v3-its: Don't bind LPI to unavailable NUMA node Marc Zyngier
2018-06-22 12:26   ` tip-bot for Yang Yingliang [this message]
2018-06-22  9:52 ` [PATCH v2 5/7] irqchip/gic-v3-its: Only emit SYNC if targetting a valid collection Marc Zyngier
2018-06-22 12:27   ` [tip:irq/urgent] " tip-bot for Marc Zyngier
2018-06-22  9:52 ` [PATCH v2 6/7] irqchip/gic-v3-its: Only emit VSYNC " Marc Zyngier
2018-06-22 12:27   ` [tip:irq/urgent] " tip-bot for Marc Zyngier
2018-06-22  9:52 ` [PATCH v2 7/7] irqchip/gic-v3-its: Fix reprogramming of redistributors on CPU hotplug Marc Zyngier
2018-06-22 12:28   ` [tip:irq/urgent] " tip-bot for Marc Zyngier

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=tip-c1797b11a09c8323c92b074fd48b89a936c991d0@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=hpa@zytor.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mingo@kernel.org \
    --cc=sumit.garg@linaro.org \
    --cc=tglx@linutronix.de \
    --cc=yangyingliang@huawei.com \
    /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).