All of lore.kernel.org
 help / color / mirror / Atom feed
* Dovetail fixes to v5.3
@ 2021-07-22  9:48 Philippe Gerum
  2021-07-22  9:48 ` [PATCH 1/6] genirq: irq_pipeline: restore oob stall bit on chained IRQs Philippe Gerum
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Philippe Gerum @ 2021-07-22  9:48 UTC (permalink / raw)
  To: xenomai

This series goes on top of v5.13-dovetail-rebase. Backport to
v5.10.y-dovetail-rebase is on its way.



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

* [PATCH 1/6] genirq: irq_pipeline: restore oob stall bit on chained IRQs
  2021-07-22  9:48 Dovetail fixes to v5.3 Philippe Gerum
@ 2021-07-22  9:48 ` Philippe Gerum
  2021-07-22  9:48 ` [PATCH 2/6] gpio: omap: irq_pipeline: enable out-of-band interrupt handling Philippe Gerum
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Philippe Gerum @ 2021-07-22  9:48 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

handle_oob_irq() is called recursively when handling chained
interrupts, at which point the oob stage is already stalled:

generic_handle_irq /* oob stage unstalled */
   -> <parent IRQ flow handler>
          -> handle_oob_irq  /* oob stage stalled */
	        -> <parent IRQ demultiplexer>
		       -> generic_handle_irq
			      -> <chained IRQ flow handler>
			             -> handle_oob_irq
				     /* oob stage must stay stalled */
				 ...
		          ...
	           ...

		  /*
		   * oob stage is unstalled upon leaving the outer call
		   * to handle_oob_irq
		   */

Make sure to restore the oob stall bit to its original value on entry
to this routine before leaving it, instead of clearing such bit
unconditionally.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/irq/pipeline.c | 38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/kernel/irq/pipeline.c b/kernel/irq/pipeline.c
index a220d9467a56ce2..090fcc8bbb6a449 100644
--- a/kernel/irq/pipeline.c
+++ b/kernel/irq/pipeline.c
@@ -931,7 +931,7 @@ static inline bool is_active_edge_event(struct irq_desc *desc)
 bool handle_oob_irq(struct irq_desc *desc) /* hardirqs off */
 {
 	struct irq_stage_data *oobd = this_oob_staged();
-	unsigned int irq = irq_desc_get_irq(desc);
+	unsigned int irq = irq_desc_get_irq(desc), s;
 
 	/*
 	 * Flow handlers of chained interrupts have no business
@@ -959,19 +959,8 @@ bool handle_oob_irq(struct irq_desc *desc) /* hardirqs off */
 
 	if (WARN_ON_ONCE(irq_pipeline_debug() && running_inband()))
 		return false;
-	/*
-	 * Running with the oob stage stalled implies hardirqs off, so
-	 * if the oob stage is stalled on pipeline entry, something is
-	 * badly broken in our interrupt state. Pretend the event has
-	 * been handled, which may end up with the device hammering us
-	 * with more interrupts, but there is no safe option at this
-	 * point.
-	 */
-	if (WARN_ON_ONCE(irq_pipeline_debug() &&
-			on_pipeline_entry() && test_oob_stall()))
-		return true;
 
-	stall_oob();
+	s = test_and_stall_oob();
 
 	if (unlikely(desc->istate & IRQS_EDGE)) {
 		do {
@@ -985,7 +974,13 @@ bool handle_oob_irq(struct irq_desc *desc) /* hardirqs off */
 		do_oob_irq(desc);
 	}
 
-	unstall_oob();
+	/*
+	 * Cascaded interrupts enter handle_oob_irq() with the
+	 * out-of-band stage stalled during the parent
+	 * invocation. Make sure to restore accordingly.
+	 */
+	if (likely(!s))
+		unstall_oob();
 
 	/*
 	 * CPU migration and/or stage switching over the handler are
@@ -1060,7 +1055,7 @@ void restore_stage_on_irq(struct irq_stage_data *prevd)
  *	@regs:	Register file coming from the low-level handling code
  *
  *	Inject an IRQ into the pipeline from a CPU interrupt or trap
- *	context.  A flow handler runs for this IRQ.
+ *	context.  A flow handler runs next for this IRQ.
  *
  *      Hard irqs must be off on entry.
  */
@@ -1081,6 +1076,19 @@ int generic_pipeline_irq(unsigned int irq, struct pt_regs *regs)
 			pr_err("IRQ pipeline: interrupts enabled on entry (IRQ%u)\n",
 			       irq);
 		}
+		/*
+		 * Running with the oob stage stalled implies hardirqs
+		 * off.  For this reason, if the oob stage is stalled
+		 * on pipeline entry but we still receive an interrupt
+		 * from the hardware, something is badly broken in our
+		 * interrupt state. Try fixing up, but without great
+		 * hopes.
+		 */
+		if (on_pipeline_entry() && test_oob_stall()) {
+			pr_err("IRQ pipeline: out-of-band stage stalled on IRQ entry\n");
+			unstall_oob();
+		}
+
 		if (unlikely(desc == NULL)) {
 			pr_err("IRQ pipeline: received unhandled IRQ%u\n",
 			       irq);
-- 
2.31.1



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

* [PATCH 2/6] gpio: omap: irq_pipeline: enable out-of-band interrupt handling
  2021-07-22  9:48 Dovetail fixes to v5.3 Philippe Gerum
  2021-07-22  9:48 ` [PATCH 1/6] genirq: irq_pipeline: restore oob stall bit on chained IRQs Philippe Gerum
