irq count is zero bug

Tom Daley tdaley at ddn.com
Tue Aug 1 09:37:20 PDT 2017


Hi,

I have a problem with irqbalance involving PCI passthrough to a virtual machine.  I don't know that the problem is specific to running a virtual machine, but that is the use case that exposes the problem for me.

When the VM is started the interrupts for the devices are detected in /proc/interrupts and are not known to irqbalance yet, so the policy script gets called and the interrupts get balanced properly.

If the VM does not use the device, the interrupt counts in /proc/interrupts remain at zero.  Then if the VM is shutdown and restarted irqbalance does not detect that the interrupts need to be balanced and does not call the policy script.  The code in procinterrupts.c:parse_proc_interrupts() checks the count that was saved to the current counts in /proc/interrupts, but since the saved count is zero the current count can never be less and need_rescan does not get set.


            /* IRQ removed and reinserted, need restart or this will
             * cause an overflow and IRQ won't be rebalanced again
             */
            if (count < info->irq_count) {
                need_rescan = 1;

I have patches that fix the problem by adding a sequence number to the irq_info structure.  As /proc/interrupts is parsed the sequence number is updated in the irq_info structure for the interrupt.  After the scan, irq_info structures that do not have a current sequence number can be deleted.

If there is a better way to do this, please let me know.  I can test other possible fixes if needed.

Thanks, Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: irqbalance-1.2.0.patch
Type: application/octet-stream
Size: 5074 bytes
Desc: irqbalance-1.2.0.patch
URL: <http://lists.infradead.org/pipermail/irqbalance/attachments/20170801/8c07c1d5/attachment.obj>


More information about the irqbalance mailing list