From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794143641; b=tKKqv/fl3mAQUM4p3fE8qF2LMRC27KtebOWv6SKEaVkRCpWuuoyaf17lHEP9rYVIQcpZ ljPNOcwI/2SHounLj5Vh86pIEaZXBDC/GQ/liYKfb3HPSTmMqDbc5ElHotM/jxJsFVe++ niIHhqdi2vwmfNFPj3VXYlJ3Snlxlb9uzXyCXsLIhiWbKdcl1DzZy6Hd2NM/tTTt+/cXY dw96R143ueMO00EWCjYxxYljnaT9L/NnALbcMdwv9CkcWxWYAr12QQ7IFMTzl8i3Iw7yT RasuoSXfKWUyrErgUYnTB1T5CFppnmmPQo/yZmf35/go5tUcr1Ijbt98SfLD5Qxx8xQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794143641; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type; bh=W/1T0/L0I5S9MydLh2101G4I8CERZFinYmV86V44i/8=; b=M6KOXVyGLzlhLC6skx6pOyaQjRzrVPTg3DvFhbHfuJlO9waq/6gHDnuI7Q4JdpHoLn+t t731s3YZskgQ5u+thCv9Waxas7t5m3keTP547Keb4BM3gvd9hzD5YSAtoof3C/KUV+au7 GMdGRowohMkoirMB9pozgg8Bm7JdJGXbfBN7Q9vcdICTk89j6SYmXqFDy85BxajUPIB5Q WkMC1QbBwXMPDjz53dEj7GZElfY9Cya++i9GpTjXyh6x27Gnfrny4zXf2W02Zd/lsjTVz 33By+hfyAbyY6nNcCnPTw2uwpV4AsCD4YngwH5moyPbN2cBZSPBcrUg/SL1BXkPmE6g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BBiKH3gA; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA0B6606A31C for ; Sun, 8 Nov 2026 13:14:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BBiKH3gA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A0EB1F0089F; Sun, 8 Nov 2026 13:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794143640; bh=W/1T0/L0I5S9MydLh2101G4I8CERZFinYmV86V44i/8=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=BBiKH3gAM0Q+jpQWzNeuCEMc/HrmMDsyJsSEFP+phyFdTVs73tn/3+dVFUdysIkJ6 ovfYGi0nEScYstkj8tYtqwj08Hs2DSIefR1guCfVyX64ely6rtzvutlkAPZCepPK5w tVD7jv2rIDZIfOiA78TsGf4HHUxGVaeHhQQHHbg5tM7SxiJJDzRH2gaxMWNzOkrQJs clB2Xzl4kjrULrdXB06osBkqRSgp6BRQTigH5UeEJHSdrhD8G2nAfmddTtTwvs2mRU gbnRrP1ejLqkLN2HCTZ+IxbSNjRgRYLgbuy8PuqRsEx6n05XZdrc/SEItA3uKh+SC9 GaOOgYFrjqd2A== From: Thomas Gleixner To: Sasha Levin , iav@iav.lv Cc: stable@vger.kernel.org Subject: [PATCH 6.12.y] genirq/kexec: Do not take the bus lock of an interrupt chip on the crash path In-Reply-To: <20261107052534-failed-6.12-717862eac6ef@kernel.org> References: <20261107052534-failed-6.12-717862eac6ef@kernel.org> Date: Sun, 08 Nov 2026 14:13:57 +0100 Message-ID: <87a4njwjmy.ffs@fw13> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain From: Igor Velkov commit 717862eac6eff0eea8ac30a0c0de0bed84922aab upstream. machine_kexec_mask_interrupts() calls irq_set_irqchip_state() for every started interrupt. That function takes the bus lock of the chip and desc->lock, and syncs the chip when it drops them. On the crash path interrupts are off and the other CPUs are stopped, so a chip whose bus transfer is completed by an interrupt never returns from the sync. On RK3399 boards with an RK808 PMIC the RTC alarm interrupt belongs to the regmap-irq chip of the RK808, which sits on I2C. rk808_irq_chip sets init_ack_masked, so regmap_irq_sync_unlock() writes the ack register on every unlock, and the I2C controller needs its own interrupt to finish the transfer. A panic with a crash kernel loaded prints SMP: stopping secondary CPUs and then nothing until the watchdog resets the board. machine_kexec_mask_interrupts() takes neither lock for the other operations on the descriptor. Move the search for the chip that implements irq_set_irqchip_state() into __irq_set_irqchip_state(), which takes no locks, and call it from machine_kexec_mask_interrupts(). Fixes: 78fd584cdec0 ("arm64: kdump: implement machine_crash_shutdown()") Suggested-by: Thomas Gleixner Signed-off-by: Igor Velkov Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20261015-kexec-irq-bus-lock-v2-1-2af15f0757b6@iav.lv --- kernel/irq/internals.h | 1 + kernel/irq/kexec.c | 2 +- kernel/irq/manage.c | 49 +++++++++++++++++++++++++------------------------ 3 files changed, 27 insertions(+), 25 deletions(-) --- --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h @@ -75,6 +75,7 @@ enum { #include "settings.h" extern int __irq_set_trigger(struct irq_desc *desc, unsigned long flags); +extern int __irq_set_irqchip_state(struct irq_desc *desc, enum irqchip_irq_state which, bool val); extern void __disable_irq(struct irq_desc *desc); extern void __enable_irq(struct irq_desc *desc); --- a/kernel/irq/kexec.c +++ b/kernel/irq/kexec.c @@ -25,7 +25,7 @@ void machine_kexec_mask_interrupts(void) * First try to remove the active state from an interrupt which is forwarded * to a VM. If the interrupt is not forwarded, try to EOI the interrupt. */ - check_eoi = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false); + check_eoi = __irq_set_irqchip_state(desc, IRQCHIP_STATE_ACTIVE, false); } if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data)) --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -2854,6 +2854,28 @@ int irq_get_irqchip_state(unsigned int i } EXPORT_SYMBOL_GPL(irq_get_irqchip_state); +int __irq_set_irqchip_state(struct irq_desc *desc, enum irqchip_irq_state which, bool val) +{ + struct irq_data *data = irq_desc_get_irq_data(desc); + struct irq_chip *chip; + + do { + chip = irq_data_get_irq_chip(data); + + if (WARN_ON_ONCE(!chip)) + return -ENODEV; + + if (chip->irq_set_irqchip_state) + break; + + data = irqd_get_parent_data(data); + } while (data); + + if (data) + return chip->irq_set_irqchip_state(data, which, val); + return -EINVAL; +} + /** * irq_set_irqchip_state - set the state of a forwarded interrupt. * @irq: Interrupt line that is forwarded to a VM @@ -2870,36 +2892,15 @@ int irq_set_irqchip_state(unsigned int i bool val) { struct irq_desc *desc; - struct irq_data *data; - struct irq_chip *chip; unsigned long flags; - int err = -EINVAL; + int err; desc = irq_get_desc_buslock(irq, &flags, 0); if (!desc) - return err; - - data = irq_desc_get_irq_data(desc); - - do { - chip = irq_data_get_irq_chip(data); - if (WARN_ON_ONCE(!chip)) { - err = -ENODEV; - goto out_unlock; - } - if (chip->irq_set_irqchip_state) - break; -#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY - data = data->parent_data; -#else - data = NULL; -#endif - } while (data); + return -EINVAL; - if (data) - err = chip->irq_set_irqchip_state(data, which, val); + err = __irq_set_irqchip_state(desc, which, val); -out_unlock: irq_put_desc_busunlock(desc, flags); return err; }