linux-stable/drivers/irqchip
Marc Zyngier 702f64bc4e irqchip/gic-v4: Provide irq_retrigger to avoid circular locking dependency
[ Upstream commit 7809f7011c ]

On a very heavily loaded D05 with GICv4, I managed to trigger the
following lockdep splat:

[ 6022.598864] ======================================================
[ 6022.605031] WARNING: possible circular locking dependency detected
[ 6022.611200] 5.6.0-rc4-00026-geee7c7b0f498 #680 Tainted: G            E
[ 6022.618061] ------------------------------------------------------
[ 6022.624227] qemu-system-aar/7569 is trying to acquire lock:
[ 6022.629789] ffff042f97606808 (&p->pi_lock){-.-.}, at: try_to_wake_up+0x54/0x7a0
[ 6022.637102]
[ 6022.637102] but task is already holding lock:
[ 6022.642921] ffff002fae424cf0 (&irq_desc_lock_class){-.-.}, at: __irq_get_desc_lock+0x5c/0x98
[ 6022.651350]
[ 6022.651350] which lock already depends on the new lock.
[ 6022.651350]
[ 6022.659512]
[ 6022.659512] the existing dependency chain (in reverse order) is:
[ 6022.666980]
[ 6022.666980] -> #2 (&irq_desc_lock_class){-.-.}:
[ 6022.672983]        _raw_spin_lock_irqsave+0x50/0x78
[ 6022.677848]        __irq_get_desc_lock+0x5c/0x98
[ 6022.682453]        irq_set_vcpu_affinity+0x40/0xc0
[ 6022.687236]        its_make_vpe_non_resident+0x6c/0xb8
[ 6022.692364]        vgic_v4_put+0x54/0x70
[ 6022.696273]        vgic_v3_put+0x20/0xd8
[ 6022.700183]        kvm_vgic_put+0x30/0x48
[ 6022.704182]        kvm_arch_vcpu_put+0x34/0x50
[ 6022.708614]        kvm_sched_out+0x34/0x50
[ 6022.712700]        __schedule+0x4bc/0x7f8
[ 6022.716697]        schedule+0x50/0xd8
[ 6022.720347]        kvm_arch_vcpu_ioctl_run+0x5f0/0x978
[ 6022.725473]        kvm_vcpu_ioctl+0x3d4/0x8f8
[ 6022.729820]        ksys_ioctl+0x90/0xd0
[ 6022.733642]        __arm64_sys_ioctl+0x24/0x30
[ 6022.738074]        el0_svc_common.constprop.3+0xa8/0x1e8
[ 6022.743373]        do_el0_svc+0x28/0x88
[ 6022.747198]        el0_svc+0x14/0x40
[ 6022.750761]        el0_sync_handler+0x124/0x2b8
[ 6022.755278]        el0_sync+0x140/0x180
[ 6022.759100]
[ 6022.759100] -> #1 (&rq->lock){-.-.}:
[ 6022.764143]        _raw_spin_lock+0x38/0x50
[ 6022.768314]        task_fork_fair+0x40/0x128
[ 6022.772572]        sched_fork+0xe0/0x210
[ 6022.776484]        copy_process+0x8c4/0x18d8
[ 6022.780742]        _do_fork+0x88/0x6d8
[ 6022.784478]        kernel_thread+0x64/0x88
[ 6022.788563]        rest_init+0x30/0x270
[ 6022.792390]        arch_call_rest_init+0x14/0x1c
[ 6022.796995]        start_kernel+0x498/0x4c4
[ 6022.801164]
[ 6022.801164] -> #0 (&p->pi_lock){-.-.}:
[ 6022.806382]        __lock_acquire+0xdd8/0x15c8
[ 6022.810813]        lock_acquire+0xd0/0x218
[ 6022.814896]        _raw_spin_lock_irqsave+0x50/0x78
[ 6022.819761]        try_to_wake_up+0x54/0x7a0
[ 6022.824018]        wake_up_process+0x1c/0x28
[ 6022.828276]        wakeup_softirqd+0x38/0x40
[ 6022.832533]        __tasklet_schedule_common+0xc4/0xf0
[ 6022.837658]        __tasklet_schedule+0x24/0x30
[ 6022.842176]        check_irq_resend+0xc8/0x158
[ 6022.846609]        irq_startup+0x74/0x128
[ 6022.850606]        __enable_irq+0x6c/0x78
[ 6022.854602]        enable_irq+0x54/0xa0
[ 6022.858431]        its_make_vpe_non_resident+0xa4/0xb8
[ 6022.863557]        vgic_v4_put+0x54/0x70
[ 6022.867469]        kvm_arch_vcpu_blocking+0x28/0x38
[ 6022.872336]        kvm_vcpu_block+0x48/0x490
[ 6022.876594]        kvm_handle_wfx+0x18c/0x310
[ 6022.880938]        handle_exit+0x138/0x198
[ 6022.885022]        kvm_arch_vcpu_ioctl_run+0x4d4/0x978
[ 6022.890148]        kvm_vcpu_ioctl+0x3d4/0x8f8
[ 6022.894494]        ksys_ioctl+0x90/0xd0
[ 6022.898317]        __arm64_sys_ioctl+0x24/0x30
[ 6022.902748]        el0_svc_common.constprop.3+0xa8/0x1e8
[ 6022.908046]        do_el0_svc+0x28/0x88
[ 6022.911871]        el0_svc+0x14/0x40
[ 6022.915434]        el0_sync_handler+0x124/0x2b8
[ 6022.919951]        el0_sync+0x140/0x180
[ 6022.923773]
[ 6022.923773] other info that might help us debug this:
[ 6022.923773]
[ 6022.931762] Chain exists of:
[ 6022.931762]   &p->pi_lock --> &rq->lock --> &irq_desc_lock_class
[ 6022.931762]
[ 6022.942101]  Possible unsafe locking scenario:
[ 6022.942101]
[ 6022.948007]        CPU0                    CPU1
[ 6022.952523]        ----                    ----
[ 6022.957039]   lock(&irq_desc_lock_class);
[ 6022.961036]                                lock(&rq->lock);
[ 6022.966595]                                lock(&irq_desc_lock_class);
[ 6022.973109]   lock(&p->pi_lock);
[ 6022.976324]
[ 6022.976324]  *** DEADLOCK ***

