public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Decotigny <decot+git@google.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Marc Zyngier <maz@kernel.org>,
	linux-kernel@vger.kernel.org
Cc: David Decotigny <ddecotig@google.com>
Subject: [PATCH v1 1/1] irqchip/gic-v3-its: fixup IRQ affinities to account for online CPUs
Date: Fri,  4 Mar 2022 11:52:38 -0800	[thread overview]
Message-ID: <20220304195238.1141725-1-decot+git@google.com> (raw)

From: David Decotigny <ddecotig@google.com>

In some cases (eg. when booting with maxcpus=X), it is possible that
the preset IRQ affinity masks don't intersect with the set of online
CPUs. This patch extends the fallback strategy implemented when
IRQD_AFFINITY_MANAGED is not set to all cases. This is logged the
first time that happens.

Fixes: c5d6082d35e0 ("irqchip/gic-v3-its: Balance initial LPI affinity across CPUs")

---
 drivers/irqchip/irq-gic-v3-its.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index cd772973114a..de862fd9ad73 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1618,11 +1618,6 @@ static int its_select_cpu(struct irq_data *d,
 		/* Try the intersection of the affinity and online masks */
 		cpumask_and(tmpmask, aff_mask, cpu_online_mask);
 
-		/* If that doesn't fly, the online mask is the last resort */
-		if (cpumask_empty(tmpmask))
-			cpumask_copy(tmpmask, cpu_online_mask);
-
-		cpu = cpumask_pick_least_loaded(d, tmpmask);
 	} else {
 		cpumask_and(tmpmask, irq_data_get_affinity_mask(d), cpu_online_mask);
 
@@ -1630,9 +1625,13 @@ static int its_select_cpu(struct irq_data *d,
 		if ((its_dev->its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) &&
 		    node != NUMA_NO_NODE)
 			cpumask_and(tmpmask, tmpmask, cpumask_of_node(node));
-
-		cpu = cpumask_pick_least_loaded(d, tmpmask);
 	}
+
+	/* If that doesn't fly, the online mask is the last resort */
+	if (WARN_ON_ONCE(cpumask_empty(tmpmask)))
+		cpumask_copy(tmpmask, cpu_online_mask);
+
+	cpu = cpumask_pick_least_loaded(d, tmpmask);
 out:
 	free_cpumask_var(tmpmask);
 
-- 
2.35.1.616.g0bdcbb4464-goog


             reply	other threads:[~2022-03-04 20:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 19:52 David Decotigny [this message]
2022-03-05 11:24 ` [PATCH v1 1/1] irqchip/gic-v3-its: fixup IRQ affinities to account for online CPUs Marc Zyngier
2022-03-08  1:36   ` David Decotigny

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=20220304195238.1141725-1-decot+git@google.com \
    --to=decot+git@google.com \
    --cc=ddecotig@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=tglx@linutronix.de \
    /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