From patchwork Wed Jan 11 18:38:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 42139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3480094wrt; Wed, 11 Jan 2023 10:44:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXuVd+Xfxf44N3FB9pKGHpdf9xrDAwiYBAr5Lt92d031Jo290eqxKUTeTUo5J+tC39dZn0ST X-Received: by 2002:a17:906:fcda:b0:852:dc8d:3a01 with SMTP id qx26-20020a170906fcda00b00852dc8d3a01mr9787659ejb.55.1673462693800; Wed, 11 Jan 2023 10:44:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673462693; cv=none; d=google.com; s=arc-20160816; b=W8R0wYAQcUmGdMOEYDLX0VEQBIkLTrTnEFrsp4hlXIgPrRGDU40ZXrebszA8ZkNoNR 4a13NbrU6jYK/MgrOzP/Tu+PZ78A3ArNu1Qr0P4if8dZyI0i1QwZMZ6YY4aSzER4JyVG rxZLTP2EIzrYdl4yn578qLHwewo0Q6n0bLIps0Nndo9ro8jhFc4FUO7q5awbpUacIHyW 9FgGwiLfo2kNQpCA1fLFH4vjDKmMyXyO16gfa7aRM3Mrqc14A53DbfnQdhEw8ChkmDoo /m8eh8mglcVcXaoOzrHR5CdTPEPllDEvMw75hBLY3Ewz6cAtFuLiFEboEcOUIEkPmW/B TfzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=p8y8nobWxJCXxABHliZ6sNM8bCx6NZKVFz9SwmPoCrQ=; b=isWh/Br3w0O5ki/u/mNgu8wdUrv+A0N/EwzxfiEwiujn3zi19FMJcTrIogF/k3R3dc Z4ijXZTq7+UNHc7OHnLc6s+QXnsAi3yTNOsKQOD5FhwDf6gL67JwYnGJAW7eLeRqHKSX ZD0ogMGxIpNOWbQrFdkyVk82x6/Jsu1Kj+kmhrXjhvLycX1h5jnk3yz4ZlsqPDL/1O4P vnry5xN/WRdzAbIF6CBTIGocOjsMMgevi1uvnhMaOm2FbfBadcMR4CR8xA078rOJSuUO KZe42gF1Au1JXP8ZtrTUxe971WCLbD9nyW2Nk7DEPu+MGoDIGaA626aI8UpvUzgKssMS 9MRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=bJppQ4+5; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du10-20020a17090772ca00b0079330b37fb5si14913984ejc.564.2023.01.11.10.44.29; Wed, 11 Jan 2023 10:44:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=bJppQ4+5; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234484AbjAKSiw (ORCPT + 99 others); Wed, 11 Jan 2023 13:38:52 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754752817494463826?= X-GMAIL-MSGID: =?utf-8?q?1754752817494463826?= The following commit has been merged into the irq/core branch of tip: Commit-ID: 17549b0f184d870f2cfa4e5cfa79f4c4905ed757 Gitweb: https://git.kernel.org/tip/17549b0f184d870f2cfa4e5cfa79f4c4905ed757 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@colorfullife.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); }