hardirqs: fix duplicated count for shared IRQ
Currently, hardirqs will count interrupt event simply while tracepoint
irq:irq_handler_entry triggered, it's fine for system without shared IRQ
event, but it will cause wrong interrupt count result for system with
shared IRQ, because kernel will interate all irq handlers belong to this
IRQ descriptor.
Take an example for system with shared IRQ below.
root@localhost:/# cat /proc/interrupts
CPU0
13: 385248 GICv3 39 Level DDOMAIN ISR, gdma
...
23: 61532 GICv3 38 Level VGIP ISR, OnlineMeasure ISR
DDOMAIN IRQ and gdma shared the IRQ 13, VGIP ISR and OnlineMeasure
shared the IRQ 23, and use 'hardirqs -C' to measure the count of these
interrupt event.
root@localhost:/# hardirqs -C 10 1
Tracing hard irq events... Hit Ctrl-C to end.
HARDIRQ TOTAL_count
OnlineMeasure ISR 300
VGIP ISR 300
gdma 2103
DDOMAIN ISR 2103
eth0 6677
hardirqs reported the same interrupt count for shared IRQ
'OnlineMeasure ISR/VGIP ISR' and 'gdma/DDOMAIN ISR'.
We should check the ret field of tracepoint irq:irq_hanlder_exit is
IRQ_HANDLED or IRQ_WAKE_THREAD to make sure the current event is belong
to this interrupt handler. For simplifying, just check `args->ret !=
IRQ_NONE`.
In the meantimes, the same changes should be applied to interrupt time
measurement.
The fixed hardirqs will show below output.
(bcc)root@localhost:/# ./hardirqs -C 10 1
Tracing hard irq events... Hit Ctrl-C to end.
HARDIRQ TOTAL_count
OnlineMeasure ISR 1
VGIP ISR 294
gdma 1168
DDOMAIN ISR 1476
eth0 5210