All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] dovetail: intr: Clear affinity_hint before freeing the IRQ
@ 2021-04-28 13:51 Jan Kiszka
  2021-04-28 14:58 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2021-04-28 13:51 UTC (permalink / raw)
  To: Xenomai

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

We are setting it on xnintr_attach(), and Linux seems to dislike when it
is non-NULL on free_irq().

__free_irq():
...
        /* make sure affinity_hint is cleaned up */
        if (WARN_ON_ONCE(desc->affinity_hint))
                desc->affinity_hint = NULL;

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Only seen this now, with a plain rtdm_irq_request/free pattern, and I'm 
still wondering why this was missed so far - therefore RFC.

 kernel/cobalt/dovetail/intr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/cobalt/dovetail/intr.c b/kernel/cobalt/dovetail/intr.c
index d1a1c14a91..60d5bf882c 100644
--- a/kernel/cobalt/dovetail/intr.c
+++ b/kernel/cobalt/dovetail/intr.c
@@ -103,6 +103,7 @@ EXPORT_SYMBOL_GPL(xnintr_attach);
 void xnintr_detach(struct xnintr *intr)
 {
 	secondary_mode_only();
+	irq_set_affinity_hint(intr->irq, NULL);
 	free_irq(intr->irq, intr);
 }
 EXPORT_SYMBOL_GPL(xnintr_detach);
-- 
2.26.2


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

* Re: [RFC][PATCH] dovetail: intr: Clear affinity_hint before freeing the IRQ
  2021-04-28 13:51 [RFC][PATCH] dovetail: intr: Clear affinity_hint before freeing the IRQ Jan Kiszka
@ 2021-04-28 14:58 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2021-04-28 14:58 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai


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

> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> We are setting it on xnintr_attach(), and Linux seems to dislike when it
> is non-NULL on free_irq().
>
> __free_irq():
> ...
>         /* make sure affinity_hint is cleaned up */
>         if (WARN_ON_ONCE(desc->affinity_hint))
>                 desc->affinity_hint = NULL;
>

Ack, definitely required -- since 2.6.35-rc1...

> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
> Only seen this now, with a plain rtdm_irq_request/free pattern, and I'm 
> still wondering why this was missed so far - therefore RFC.
>

This would have required an RTDM driver compiled as a module over
Dovetail, calling rtdm_irq_free() upon unload. We may not be there yet
in terms of test coverage.

The I-pipe has no issue because IRQs there are not managed by the
regular genirq framework via the common IRQ API. Since Dovetail-managed
IRQs are regular IRQs known from genirq, free_irq() is now applicable.

>  kernel/cobalt/dovetail/intr.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/cobalt/dovetail/intr.c b/kernel/cobalt/dovetail/intr.c
> index d1a1c14a91..60d5bf882c 100644
> --- a/kernel/cobalt/dovetail/intr.c
> +++ b/kernel/cobalt/dovetail/intr.c
> @@ -103,6 +103,7 @@ EXPORT_SYMBOL_GPL(xnintr_attach);
>  void xnintr_detach(struct xnintr *intr)
>  {
>  	secondary_mode_only();
> +	irq_set_affinity_hint(intr->irq, NULL);
>  	free_irq(intr->irq, intr);
>  }
>  EXPORT_SYMBOL_GPL(xnintr_detach);



-- 
Philippe.


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

end of thread, other threads:[~2021-04-28 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 13:51 [RFC][PATCH] dovetail: intr: Clear affinity_hint before freeing the IRQ Jan Kiszka
2021-04-28 14:58 ` 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.