@ 2021-07-22  9:48 ` Philippe Gerum
  2021-07-22  9:48 ` [PATCH 3/6] drm/msm/mdp5: " Philippe Gerum
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Philippe Gerum @ 2021-07-22  9:48 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

We must decode the chained interrupts on the out-of-band stage to
enable end-to-end out-of-band delivery. Set IRQF_OOB for the parent
handler.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 drivers/gpio/gpio-omap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 8c02307ab2d0aa7..9e0eb9a7bfa671b 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1055,7 +1055,7 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
 
 	ret = devm_request_irq(bank->chip.parent, bank->irq,
 			       omap_gpio_irq_handler,
-			       0, dev_name(bank->chip.parent), bank);
+			       IRQF_OOB, dev_name(bank->chip.parent), bank);
 	if (ret)
 		gpiochip_remove(&bank->chip);
 
-- 
2.31.1



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

* [PATCH 3/6] drm/msm/mdp5: irq_pipeline: enable out-of-band interrupt handling
  2021-07-22  9:48 Dovetail fixes to v5.3 Philippe Gerum
  2021-07-22  9:48 ` [PATCH 1/6] genirq: irq_pipeline: restore oob stall bit on chained IRQs Philippe Gerum
  2021-07-22  9:48 ` [PATCH 2/6] gpio: omap: irq_pipeline: enable out-of-band interrupt handling Philippe Gerum
@ 2021-07-22  9:48 ` Philippe Gerum
  2021-07-22  9:48 ` [PATCH 4/6] pinctrl: samsung: " Philippe Gerum
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Philippe Gerum @ 2021-07-22  9:48 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

