From nobody Mon Sep 15 15:57:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B658CC46467 for ; Wed, 11 Jan 2023 18:38:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235047AbjAKSix (ORCPT ); Wed, 11 Jan 2023 13:38:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234534AbjAKSis (ORCPT ); Wed, 11 Jan 2023 13:38:48 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 006A714007; Wed, 11 Jan 2023 10:38:47 -0800 (PST) Date: Wed, 11 Jan 2023 18:38:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673462326; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p8y8nobWxJCXxABHliZ6sNM8bCx6NZKVFz9SwmPoCrQ=; b=bJppQ4+5qgJcHNToETLOWI0fnwbdB0QsXaPx3UeLFdg1Ozm+rj8QmcX4WHsaO8jl1baQDG OgVmLo+wKewLI7K13pwiTDKeIn3V6EVrAhcLRp+gU+Dpw8EPPiVGZKa5ImWDF094iAJ8l/ lUJrtxke6l0xx4qmiWzr9s/codS3ykGLjieHqmElM2pfKfY+pz86Ffqtj69Tang19qn/qo 3fgReC3VbFtp6yYK+M2RKIDnfszQckHcAWGLHrYmAOqDbYjUQ94gtxkTnShQGvqCG/VB+V CiWuN6LuorE+43OUWWypP9cD9+0HZtJ7adbRTLSFWYgZfHd16M2sxxwylTUNzQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673462326; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p8y8nobWxJCXxABHliZ6sNM8bCx6NZKVFz9SwmPoCrQ=; b=RH4yXX5IdR2kk9r3Qkrbrek4InvKcH87oft2+4swQysIdmTfn5sAVDB9+XnBsQjvgabbHd pvmVsEDmcJ5ij5Cw== From: "tip-bot2 for Manfred Spraul" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] genirq: Add might_sleep() to disable_irq() Cc: Manfred Spraul , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20221216150441.200533-3-manfred@colorfullife.com> References: <20221216150441.200533-3-manfred@colorfullife.com> MIME-Version: 1.0 Message-ID: <167346232582.4906.17142708908609012375.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/core branch of tip: Commit-ID: 17549b0f184d870f2cfa4e5cfa79f4c4905ed757 Gitweb: https://git.kernel.org/tip/17549b0f184d870f2cfa4e5cfa79f4c49= 05ed757 Author: Manfred Spraul AuthorDate: Fri, 16 Dec 2022 16:04:41 +01:00 Committer: Thomas Gleixner CommitterDate: Wed, 11 Jan 2023 19:35:13 +01:00 genirq: Add might_sleep() to disable_irq() With the introduction of threaded interrupt handlers, it is virtually never safe to call disable_irq() from non-premptible context. Thus: Update the documentation, add an explicit might_sleep() to catch any offenders. This is more obvious and straight forward than the implicit might_sleep() check deeper down in the disable_irq() call chain. Fixes: 3aa551c9b4c4 ("genirq: add threaded interrupt handler support") Signed-off-by: Manfred Spraul Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20221216150441.200533-3-manfred@colorfullif= e.com --- kernel/irq/manage.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 5b7cf28..8ce7549 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -723,10 +723,13 @@ EXPORT_SYMBOL(disable_irq_nosync); * to complete before returning. If you use this function while * holding a resource the IRQ handler may need you will deadlock. * - * This function may be called - with care - from IRQ context. + * Can only be called from preemptible code as it might sleep when + * an interrupt thread is associated to @irq. + * */ void disable_irq(unsigned int irq) { + might_sleep(); if (!__disable_irq_nosync(irq)) synchronize_irq(irq); }