All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip/gic-v3-its: Select housekeeping CPUs preferentially for managed IRQs
@ 2022-01-24  7:34 Xiongfeng Wang
  2022-01-24 11:24 ` Marc Zyngier
  0 siblings, 1 reply; 4+ messages in thread
From: Xiongfeng Wang @ 2022-01-24  7:34 UTC (permalink / raw)
  To: tglx, maz; +Cc: linux-kernel, wangxiongfeng2, guohanjun

When using kernel parameter 'isolcpus=managed_irq,xxxx' to bind the
managed IRQs to housekeeping CPUs, the effective_affinity sometimes
still contains the non-housekeeping CPUs.

irq_do_set_affinity() passes the housekeeping cpumask to
chip->irq_set_affinity(), but ITS driver select CPU according to
irq_common_data->affinity. While 'irq_common_data->affinity' is updated
after chip->irq_set_affinity() is called in irq_do_set_affinity(). Also
'irq_common_data->affinity' may contains non-housekeeping CPUs. I found
the below link explaining the reason.
  https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2267032.html

To modify CPU selecting logic to prefer housekeeping CPUs, select CPU
from the input cpumask parameter first. If none of it is online, then
select CPU from 'irq_common_data->affinity'.

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 drivers/irqchip/irq-gic-v3-its.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index d25b7a864bbb..17c15d3b2784 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1624,7 +1624,10 @@ static int its_select_cpu(struct irq_data *d,
 
 		cpu = cpumask_pick_least_loaded(d, tmpmask);
 	} else {
-		cpumask_and(tmpmask, irq_data_get_affinity_mask(d), cpu_online_mask);
+		cpumask_and(tmpmask, aff_mask, cpu_online_mask);
+		if (cpumask_empty(tmpmask))
+			cpumask_and(tmpmask, irq_data_get_affinity_mask(d),
+				    cpu_online_mask);
 
 		/* If we cannot cross sockets, limit the search to that node */
 		if ((its_dev->its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) &&
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-25 13:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24  7:34 [PATCH] irqchip/gic-v3-its: Select housekeeping CPUs preferentially for managed IRQs Xiongfeng Wang
2022-01-24 11:24 ` Marc Zyngier
2022-01-25 12:49   ` Xiongfeng Wang
2022-01-25 13:31     ` Marc Zyngier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.