We must decode the chained interrupts on the out-of-band stage to
enable end-to-end out-of-band delivery. Set IRQF_OOB for the parent
handler.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c
index 8e0f2be155d8625..781d701dfc75457 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c
@@ -255,7 +255,7 @@ int mdp5_mdss_init(struct drm_device *dev)
 	}
 
 	ret = devm_request_irq(dev->dev, platform_get_irq(pdev, 0),
-			       mdss_irq, 0, "mdss_isr", mdp5_mdss);
+			       mdss_irq, IRQF_OOB, "mdss_isr", mdp5_mdss);
 	if (ret) {
 		DRM_DEV_ERROR(dev->dev, "failed to init irq: %d\n", ret);
 		goto fail_irq;
-- 
2.31.1



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

* [PATCH 4/6] pinctrl: samsung: irq_pipeline: enable out-of-band interrupt handling
  2021-07-22  9:48 Dovetail fixes to v5.3 Philippe Gerum
                   ` (2 preceding siblings ...)
  2021-07-22  9:48 ` [PATCH 3/6] drm/msm/mdp5: " Philippe Gerum
@ 2021-07-22  9:48 ` Philippe Gerum
  2021-07-22  9:48 ` [PATCH 5/6] genirq: irq_pipeline: export oob status to /proc/interrupts Philippe Gerum
  2021-07-22  9:48 ` [PATCH 6/6] clocksource/exynos_mct: irq_pipeline: enable out-of-band clock events Philippe Gerum
  5 siblings, 0 replies; 9+ messages in thread
From: Philippe Gerum @ 2021-07-22  9:48 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

We must decode the chained interrupts on the out-of-band stage to
enable end-to-end out-of-band delivery. Set IRQF_OOB for the parent
handler.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 drivers/pinctrl/samsung/pinctrl-exynos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c
index e1c86adb8f9421e..7da7f80e654380a 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos.c
@@ -288,7 +288,7 @@ __init int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
 	}
 
 	ret = devm_request_irq(dev, d->irq, exynos_eint_gpio_irq,
-					0, dev_name(dev), d);
+					IRQF_OOB, dev_name(dev), d);
 	if (ret) {
 		dev_err(dev, "irq request failed\n");
 		return -ENXIO;
-- 
2.31.1



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

* [PATCH 5/6] genirq: irq_pipeline: export oob status to /proc/interrupts
  2021-07-22  9:48 Dovetail fixes to v5.3 Philippe Gerum
                   ` (3 preceding siblings ...)
  2021-07-22  9:48 ` [PATCH 4/6] pinctrl: samsung: " Philippe Gerum
@ 2021-07-22  9:48 ` Philippe Gerum
  2021-07-22  9:55   ` Jan Kiszka
  2021-07-22  9:48 ` [PATCH 6/6] clocksource/exynos_mct: irq_pipeline: enable out-of-band clock events Philippe Gerum
  5 siblings, 1 reply; 9+ messages in thread
From: Philippe Gerum @ 2021-07-22  9:48 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/irq/proc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 7c5cd42df3b93e7..1428d83d7da8658 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -518,6 +518,9 @@ int show_interrupts(struct seq_file *p, void *v)
 		seq_printf(p, " %*s", prec, "");
 #ifdef CONFIG_GENERIC_IRQ_SHOW_LEVEL
 	seq_printf(p, " %-8s", irqd_is_level_type(&desc->irq_data) ? "Level" : "Edge");
+#endif
+#ifdef CONFIG_IRQ_PIPELINE
+	seq_printf(p, " %-3s", irq_settings_is_oob(desc) ? "oob" : "");
 #endif
 	if (desc->name)
 		seq_printf(p, "-%-8s", desc->name);
-- 
2.31.1



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

* [PATCH 6/6] clocksource/exynos_mct: irq_pipeline: enable out-of-band clock events
  2021-07-22  9:48 Dovetail fixes to v5.3 Philippe Gerum
                   ` (4 preceding siblings ...)
  2021-07-22  9:48 ` [PATCH 5/6] genirq: irq_pipeline: export oob status to /proc/interrupts Philippe Gerum
@ 2021-07-22  9:48 ` Philippe Gerum
  5 siblings, 0 replies; 9+ messages in thread
From: Philippe Gerum @ 2021-07-22  9:48 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

Ensure end-of-end out-of-band event delivery by receiving the clock
interrupts directly on the out-of-band stage.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 drivers/clocksource/exynos_mct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index a60cecf62c1cd6c..8d8ad16c13c3712 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -340,7 +340,7 @@ static int exynos4_clockevent_init(void)
 	clockevents_config_and_register(&mct_comp_device, clk_rate,
 					0xf, 0xffffffff);
 	if (request_irq(mct_irqs[MCT_G0_IRQ], exynos4_mct_comp_isr,
-			IRQF_TIMER | IRQF_IRQPOLL, "mct_comp_irq",
+			IRQF_TIMER | IRQF_IRQPOLL | IRQF_OOB, "mct_comp_irq",
 			&mct_comp_device))
 		pr_err("%s: request_irq() failed\n", "mct_comp_irq");
 
-- 
2.31.1



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

* Re: [PATCH 5/6] genirq: irq_pipeline: export oob status to /proc/interrupts
  2021-07-22  9:48 ` [PATCH 5/6] genirq: irq_pipeline: export oob status to /proc/interrupts Philippe Gerum
@ 2021-07-22  9:55   ` Jan Kiszka
  2021-07-22 10:33     ` Philippe Gerum
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2021-07-22  9:55 UTC (permalink / raw)
  To: Philippe Gerum, xenomai

On 22.07.21 11:48, Philippe Gerum via Xenomai wrote:
> From: Philippe Gerum <rpm@xenomai.org>
> 
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>  kernel/irq/proc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
> index 7c5cd42df3b93e7..1428d83d7da8658 100644
> --- a/kernel/irq/proc.c
> +++ b/kernel/irq/proc.c
> @@ -518,6 +518,9 @@ int show_interrupts(struct seq_file *p, void *v)
>  		seq_printf(p, " %*s", prec, "");
>  #ifdef CONFIG_GENERIC_IRQ_SHOW_LEVEL
>  	seq_printf(p, " %-8s", irqd_is_level_type(&desc->irq_data) ? "Level" : "Edge");
> +#endif
> +#ifdef CONFIG_IRQ_PIPELINE
> +	seq_printf(p, " %-3s", irq_settings_is_oob(desc) ? "oob" : "");
>  #endif
>  	if (desc->name)
>  		seq_printf(p, "-%-8s", desc->name);
> 

Small but valuable - already received a question in this direction.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


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

* Re: [PATCH 5/6] genirq: irq_pipeline: export oob status to /proc/interrupts
  2021-07-22  9:55   ` Jan Kiszka
@ 2021-07-22 10:33     ` Philippe Gerum
  0 siblings, 0 replies; 9+ messages in thread
From: Philippe Gerum @ 2021-07-22 10:33 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai


Jan Kiszka <jan.kiszka@siemens.com> writes:

> On 22.07.21 11:48, Philippe Gerum via Xenomai wrote:
>> From: Philippe Gerum <rpm@xenomai.org>
>> 
>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>> ---
>>  kernel/irq/proc.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
>> index 7c5cd42df3b93e7..1428d83d7da8658 100644
>> --- a/kernel/irq/proc.c
>> +++ b/kernel/irq/proc.c
>> @@ -518,6 +518,9 @@ int show_interrupts(struct seq_file *p, void *v)
>>  		seq_printf(p, " %*s", prec, "");
>>  #ifdef CONFIG_GENERIC_IRQ_SHOW_LEVEL
>>  	seq_printf(p, " %-8s", irqd_is_level_type(&desc->irq_data) ? "Level" : "Edge");
>> +#endif
>> +#ifdef CONFIG_IRQ_PIPELINE
>> +	seq_printf(p, " %-3s", irq_settings_is_oob(desc) ? "oob" : "");
>>  #endif
>>  	if (desc->name)
>>  		seq_printf(p, "-%-8s", desc->name);
>> 
>
> Small but valuable - already received a question in this direction.
>

This was deeply buried in my todo list until Byron fortunately mentioned
it.

I'm not 100% happy with the format since this new field might affect
some parsers fed by /proc/interrupts, but I could not find any better
way which would be generic enough, not depending on the specific
printout which may be done by the irqchip driver.

-- 
Philippe.


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

end of thread, other threads:[~2021-07-22 10:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22  9:48 Dovetail fixes to v5.3 Philippe Gerum
2021-07-22  9:48 ` [PATCH 1/6] genirq: irq_pipeline: restore oob stall bit on chained IRQs Philippe Gerum
2021-07-22  9:48 ` [PATCH 2/6] gpio: omap: irq_pipeline: enable out-of-band interrupt handling Philippe Gerum
2021-07-22  9:48 ` [PATCH 3/6] drm/msm/mdp5: " Philippe Gerum
2021-07-22  9:48 ` [PATCH 4/6] pinctrl: samsung: " Philippe Gerum
2021-07-22  9:48 ` [PATCH 5/6] genirq: irq_pipeline: export oob status to /proc/interrupts Philippe Gerum
2021-07-22  9:55   ` Jan Kiszka
2021-07-22 10:33     ` Philippe Gerum
2021-07-22  9:48 ` [PATCH 6/6] clocksource/exynos_mct: irq_pipeline: enable out-of-band clock events Philippe Gerum

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.