• C
    KVM: arm/arm64: Fix arch timers with userspace irqchips · d60d8b64
    Christoffer Dall 提交于
    When introducing support for irqchip in userspace we needed a way to
    mask the timer signal to prevent the guest continuously exiting due to a
    screaming timer.
    
    We did this by disabling the corresponding percpu interrupt on the
    host interrupt controller, because we cannot rely on the host system
    having a GIC, and therefore cannot make any assumptions about having an
    active state to hide the timer signal.
    
    Unfortunately, when introducing this feature, it became entirely
    possible that a VCPU which belongs to a VM that has a userspace irqchip
    can disable the vtimer irq on the host on some physical CPU, and then go
    away without ever enabling the vtimer irq on that physical CPU again.
    
    This means that using irqchips in userspace on a system that also
    supports running VMs with an in-kernel GIC can prevent forward progress
    from in-kernel GIC VMs.
    
    Later on, when we started taking virtual timer interrupts in the arch
    timer code, we would also leave this timer state active for userspace
    irqchip VMs, because we leave it up to a VGIC-enabled guest to
    deactivate the hardware IRQ using the HW bit in the LR.
    
    Both issues are solved by only using the enable/disable trick on systems
    that do not have a host GIC which supports the active state, because all
    VMs on such systems must use irqchips in userspace.  Systems that have a
    working GIC with support for an active state use the active state to
    mask the timer signal for both userspace and in-kernel irqchips.
    
    Cc: Alexander Graf <agraf@suse.de>
    Reviewed-by: NMarc Zyngier <marc.zyngier@arm.com>
    Cc: <stable@vger.kernel.org> # v4.12+
    Fixes: d9e13977 ("KVM: arm/arm64: Support arch timers with a userspace gic")
    Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
    d60d8b64
arch_timer.c 25.1 KB