From patchwork Wed Jan 11 21:17:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 42201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3542610wrt; Wed, 11 Jan 2023 13:22:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXuzq95ICx2YrrXBmTHWeU6oAjTQr+BsKbfysdSC50GX5Gi4TykRqUViBhz/xTEa/aa1i5vc X-Received: by 2002:a17:907:a488:b0:84d:2171:d79 with SMTP id vp8-20020a170907a48800b0084d21710d79mr19388645ejc.54.1673472157476; Wed, 11 Jan 2023 13:22:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673472157; cv=none; d=google.com; s=arc-20160816; b=JS8OWX5ADeUd4jjNGuZTobGIL7oN7HxyHnSue7YKQ9jG3URGB1KR1eDXn+2k1Xa3v6 a5HUyLX+T45e6cAMXMONJ83Ou8ZIW+flmuXMtH9r8u4HIMKShcMw08VJSt5vOZN/FEXM sODpN78ZfUh+uo6xVbdk+l/NMCRhjjxgj6YbDdOKIloLZXCDz4Su6aJC2sjASAE+hnNW dbm5Nj8oP3bDz/ap2hk3ND88RyV41Sy3e3SNrhyomEZ5SjXhKRfllONWNOzZgwZec5F0 HEgLrAtJ5o9yCanoaiyReMLrGX03QOUcNJZEuZnUtENi6jPe5CTpqvrcDSX0WdKtHA/M EBAQ== 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=KJcFPsuRnlT69IfwpVb+Lnza97LPnA6DR8gMevnpBGw=; b=MYspaUQgDwcpGGzv5kEW2MKbq9J84LXOMPyL6Zz56+MW34sK/w2GCAadgxM30dan1T 3/SNN2031FW4fm8vecEsge81BWKbLxW7xQOZWVcZmuR3IVuOUOyQuWFCt7Zzo3NSIoGb SlB5dnrJxfnnMN4Z8L68T584FGKzeKop4doMyIgxFRXxVEd3j1ouu17UG+7x8IF49M47 coOS+cPH9vM6/uUv/Nju7Ka4UgZi9P+Tm0M1VG+X2xi3snfjx5l5R/U+fJWRwMpyAgHH 4jT4yV70WBDboyTmRdE0SUEKZ6KvWNHLXEZbJs+ZdEVutWfih13Jdvi5TIUj+LuHQqGN CPOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YuyZtPHT; 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 xf3-20020a17090731c300b0084e3dc3d9bdsi7893456ejb.347.2023.01.11.13.22.13; Wed, 11 Jan 2023 13:22:37 -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=YuyZtPHT; 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 S234315AbjAKVRy (ORCPT + 99 others); Wed, 11 Jan 2023 16:17:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234200AbjAKVRl (ORCPT ); Wed, 11 Jan 2023 16:17:41 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBB951929B; Wed, 11 Jan 2023 13:17:39 -0800 (PST) Date: Wed, 11 Jan 2023 21:17:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673471857; 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=KJcFPsuRnlT69IfwpVb+Lnza97LPnA6DR8gMevnpBGw=; b=YuyZtPHT9VUWbAqE6ZkkWB2ToPyyYRnxiUGvqCKAYevTyyEMhJEVbToy4s1tlJgR2So1uH zy25ZeLgrrQIQoss19ezxr2HPpowEMCva0W1IslLi6ihTywEqWW5Rddiak8QtlPXVPP67T e7+TyOh5FTOIq8/yYEumvTZj+MX8BPaOGqxEzzA+0z/EiNX7zO0G6zkfQGFxZJmCWUhljE FVrshCa8ynFSjcVicR5gIt3q0fCIAIaQf05WMscmVJ2a1fp6ZbgDwjRVAdSxI91wl3VDww TNDSkjdBEuKRk41LjUbA7Eh3qUsYBc+Mwu5pE01vgMcMcAwRd8NXXX+5h1fdWg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673471857; 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=KJcFPsuRnlT69IfwpVb+Lnza97LPnA6DR8gMevnpBGw=; b=DTVafsYt6XoZL5MU5+n/ygFwWjVq1xj5baaC2FsrXbyxXwpbmy0BzkyBBa9dOJ1ZlCynzV OE5TUkCOu/7TYLBg== From: "tip-bot2 for Alexander Sverdlin" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] docs: locking: Discourage from calling disable_irq() in atomic Cc: Alexander Sverdlin , Thomas Gleixner , Manfred Spraul , linux-doc@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20221212163715.830315-1-alexander.sverdlin@siemens.com> References: <20221212163715.830315-1-alexander.sverdlin@siemens.com> MIME-Version: 1.0 Message-ID: <167347185712.4906.2425854562140867761.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?1754762740990212784?= X-GMAIL-MSGID: =?utf-8?q?1754762740990212784?= The following commit has been merged into the irq/core branch of tip: Commit-ID: 379af13b31fa8a36ad4abd59a5c511f25c5d4d42 Gitweb: https://git.kernel.org/tip/379af13b31fa8a36ad4abd59a5c511f25c5d4d42 Author: Alexander Sverdlin AuthorDate: Mon, 12 Dec 2022 17:37:15 +01:00 Committer: Thomas Gleixner CommitterDate: Wed, 11 Jan 2023 19:45:26 +01:00 docs: locking: Discourage from calling disable_irq() in atomic Correct the example in the documentation so that disable_irq() is not being called in atomic context. disable_irq() calls sleeping synchronize_irq(), it's not allowed to call them in atomic context. Signed-off-by: Alexander Sverdlin Signed-off-by: Thomas Gleixner Reviewed-by: Manfred Spraul Cc: linux-doc@vger.kernel.org Link: https://lore.kernel.org/lkml/87k02wbs2n.ffs@tglx/ Link: https://lore.kernel.org/r/20221212163715.830315-1-alexander.sverdlin@siemens.com --- Documentation/kernel-hacking/locking.rst | 4 ++-- Documentation/translations/it_IT/kernel-hacking/locking.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/kernel-hacking/locking.rst b/Documentation/kernel-hacking/locking.rst index c756786..dff0646 100644 --- a/Documentation/kernel-hacking/locking.rst +++ b/Documentation/kernel-hacking/locking.rst @@ -1277,11 +1277,11 @@ Manfred Spraul points out that you can still do this, even if the data is very occasionally accessed in user context or softirqs/tasklets. The irq handler doesn't use a lock, and all other accesses are done as so:: - spin_lock(&lock); + mutex_lock(&lock); disable_irq(irq); ... enable_irq(irq); - spin_unlock(&lock); + mutex_unlock(&lock); The disable_irq() prevents the irq handler from running (and waits for it to finish if it's currently running on other CPUs). diff --git a/Documentation/translations/it_IT/kernel-hacking/locking.rst b/Documentation/translations/it_IT/kernel-hacking/locking.rst index b8ecf41..05d362b 100644 --- a/Documentation/translations/it_IT/kernel-hacking/locking.rst +++ b/Documentation/translations/it_IT/kernel-hacking/locking.rst @@ -1307,11 +1307,11 @@ se i dati vengono occasionalmente utilizzati da un contesto utente o da un'interruzione software. Il gestore d'interruzione non utilizza alcun *lock*, e tutti gli altri accessi verranno fatti così:: - spin_lock(&lock); + mutex_lock(&lock); disable_irq(irq); ... enable_irq(irq); - spin_unlock(&lock); + mutex_unlock(&lock); La funzione disable_irq() impedisce al gestore d'interruzioni d'essere eseguito (e aspetta che finisca nel caso fosse in esecuzione su