• Xiubo Li's avatar
    kvm: Fix irq route entries exceeding KVM_MAX_IRQ_ROUTES · caf1ff26
    Xiubo Li authored
    These days, we experienced one guest crash with 8 cores and 3 disks,
    with qemu error logs as bellow:
    qemu-system-x86_64: /build/qemu-2.0.0/kvm-all.c:984:
    kvm_irqchip_commit_routes: Assertion `ret == 0' failed.
    And then we found one patch(bdf026317d) in qemu tree, which said
    could fix this bug.
    Execute the following script will reproduce the BUG quickly:
    while [ 1 ]
        for irq in {1,2,4,8,10,20,40,80}
                echo $irq > /proc/irq/$vda_irq_num/smp_affinity
                echo $irq > /proc/irq/$vdb_irq_num/smp_affinity
                dd if=/dev/vda of=/dev/zero bs=4K count=100 iflag=direct
                dd if=/dev/vdb of=/dev/zero bs=4K count=100 iflag=direct
    The following qemu log is added in the qemu code and is displayed when
    this bug reproduced:
    kvm_irqchip_commit_routes: max gsi: 1008, nr_allocated_irq_routes: 1024,
    irq_routes->nr: 1024, gsi_count: 1024.
    That's to say when irq_routes->nr == 1024, there are 1024 routing entries,
    but in the kernel code when routes->nr >= 1024, will just return -EINVAL;
    The nr is the number of the routing entries which is in of
    [1 ~ KVM_MAX_IRQ_ROUTES], not the index in [0 ~ KVM_MAX_IRQ_ROUTES - 1].
    This patch fix the BUG above.
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarXiubo Li <lixiubo@cmss.chinamobile.com>
    Signed-off-by: default avatarWei Tang <tangwei@cmss.chinamobile.com>
    Signed-off-by: default avatarZhang Zhuoyu <zhangzhuoyu@cmss.chinamobile.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Last commit
Last update
kvm Loading commit data...
lib Loading commit data...
Makefile Loading commit data...