All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] irqchip/gic-v3: wait irq done to set affinity
@ 2023-01-06  8:21 ` Yipeng Zou
  0 siblings, 0 replies; 8+ messages in thread
From: Yipeng Zou @ 2023-01-06  8:21 UTC (permalink / raw)
  To: tglx, maz, linux-kernel, linux-arm-kernel
  Cc: hewenliang4, zouyipeng, chris.zjh, liaochang1

Recently we have some problem about gic set affinity in our test.

This patch just aim to make some discuss about this problem.

For now, the implementation of gic set affinity going to take effects
immediately, and without check if any irq are being processed.

So, This leads to some problem, think about this scenario:

1. First, we have an irq was generated by an device.

2. In the processing of this irq(after handle event, before clear
IRQD_IRQ_INPROGRESS flag), we modify the route and the gic takes effect
immediately,at the same time the new one was generated again.

3. The new irq will be processing in other cpu which different form the
old one.

4. The new irq going to be discarded because of the flag IRQD_IRQ_INPROGRESS
has been set.

I notice that if we set IRQF_ONESHOT when register the irq, this problem
will gone.

But I'm also thinking about change the gic_set_affinity function, to wait
current irq done on all cpus before gic_write_irouter.
I'm not sure if that's appropriate.

Is the best workaround to use IRQF_ONESHOT to prevent reentrancy?

Please let me know, if have any other suggestions on this issue.

Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
---
 drivers/irqchip/irq-gic-v3.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 997104d4338e..e9b9f15f07f8 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -1348,6 +1348,8 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
 	reg = gic_dist_base(d) + offset + (index * 8);
 	val = gic_mpidr_to_affinity(cpu_logical_map(cpu));
 
+	// wait irq done on all cpus
+
 	gic_write_irouter(val, reg);
 
 	/*
-- 
2.17.1


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

end of thread, other threads:[~2023-01-17  9:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06  8:21 [RFC PATCH] irqchip/gic-v3: wait irq done to set affinity Yipeng Zou
2023-01-06  8:21 ` Yipeng Zou
2023-01-06 11:55 ` Marc Zyngier
2023-01-06 11:55   ` Marc Zyngier
2023-01-09 12:26   ` Yipeng Zou
2023-01-09 12:26     ` Yipeng Zou
2023-01-17  9:38     ` Thomas Gleixner
2023-01-17  9:38       ` Thomas Gleixner

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.