From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH 2/3] powerpx/xive: Fix irq target selection returning out of bounds cpu#
Date: Mon, 10 Apr 2017 16:23:20 +1000 [thread overview]
Message-ID: <20170410062321.32521-2-benh@kernel.crashing.org> (raw)
In-Reply-To: <20170410062321.32521-1-benh@kernel.crashing.org>
xive_pick_irq_target() first tries to construct a mask that is
the intersection of the requested affinity, online CPUs, and
the group of CPUs that are on the same chip as the interrupt
source.
If that resulting mask is empty, we were incorrectly returning
nr_cpu_ids as a target.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/sysdev/xive/common.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index dbbe446..abda9b2 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -492,7 +492,7 @@ static int xive_pick_irq_target(struct irq_data *d,
/*
* If we have chip IDs, first we try to build a mask of
- * CPUs matching ther CPU and find a target in there
+ * CPUs matching the CPU and find a target in there
*/
if (xd->src_chip != XIVE_INVALID_CHIP_ID &&
zalloc_cpumask_var(&mask, GFP_ATOMIC)) {
@@ -503,7 +503,9 @@ static int xive_pick_irq_target(struct irq_data *d,
cpumask_set_cpu(cpu, mask);
}
/* Try to find a target */
- if (!cpumask_empty(mask))
+ if (cpumask_empty(mask))
+ cpu = -1;
+ else
cpu = xive_find_target_in_mask(mask, fuzz++);
free_cpumask_var(mask);
if (cpu >= 0)
--
2.9.3
next prev parent reply other threads:[~2017-04-10 6:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-10 6:23 [PATCH 1/3] powerpc/xive: Don't call cpu_online() on an invalid CPU number Benjamin Herrenschmidt
2017-04-10 6:23 ` Benjamin Herrenschmidt [this message]
2017-04-10 6:23 ` [PATCH 3/3] powerpc/xive: Extra sanity checks on cpu numbers Benjamin Herrenschmidt
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=20170410062321.32521-2-benh@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).