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=1794065286; b=bK4QdvPVrbRNS5DCjv6SxZT9qD5QsZPSK7fWGgriROehxWJAUrJ7nUpD7jkRqerC+DAi Bqv+iltcPbLgHuo+q1ApWRi4BDLomsR6GhIvY1GkcNSnM+yP/ALdZFmj2a9IByN2kvi/1 jkwhsMDEHivMyBH3IPmycnZCUSUiwYO762wiqnaEUo60HOUg6TewRTiJ7ta3mtrvuEVAo ucW6yvp0Mkb406A2tM0y4znZEWBBz3x3Vzwr5OzgSc6PQM4itT2qW0ElJEItSFqiK+Nl9 jL/TME4oahqviXIJVmbueFIFh62zioGILRra+gFPBGVgQbZNi5XWwcrt81WnaRIECvA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794065286; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=9kaiW/bo/VHT8fqrgnvUIVJfyJw3gRCMkHWZr/iuNd0=; b=VeT3r0RL+TgA+jfwQKlfbWgEuFcsv9AufHkLu/Gc1i3+V4qjggPDT1zUQACzk0kk5DJH Qz0hjKzlXQWZx+6CQ0VoYiUIJRed7TZMYOipm2msyigJbgRZFlE9wmpgROcjuJlJSN1yl st3aUGP1ccrnqLsf+QNK3mAfP/YFyDwAyDmBhtklpXdjbRcINdlnUHu2FpwIcM00urhFt W0WFewAMjKnG2VXwwX2GZhwhWqWj82urWHO6k8pACAd8Ms52IaOsSjqsSyk3JB01r24bb nkq+dEA5IwIjXjtRrYBbJTMw+Sd40nld6IYQvr2Q3dq9umE67WPSplOj9uspWArkuDw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=En21A71b; 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 6F747606A32D; Sat, 7 Nov 2026 15:28:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=En21A71b Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFCEE1F008A1; Sat, 7 Nov 2026 15:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1794065286; bh=9kaiW/bo/VHT8fqrgnvUIVJfyJw3gRCMkHWZr/iuNd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=En21A71b8y0u6RYXIFWp/K78DgqqqvMS16ezvnN5OKWteXbIFLiYyyzuLGYm26mOh r8PgCEgxerDOjjyopd3kGdwc/7RGJohdfSK0vJC2z4lOQIWw6f4DoKVr2YouHmG43e 0/0xkvuBfKfPmtxBNhY5fMcUAIX7PB/YjIMsggyg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Thomas Gleixner , Igor Velkov , Sasha Levin Subject: [PATCH 7.3 1046/1257] genirq/kexec: Do not take the bus lock of an interrupt chip on the crash path Date: Sat, 7 Nov 2026 08:55:42 -0500 Message-ID: <20261107135008.194527072@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261107134939.434104957@linuxfoundation.org> References: <20261107134939.434104957@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Igor Velkov [ Upstream commit 717862eac6eff0eea8ac30a0c0de0bed84922aab ] 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 Signed-off-by: Sasha Levin --- kernel/irq/internals.h | 1 + kernel/irq/kexec.c | 2 +- kernel/irq/manage.c | 43 +++++++++++++++++++++++------------------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index 2c30e7537987c..703a062be8783 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h @@ -83,6 +83,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); diff --git a/kernel/irq/kexec.c b/kernel/irq/kexec.c index 1a3deffe6b5b6..f245b98764225 100644 --- 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)) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 3b647d9b458ad..ec3ecb0e48cec 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -2748,6 +2748,28 @@ int irq_get_irqchip_state(unsigned int irq, enum irqchip_irq_state which, bool * } 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 @@ -2762,25 +2784,8 @@ EXPORT_SYMBOL_GPL(irq_get_irqchip_state); */ int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which, bool val) { - scoped_irqdesc_get_and_buslock(irq, 0) { - struct irq_data *data = irq_desc_get_irq_data(scoped_irqdesc); - 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); - } + scoped_irqdesc_get_and_buslock(irq, 0) + return __irq_set_irqchip_state(scoped_irqdesc, which, val); return -EINVAL; } EXPORT_SYMBOL_GPL(irq_set_irqchip_state); -- 2.53.0