This is happening because we have a pending doorbell that requires
retrigger. As SW retriggering is done in a tasklet, we trigger the
circular dependency above.

The easy cop-out is to provide a retrigger callback that doesn't
require acquiring any extra lock.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200310184921.23552-5-maz@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-17 10:48:41 +02:00
..
alphascale_asm9260-icoll.h
exynos-combiner.c
irq-alpine-msi.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
irq-armada-370-xp.c
irq-aspeed-i2c-ic.c
irq-aspeed-vic.c
irq-ath79-cpu.c
irq-ath79-misc.c Revert "MIPS: perf: ath79: Fix perfcount IRQ assignment" 2019-06-11 12:20:53 +02:00
irq-ativic32.c irqchip: Andestech Internal Vector Interrupt Controller driver 2018-02-22 10:44:36 +08:00
irq-atmel-aic-common.c
irq-atmel-aic-common.h
irq-atmel-aic.c
irq-atmel-aic5.c
irq-bcm2835.c
irq-bcm2836.c irqchip/irq-bcm2836: Add support for DT interrupt polarity 2018-01-04 11:12:39 +00:00
irq-bcm6345-l1.c
irq-bcm7038-l1.c irqchip/irq-bcm7038-l1: Enable parent IRQ if necessary 2020-01-04 19:12:52 +01:00
irq-bcm7120-l2.c irqchip/bcm: Remove hashed address printing 2018-02-16 14:22:16 +00:00
irq-brcmstb-l2.c irqchip/brcmstb-l2: Use _irqsave locking variants in non-interrupt code 2019-03-23 20:10:01 +01:00
irq-clps711x.c
irq-crossbar.c
irq-digicolor.c
irq-dw-apb-ictl.c
irq-eznps.c
irq-ftintc010.c
irq-gic-common.c irqchip/gic: Take lock when updating irq type 2018-03-29 11:47:50 +01:00
irq-gic-common.h
irq-gic-pm.c
irq-gic-realview.c
irq-gic-v2m.c irqchip/gic-v2m: Fix SPI release on error path 2018-06-22 14:22:00 +02:00
irq-gic-v3-its-fsl-mc-msi.c irqchip/gic-v3-its: Move minimum LPI requirements to individual busses 2018-07-16 14:22:19 +01:00
irq-gic-v3-its-pci-msi.c irqchip/gic-v3-its: Reduce minimum LPI allocation to 1 for PCI devices 2018-07-27 10:01:24 +01:00
irq-gic-v3-its-platform-msi.c irqchip/gic-v3-its: Move minimum LPI requirements to individual busses 2018-07-16 14:22:19 +01:00
irq-gic-v3-its.c irqchip/gic-v4: Provide irq_retrigger to avoid circular locking dependency 2020-04-17 10:48:41 +02:00
irq-gic-v3-mbi.c irqchip/gic-v3-mbi: Fix uninitialized mbi_lock 2019-03-05 17:58:48 +01:00
irq-gic-v3.c irqchip/gic-v3: Only provision redistributors that are enabled in ACPI 2020-02-24 08:34:52 +01:00
irq-gic-v4.c irqchip/gic-v4: Clear IRQ_DISABLE_UNLAZY again if mapping fails 2017-11-10 09:50:36 +00:00
irq-gic.c irqchip/gic: Update supports_deactivate static key to modern api 2018-03-28 15:24:15 +01:00
irq-goldfish-pic.c irqchip/irq-goldfish-pic: Add Goldfish PIC driver 2018-01-04 11:14:04 +00:00
irq-hip04.c
irq-i8259.c irqchip/i8259: Set I/O port resource types correctly 2017-12-18 23:07:46 -06:00
irq-imgpdc.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
irq-imx-gpcv2.c irqchip/irq-imx-gpcv2: Forward irq type to parent 2019-08-25 10:47:53 +02:00
irq-ingenic.c irqchip: ingenic: Error out if IRQ domain creation failed 2020-01-04 19:12:52 +01:00
irq-jcore-aic.c
irq-keystone.c
irq-lpc32xx.c
irq-ls-scfg-msi.c irqchip/ls-scfg-msi: Fix MSI affinity handling 2018-06-22 14:22:00 +02:00
irq-mbigen.c irqchip/mbigen: Set driver .suppress_bind_attrs to avoid remove problems 2020-02-24 08:34:50 +01:00
irq-meson-gpio.c irqchip/meson-gpio: Add support for Meson-G12A SoC 2019-07-26 09:14:06 +02:00
irq-mips-cpu.c
irq-mips-gic.c irqchip/mips-gic: Use the correct local interrupt map registers 2019-07-03 13:14:46 +02:00
irq-mmp.c irqchip/mmp: Only touch the PJ4 IRQ & FIQ bits on enable/disable 2019-03-13 14:02:35 -07:00
irq-mscc-ocelot.c irqchip: Add a driver for the Microsemi Ocelot controller 2018-03-22 15:52:27 +00:00
irq-mtk-cirq.c
irq-mtk-sysirq.c
irq-mvebu-gicp.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
irq-mvebu-icu.c irqchip/irq-mvebu-icu: Fix wrong private data retrieval 2019-11-24 08:19:40 +01:00
irq-mvebu-odmi.c
irq-mvebu-pic.c
irq-mxs.c
irq-nvic.c
irq-omap-intc.c
irq-ompic.c irqchip/ompic: fix return value check in ompic_of_init() 2018-01-04 11:13:22 +00:00
irq-or1k-pic.c
irq-orion.c
irq-partition-percpu.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
irq-pic32-evic.c
irq-renesas-h8s.c h8300: irqchip: fix warning 2018-08-22 19:14:19 +09:00
irq-renesas-h8300h.c
irq-renesas-intc-irqpin.c irqchip/renesas-intc-irqpin: Use wakeup_path i.s.o. explicit clock handling 2018-03-14 11:11:15 +00:00
irq-renesas-irqc.c irqchip/renesas-irqc: Use wakeup_path i.s.o. explicit clock handling 2018-03-14 11:11:21 +00:00
irq-s3c24xx.c irqchip/s3c24xx: Remove unneeded comparison of unsigned long to 0 2018-08-13 16:20:17 +01:00
irq-sa11x0.c
irq-sifive-plic.c irqchip: add a SiFive PLIC driver 2018-08-13 08:31:32 -07:00
irq-sirfsoc.c
irq-sni-exiu.c irqchip/exiu: Fix return value check in exiu_init() 2017-11-14 11:27:22 +01:00
irq-st.c
irq-stm32-exti.c irqchip/stm32: Don't clear rising/falling config registers at init 2019-04-20 09:15:58 +02:00
irq-sun4i.c
irq-sunxi-nmi.c
irq-tango.c irqchip/tango: Set irq handler and data in one go 2018-08-20 09:54:44 +01:00
irq-tb10x.c
irq-tegra.c
irq-ts4800.c
irq-uniphier-aidet.c
irq-versatile-fpga.c irqchip/versatile-fpga: Handle chained IRQs properly 2020-04-17 10:48:39 +02:00
irq-vf610-mscm-ir.c
irq-vic.c
irq-vt8500.c
irq-xilinx-intc.c
irq-xtensa-mx.c xtensa: drop variant IRQ support 2018-08-20 12:28:05 -07:00
irq-xtensa-pic.c xtensa: drop variant IRQ support 2018-08-20 12:28:05 -07:00
irq-zevio.c
irqchip.c
Kconfig irqchip: Place CONFIG_SIFIVE_PLIC into the menu 2020-01-23 08:21:36 +01:00
Makefile irqchip: add a SiFive PLIC driver 2018-08-13 08:31:32 -07:00
qcom-irq-combiner.c irqchip/qcom: Fix check for spurious interrupts 2018-05-02 15:56:10 +02:00
qcom-pdc.c irqchip/pdc: Setup all edge interrupts as rising edge at GIC 2018-11-13 11:08:34 -08:00
spear-shirq.c