Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] xen/riscv: per-CPU devid setup for Xen event channel IRQ on IMSIC
@ 2026-04-24 16:39 Baptiste Le Duc
  2026-04-24 16:55 ` Anup Patel
  0 siblings, 1 reply; 11+ messages in thread
From: Baptiste Le Duc @ 2026-04-24 16:39 UTC (permalink / raw)
  To: linux-riscv
  Cc: anup, tglx, pjw, palmer, aou, alex, linux-kernel,
	oleksii.kurochko

Hi,

While adding Xen/RISC-V support, the guest event channel interrupt is
allocated via irq_of_parse_and_map() against the IMSIC domain and, if
we refer to the ARM implementation, it must
be enabled/disabled per vCPU through enable_percpu_irq() /
disable_percpu_irq() in the CPU hotplug callbacks.

With IMSIC using handle_edge_irq (the upstream default),
enable_percpu_irq() never clears IRQD_IRQ_DISABLED. That flag is set at
irq_desc allocation time (irqdesc.c) and is only cleared by
irq_startup(), which is called from __setup_irq() only when
irq_settings_can_autoenable() returns true.

irq_set_percpu_devid() sets IRQ_NOAUTOEN (via irq_set_percpu_devid_flags),
so irq_startup() is intentionally skipped for percpu-devid IRQs.
enable_percpu_irq() calls irq_percpu_enable() which does irq_enable/unmask
on the chip but never touches IRQD_IRQ_DISABLED.

Result: handle_edge_irq() hits irq_can_handle_actions() → checks
irqd_irq_disabled() → returns false → IRQ silently dropped.

This was confirmed by logs:

   XEN_TRACE irq=12 percpu_enable cpu=0 IRQD_DISABLED=1
   XEN_TRACE irq=12 handle_edge DROP IRQD_DISABLED=1 action=...

What we tried
-------------
- request_irq() correctly works with upstream IMSIC which uses 
handle_edge_irq with no
irq_set_percpu_devid() but it means we only can have one vCPU which will 
always handle the irq,
and we don't want that.

- Adding irq_set_percpu_devid() + switching to handle_percpu_devid_irq in
imsic_irq_domain_alloc() fixes the Xen case but breaks all other IMSIC
users (PCI MSI, platform devices) that call request_irq(), since
request_threaded_irq() rejects IRQs marked _IRQ_PER_CPU_DEVID:

   WARNING: CPU: 0 PID: 1 at kernel/irq/manage.c:2101
   request_threaded_irq+0x80/0x12c

Therefore, do you have any recommendations on how should I handle this 
case ?

Thanks,
Baptiste


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [RFC] xen/riscv: per-CPU devid setup for Xen event channel IRQ on IMSIC
@ 2026-04-24 16:34 Baptiste Le Duc
  0 siblings, 0 replies; 11+ messages in thread
From: Baptiste Le Duc @ 2026-04-24 16:34 UTC (permalink / raw)
  To: linux-riscv
  Cc: anup, tglx, pjw, palmer, aou, alex, linux-kernel,
	oleksii.kurochko


[-- Attachment #1.1: Type: text/plain, Size: 2010 bytes --]

Hi,

While adding Xen/RISC-V support, the guest event channel interrupt is
allocated via irq_of_parse_and_map() against the IMSIC domain and, if
we refer to the ARM implementation, it must
be enabled/disabled per vCPU through enable_percpu_irq() /
disable_percpu_irq() in the CPU hotplug callbacks.

With IMSIC using handle_edge_irq (the upstream default),
enable_percpu_irq() never clears IRQD_IRQ_DISABLED. That flag is set at
irq_desc allocation time (irqdesc.c) and is only cleared by
irq_startup(), which is called from __setup_irq() only when
irq_settings_can_autoenable() returns true.

irq_set_percpu_devid() sets IRQ_NOAUTOEN (via irq_set_percpu_devid_flags),
so irq_startup() is intentionally skipped for percpu-devid IRQs.
enable_percpu_irq() calls irq_percpu_enable() which does irq_enable/unmask
on the chip but never touches IRQD_IRQ_DISABLED.

Result: handle_edge_irq() hits irq_can_handle_actions() → checks
irqd_irq_disabled() → returns false → IRQ silently dropped.

This was confirmed by logs:

   XEN_TRACE irq=12 percpu_enable cpu=0 IRQD_DISABLED=1
   XEN_TRACE irq=12 handle_edge DROP IRQD_DISABLED=1 action=...

What we tried
-------------
- request_irq() correctly works with upstream IMSIC which uses 
handle_edge_irq with no
irq_set_percpu_devid() but it means we only can have one vCPU which will 
always handle the irq,
and we don't want that.

- Adding irq_set_percpu_devid() + switching to handle_percpu_devid_irq in
imsic_irq_domain_alloc() fixes the Xen case but breaks all other IMSIC
users (PCI MSI, platform devices) that call request_irq(), since
request_threaded_irq() rejects IRQs marked _IRQ_PER_CPU_DEVID:

   WARNING: CPU: 0 PID: 1 at kernel/irq/manage.c:2101
   request_threaded_irq+0x80/0x12c

Therefore, do you have any recommendations on how should I handle this 
case ?

Thanks,
Baptiste



--
Baptiste Le Duc | Vates XCP-ng Intern

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [RFC] xen/riscv: per-CPU devid setup for Xen event channel IRQ on IMSIC
@ 2026-04-24 16:27 Baptiste Le Duc
  0 siblings, 0 replies; 11+ messages in thread
From: Baptiste Le Duc @ 2026-04-24 16:27 UTC (permalink / raw)
  To: linux-riscv
  Cc: anup, tglx, pjw, palmer, aou, alex, linux-kernel,
	oleksii.kurochko


[-- Attachment #1.1: Type: text/plain, Size: 2010 bytes --]

Hi,

While adding Xen/RISC-V support, the guest event channel interrupt is
allocated via irq_of_parse_and_map() against the IMSIC domain and, if
we refer to the ARM implementation, it must
be enabled/disabled per vCPU through enable_percpu_irq() /
disable_percpu_irq() in the CPU hotplug callbacks.

With IMSIC using handle_edge_irq (the upstream default),
enable_percpu_irq() never clears IRQD_IRQ_DISABLED. That flag is set at
irq_desc allocation time (irqdesc.c) and is only cleared by
irq_startup(), which is called from __setup_irq() only when
irq_settings_can_autoenable() returns true.

irq_set_percpu_devid() sets IRQ_NOAUTOEN (via irq_set_percpu_devid_flags),
so irq_startup() is intentionally skipped for percpu-devid IRQs.
enable_percpu_irq() calls irq_percpu_enable() which does irq_enable/unmask
on the chip but never touches IRQD_IRQ_DISABLED.

Result: handle_edge_irq() hits irq_can_handle_actions() → checks
irqd_irq_disabled() → returns false → IRQ silently dropped.

This was confirmed by logs:

   XEN_TRACE irq=12 percpu_enable cpu=0 IRQD_DISABLED=1
   XEN_TRACE irq=12 handle_edge DROP IRQD_DISABLED=1 action=...

What we tried
-------------
- request_irq() correctly works with upstream IMSIC which uses 
handle_edge_irq with no
irq_set_percpu_devid() but it means we only can have one vCPU which will 
always handle the irq,
and we don't want that.

- Adding irq_set_percpu_devid() + switching to handle_percpu_devid_irq in
imsic_irq_domain_alloc() fixes the Xen case but breaks all other IMSIC
users (PCI MSI, platform devices) that call request_irq(), since
request_threaded_irq() rejects IRQs marked _IRQ_PER_CPU_DEVID:

   WARNING: CPU: 0 PID: 1 at kernel/irq/manage.c:2101
   request_threaded_irq+0x80/0x12c

Therefore, do you have any recommendations on how should I handle this 
case ?

Thanks,
Baptiste



--
Baptiste Le Duc | Vates XCP-ng Intern

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [RFC] xen/riscv: per-CPU devid setup for Xen event channel IRQ on IMSIC
@ 2026-04-24 16:26 Baptiste Le Duc
  0 siblings, 0 replies; 11+ messages in thread
From: Baptiste Le Duc @ 2026-04-24 16:26 UTC (permalink / raw)
  To: linux-riscv
  Cc: anup, tglx, pjw, palmer, aou, alex, linux-kernel,
	oleksii.kurochko


[-- Attachment #1.1: Type: text/plain, Size: 2010 bytes --]

Hi,

While adding Xen/RISC-V support, the guest event channel interrupt is
allocated via irq_of_parse_and_map() against the IMSIC domain and, if
we refer to the ARM implementation, it must
be enabled/disabled per vCPU through enable_percpu_irq() /
disable_percpu_irq() in the CPU hotplug callbacks.

With IMSIC using handle_edge_irq (the upstream default),
enable_percpu_irq() never clears IRQD_IRQ_DISABLED. That flag is set at
irq_desc allocation time (irqdesc.c) and is only cleared by
irq_startup(), which is called from __setup_irq() only when
irq_settings_can_autoenable() returns true.

irq_set_percpu_devid() sets IRQ_NOAUTOEN (via irq_set_percpu_devid_flags),
so irq_startup() is intentionally skipped for percpu-devid IRQs.
enable_percpu_irq() calls irq_percpu_enable() which does irq_enable/unmask
on the chip but never touches IRQD_IRQ_DISABLED.

Result: handle_edge_irq() hits irq_can_handle_actions() → checks
irqd_irq_disabled() → returns false → IRQ silently dropped.

This was confirmed by logs:

   XEN_TRACE irq=12 percpu_enable cpu=0 IRQD_DISABLED=1
   XEN_TRACE irq=12 handle_edge DROP IRQD_DISABLED=1 action=...

What we tried
-------------
- request_irq() correctly works with upstream IMSIC which uses 
handle_edge_irq with no
irq_set_percpu_devid() but it means we only can have one vCPU which will 
always handle the irq,
and we don't want that.

- Adding irq_set_percpu_devid() + switching to handle_percpu_devid_irq in
imsic_irq_domain_alloc() fixes the Xen case but breaks all other IMSIC
users (PCI MSI, platform devices) that call request_irq(), since
request_threaded_irq() rejects IRQs marked _IRQ_PER_CPU_DEVID:

   WARNING: CPU: 0 PID: 1 at kernel/irq/manage.c:2101
   request_threaded_irq+0x80/0x12c

Therefore, do you have any recommendations on how should I handle this 
case ?

Thanks,
Baptiste



--
Baptiste Le Duc | Vates XCP-ng Intern

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [RFC] xen/riscv: per-CPU devid setup for Xen event channel IRQ on IMSIC
@ 2026-04-24 16:21 Baptiste Le Duc
  0 siblings, 0 replies; 11+ messages in thread
From: Baptiste Le Duc @ 2026-04-24 16:21 UTC (permalink / raw)
  To: linux-riscv
  Cc: anup, tglx, pjw, palmer, aou, alex, linux-kernel,
	oleksii.kurochko


[-- Attachment #1.1: Type: text/plain, Size: 2010 bytes --]

Hi,

While adding Xen/RISC-V support, the guest event channel interrupt is
allocated via irq_of_parse_and_map() against the IMSIC domain and, if
we refer to the ARM implementation, it must
be enabled/disabled per vCPU through enable_percpu_irq() /
disable_percpu_irq() in the CPU hotplug callbacks.

With IMSIC using handle_edge_irq (the upstream default),
enable_percpu_irq() never clears IRQD_IRQ_DISABLED. That flag is set at
irq_desc allocation time (irqdesc.c) and is only cleared by
irq_startup(), which is called from __setup_irq() only when
irq_settings_can_autoenable() returns true.

irq_set_percpu_devid() sets IRQ_NOAUTOEN (via irq_set_percpu_devid_flags),
so irq_startup() is intentionally skipped for percpu-devid IRQs.
enable_percpu_irq() calls irq_percpu_enable() which does irq_enable/unmask
on the chip but never touches IRQD_IRQ_DISABLED.

Result: handle_edge_irq() hits irq_can_handle_actions() → checks
irqd_irq_disabled() → returns false → IRQ silently dropped.

This was confirmed by logs:

   XEN_TRACE irq=12 percpu_enable cpu=0 IRQD_DISABLED=1
   XEN_TRACE irq=12 handle_edge DROP IRQD_DISABLED=1 action=...

What we tried
-------------
- request_irq() correctly works with upstream IMSIC which uses 
handle_edge_irq with no
irq_set_percpu_devid() but it means we only can have one vCPU which will 
always handle the irq,
and we don't want that.

- Adding irq_set_percpu_devid() + switching to handle_percpu_devid_irq in
imsic_irq_domain_alloc() fixes the Xen case but breaks all other IMSIC
users (PCI MSI, platform devices) that call request_irq(), since
request_threaded_irq() rejects IRQs marked _IRQ_PER_CPU_DEVID:

   WARNING: CPU: 0 PID: 1 at kernel/irq/manage.c:2101
   request_threaded_irq+0x80/0x12c

Therefore, do you have any recommendations on how should I handle this 
case ?

Thanks,
Baptiste



--
Baptiste Le Duc | Vates XCP-ng Intern

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [RFC] xen/riscv: per-CPU devid setup for Xen event channel IRQ on IMSIC
@ 2026-04-24 16:19 Baptiste Le Duc
  0 siblings, 0 replies; 11+ messages in thread
From: Baptiste Le Duc @ 2026-04-24 16:19 UTC (permalink / raw)
  To: linux-riscv
  Cc: anup, tglx, pjw, palmer, aou, alex, linux-kernel,
	oleksii.kurochko


[-- Attachment #1.1: Type: text/plain, Size: 2010 bytes --]

Hi,

While adding Xen/RISC-V support, the guest event channel interrupt is
allocated via irq_of_parse_and_map() against the IMSIC domain and, if
we refer to the ARM implementation, it must
be enabled/disabled per vCPU through enable_percpu_irq() /
disable_percpu_irq() in the CPU hotplug callbacks.

With IMSIC using handle_edge_irq (the upstream default),
enable_percpu_irq() never clears IRQD_IRQ_DISABLED. That flag is set at
irq_desc allocation time (irqdesc.c) and is only cleared by
irq_startup(), which is called from __setup_irq() only when
irq_settings_can_autoenable() returns true.

irq_set_percpu_devid() sets IRQ_NOAUTOEN (via irq_set_percpu_devid_flags),
so irq_startup() is intentionally skipped for percpu-devid IRQs.
enable_percpu_irq() calls irq_percpu_enable() which does irq_enable/unmask
on the chip but never touches IRQD_IRQ_DISABLED.

Result: handle_edge_irq() hits irq_can_handle_actions() → checks
irqd_irq_disabled() → returns false → IRQ silently dropped.

This was confirmed by logs:

   XEN_TRACE irq=12 percpu_enable cpu=0 IRQD_DISABLED=1
   XEN_TRACE irq=12 handle_edge DROP IRQD_DISABLED=1 action=...

What we tried
-------------
- request_irq() correctly works with upstream IMSIC which uses 
handle_edge_irq with no
irq_set_percpu_devid() but it means we only can have one vCPU which will 
always handle the irq,
and we don't want that.

- Adding irq_set_percpu_devid() + switching to handle_percpu_devid_irq in
imsic_irq_domain_alloc() fixes the Xen case but breaks all other IMSIC
users (PCI MSI, platform devices) that call request_irq(), since
request_threaded_irq() rejects IRQs marked _IRQ_PER_CPU_DEVID:

   WARNING: CPU: 0 PID: 1 at kernel/irq/manage.c:2101
   request_threaded_irq+0x80/0x12c

Therefore, do you have any recommendations on how should I handle this 
case ?

Thanks,
Baptiste



--
Baptiste Le Duc | Vates XCP-ng Intern

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2026-05-01 15:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-24 16:39 [RFC] xen/riscv: per-CPU devid setup for Xen event channel IRQ on IMSIC Baptiste Le Duc
2026-04-24 16:55 ` Anup Patel
2026-04-28 16:40   ` Baptiste Le Duc
2026-04-28 18:47     ` Jürgen Groß
2026-04-30 13:03   ` Baptiste Le Duc
2026-04-30 13:58     ` Baptiste Le Duc
  -- strict thread matches above, loose matches on Subject: below --
2026-04-24 16:34 Baptiste Le Duc
2026-04-24 16:27 Baptiste Le Duc
2026-04-24 16:26 Baptiste Le Duc
2026-04-24 16:21 Baptiste Le Duc
2026-04-24 16:19 Baptiste Le Duc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox