irq count is zero bug

Neil Horman nhorman at tuxdriver.com
Tue Aug 1 17:56:04 PDT 2017


On Tue, Aug 01, 2017 at 04:37:20PM +0000, Tom Daley wrote:
> 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
Hey Tom-
	I'm a bit confused about what you say is going on.  The policy script
should not be called every time an irq is rebalanced.  Its called once when when
the daemon starts up (main->build_object_tree->rebuild_irq_db), and anytime that
a rescan is needed (i.e. when an interrupt is added or removed), not when a
rebalance of existing irqs is run.

	Can I ask what your irq policy script does?  Perhaps we can find a
better solution for your problem

Regards
Neil


> _______________________________________________
> irqbalance mailing list
> irqbalance at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/irqbalance




More information about the irqbalance mailing list