Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp377390rdb; Thu, 25 Jan 2024 20:02:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrjBwVqoOgRASweL4dHfGDLHG4bJ1/+//e1GMnXPgY7hTMLipCTowGruFg2lAYMPMTY+VQ X-Received: by 2002:a05:6808:f8c:b0:3bd:b3c5:8902 with SMTP id o12-20020a0568080f8c00b003bdb3c58902mr1146416oiw.20.1706241752730; Thu, 25 Jan 2024 20:02:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706241752; cv=pass; d=google.com; s=arc-20160816; b=T2pCP9x/CFmTAwc4VQ6qRYZpFiWynuS/KmgMsQnY+ZNHUjkLeOKMSJT0ZksMYok5lz 63Q+UB4arH+C5hTkqMsGxART2RKjlFz/wN7uhway3rE62vpM0do10sHmSor6T5gC0fSh aiiIA678RFHfUZNitmlpfO+X9dEL0fiFkVI3IxJgA9Q3GIRmZ7QeojKCBj+IKUe7CABG hhNrXBz4macJsNRX9fuqa5LDOj6nQNe+qAZiyowltoeMCfHpXCTZ8o2tPhRCR9g67klw C1Ot3fm8i1UaF0oHGhKDl1H/chPaLDqIPzbjRzsjEKqDJfoo9niJU5V9XrnOyx2I+thP 00xw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:feedback-id:dkim-signature; bh=mN9urTWgOs5yxGqYWGcDWpJNj/mjOSJkCC13yHHIGOY=; fh=y2vSzkQ01DsnkYIHdHJwJuTjfZx9EXWe7xvme7T4GVA=; b=LdKeio7cmRmrwD6rfFKJq6lWTdxn1TYp47wEI/QDHVndFzla9w9Klau07KqvTk8s+A s4+ERLyVd6x+UDboN6hbQl/gGeMqmbRaYKphgT9Lwu2x6prHQwkIwZfCRfPGi3QLfx2H LwVSpD2LGjp864gafKyJYb1pJr7NZxeTz2r8yPHnubkHdpCxBnYhBi5ebAvZOEgrVOTO U066DrEbLS7wmO8n/Xc/7t2ZIx51bTdM/kiJyyXsefzkNbyXzB6EQpCFPO+RoxVyNK/J J4xfrj5CeWeJo17Wmh8SHNwfUT76pgI48AOCKSUNyfUVlsgqELhJsua3aew81363fpPk zLXw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FL+xRFuk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-39581-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39581-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q19-20020a62ae13000000b006ddd2c0b76bsi446983pff.87.2024.01.25.20.02.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 20:02:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39581-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FL+xRFuk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-39581-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39581-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5848AB217D6 for ; Fri, 26 Jan 2024 03:59:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 81853CA73; Fri, 26 Jan 2024 03:59:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FL+xRFuk" Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A298C148; Fri, 26 Jan 2024 03:59:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706241561; cv=none; b=hmV3vQSfXxigq3LVwnsIayemD5VMfpTkDE6sOLNp6Nx7jKR13C09tEwg0XxtJ6gqt3KeAqaS2lKfEvyan7ZhIlx/NC2Q7Vs9plYrP68pqq+VkyUcYxU+0gEzDrhSq25Kp05L5NHcM4SSSex6HJwEkh7IKD5ENTp7GPsSVA134F4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706241561; c=relaxed/simple; bh=h1Y/gwFxOJFXt01gnNFKLO6v78F6N7Su/jOY8g6xKP0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GBsYlwLdIfM2j4o+zaCHiU3LduC6AZkqRaGIIXRX4COhWh94GazyjNZt0dT/3tcKnqHoCjziruEH8IB1GznPVy0bLxgDEPQw6ydkfvGvT2zMHKOXoqlk+LPyzq/betlpm+BY2H+zuSxgHpHrwJUEinP4EmYtzPteFAlMcDCVfO0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FL+xRFuk; arc=none smtp.client-ip=209.85.222.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-783045e88a6so33971785a.0; Thu, 25 Jan 2024 19:59:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706241554; x=1706846354; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:from:to:cc:subject :date:message-id:reply-to; bh=mN9urTWgOs5yxGqYWGcDWpJNj/mjOSJkCC13yHHIGOY=; b=FL+xRFukscp+HWqcrFUT+7STUBnnfJzJE3/xHNQlmrKYzUOsRusGi/3WRo3nWz6P/I wcJbmOnLpl/EHy6mLoDX9DTvbVA1yevZF7k0XiwsD9t19TBQ0TjWnmzRKKTDocq+gN9b y0ZW4qHApkGLW7dFRHwJn6jWPXdTufii/vGI6s4VllmQrjgHLKGK5etyPdmSceKh3yiE YoiUv+kZ7lHFunvfqqQJxOigbNWRjsFM98FZ5x4faDBBw4St609cOj1p/xCih8q72nVD 5pTB6qIIkguhfWrHOWO6fYiWt3jQKcqp2eWh9b0UXOMadfCOgtPcK1HLo/4tXZFLABpB CHmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706241554; x=1706846354; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mN9urTWgOs5yxGqYWGcDWpJNj/mjOSJkCC13yHHIGOY=; b=XUGkcO2GndY0BbhyBu4ZonTR+J6ovjTGCQhJ//iiTENzCL9qlfdiiLLNXbA3142UZv jICJ2/llKy7JXdL3jTClQ/GwPr4bM0MFjZT721VAdDBb9rNE9wO2Pvm0fNagaJorvbpM 8BSm5tWdR2g5H2ccRpB+wysGa5WY4BjGwGbSAU4AVnPdY7SLmoD9SniAlBjlcRdVv1ng OPTZBT6jHlSOP3h+8bzsdL7rM419ceqNMMwsbytl1aLXr5uLq6ehdIDNzq4Ak+5BuA3U JhorNKqOdPqHAPzl6zqPrjFSMYcQo0zrppMggmlLTWVXtSD98jJn1L0YFpesgndcCRlu xdQA== X-Gm-Message-State: AOJu0Yz1BZSNXSipHVfoYHeNGeKolumytZ//8W21de/UViMQQJCCS/c1 SBkX3tZDPY0E8qBc0OpYAsszHJnEhcueylhwNBwPfhh0XCiWE6Rr X-Received: by 2002:a05:620a:29c7:b0:783:1f5b:9c5 with SMTP id s7-20020a05620a29c700b007831f5b09c5mr1185613qkp.80.1706241554190; Thu, 25 Jan 2024 19:59:14 -0800 (PST) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id m25-20020a05620a215900b0078325452a32sm212464qkm.28.2024.01.25.19.59.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 19:59:13 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id 6FD3F27C0060; Thu, 25 Jan 2024 22:59:13 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 25 Jan 2024 22:59:13 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeliedgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeegleejiedthedvheeggfejveefjeejkefgveffieeujefhueeigfegueeh geeggfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdei gedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfih igmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 25 Jan 2024 22:59:12 -0500 (EST) From: Boqun Feng To: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-doc@vger.kernel.org Cc: Jonathan Corbet , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Subject: [PATCH 2/8] doc: Make whatisRCU.rst note that spinlocks are RCU readers Date: Thu, 25 Jan 2024 19:58:05 -0800 Message-ID: <20240126035816.3129296-3-boqun.feng@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240126035816.3129296-1-boqun.feng@gmail.com> References: <20240126035816.3129296-1-boqun.feng@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Paul E. McKenney" In kernels built with CONFIG_PREEMPT_RT=n, spinlock critical sections are RCU readers because they disable preemption. However, they are also RCU readers in CONFIG_PREEMPT_RT=y because in that case the locking primitives contain rcu_read_lock() and rcu_read_unlock(). Therefore, upgrade whatisRCU.rst to document this non-obvious case. Signed-off-by: Paul E. McKenney --- Documentation/RCU/whatisRCU.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/RCU/whatisRCU.rst b/Documentation/RCU/whatisRCU.rst index 60ce02475142..246ce0d0b4d1 100644 --- a/Documentation/RCU/whatisRCU.rst +++ b/Documentation/RCU/whatisRCU.rst @@ -172,14 +172,25 @@ rcu_read_lock() critical section. Reference counts may be used in conjunction with RCU to maintain longer-term references to data structures. + Note that anything that disables bottom halves, preemption, + or interrupts also enters an RCU read-side critical section. + Acquiring a spinlock also enters an RCU read-side critical + sections, even for spinlocks that do not disable preemption, + as is the case in kernels built with CONFIG_PREEMPT_RT=y. + Sleeplocks do *not* enter RCU read-side critical sections. + rcu_read_unlock() ^^^^^^^^^^^^^^^^^ void rcu_read_unlock(void); This temporal primitives is used by a reader to inform the reclaimer that the reader is exiting an RCU read-side critical - section. Note that RCU read-side critical sections may be nested - and/or overlapping. + section. Anything that enables bottom halves, preemption, + or interrupts also exits an RCU read-side critical section. + Releasing a spinlock also exits an RCU read-side critical section. + + Note that RCU read-side critical sections may be nested and/or + overlapping. synchronize_rcu() ^^^^^^^^^^^^^^^^^ -- 2.43.0