Re: [RFC 06/12] genirq: Add per-cpu flow handler with conditional IRQ stats

Thomas Gleixner
2024-06-04T18:14:05Z

Michael!

On Mon, Jun 03 2024 at 22:09, mhkelley58@gmail.com wrote:
> Hyper-V VMBus devices generate interrupts that are multiplexed
> onto a single per-CPU architectural interrupt. The top-level VMBus
> driver ISR demultiplexes these interrupts and invokes per-device
> handlers. Currently, these per-device handlers are not modeled as
> Linux IRQs, so /proc/interrupts shows all VMBus interrupts as accounted
> to the top level architectural interrupt. Visibility into per-device
> interrupt stats requires accessing VMBus-specific entries in sysfs.
> The top-level VMBus driver ISR also handles management-related
> interrupts that are not attributable to a particular VMBus device.
>
> As part of changing VMBus to model VMBus per-device handlers as
> normal Linux IRQs, the top-level VMBus driver needs to conditionally
> account for interrupts. If it passes the interrupt off to a
> device-specific IRQ, the interrupt stats are done by that IRQ
> handler, and accounting for the interrupt at the top level
> is duplicative. But if it handles a management-related interrupt
> itself, then it should account for the interrupt itself.
>
> Introduce a new flow handler that provides this functionality.
> The new handler parallels handle_percpu_irq(), but does stats
> only if the ISR returns other than IRQ_NONE. The existing
> handle_untracked_irq() can't be used because it doesn't work for
> per-cpu IRQs, and it doesn't provide conditional stats.

There is a two other options to solve this:

1) Move the inner workings of handle_percpu_irq() out into
a static function which returns the 'handled' value and
share it between the two handler functions.

2) Allocate a proper interrupt for the management mode and invoke it
via generic_handle_irq() just as any other demultiplex interrupt.
That spares all the special casing in the core code and just
works.

Thanks,

tglx