Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp398598lqh; Tue, 7 May 2024 02:36:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWK3Fh8TTgpOreIhIqHkYdf56rAT9voIaes4/XlaYtneIuaHRVTsy1XxN4UNDYc/h9F8i5JzbhKsgEPCiPvXl9mdw1gdfFkF5FyaEdEGg== X-Google-Smtp-Source: AGHT+IFKWCMDAhJdAYK6LmwmhrkWuGh8f5yHThKSkkVr0ee9owsekQV0VQSbCmr3aW21SmNjKGWX X-Received: by 2002:a50:9f26:0:b0:56d:c91c:dfc2 with SMTP id b35-20020a509f26000000b0056dc91cdfc2mr8744940edf.31.1715074599257; Tue, 07 May 2024 02:36:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715074599; cv=pass; d=google.com; s=arc-20160816; b=cG9brNFv6rhGsGfpFtymgd3ex+P+Fl0vAnN0Imuot+X0WIpBoCZxMnjM1Dd5sEsQau eIgQjeggtuRLbeZPW1GQCjWRD9B3REDHFFgN4xJCQuL39yAUbvpFKxhhDq7IaFbFuW9q GNy4rOCoe4jZeeF4G4VcGhQCc0ALh7LP0bIdP442suQRn+nm4ACKed0CRIKieAAFoJWm ZpcmGffk6Bnesnn6zph+wmEIALmOTbTA7a1JOGVxctMhqNJjQ5x2+39Ix9AfPkd9VaEW 6eSWloUzXncPtax/W63JPsLsmeqagieUjQXCjhdFCzGugR078XggxEquzN6b/eJdroqE v9Dg== 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:dkim-signature; bh=tHQ3wThlCa+tmPm7RaR+qFcrkGfD7gzEvoOA5PrmsZ8=; fh=j2GRMDrGIO+7hDH4kq9drssYY4/wIgu6Dso3WGNIBDA=; b=xC68kePr6KXcpWVJ3Ck6nfp1Ajc5KzhMDNZnmqGga6KpezFpj8t6fET5BcpO6WuFMh mDQhhzomvhBVJ+jlIfEi8PKaEHKPitIiFCXT0obdbCx3iRACKrilAgEbjo0vvO8H1BgI AL/DK9Q+rIGyLb/cMDXLvOLc9qlz0GOOxKMY1yB3Dl9OxqPJQOmSgtd/rU9ZUTLZKMGU 4iZr/u8J90STxY2OqvjVk8C9j7Ajc8xl3+lFzROJtZ/YAKfD5OyNCHdrTv5I/82gq/yC L7LABEO6X7bH7XVIwwOfyngwOGkj5h+o7mxkYcYDRVW/7Hc11YrhqpFEXnahvddKcchK nGvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Qn9V5A0j; 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-170962-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170962-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a10-20020a05640233ca00b005729f67af3fsi5977516edc.190.2024.05.07.02.36.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 02:36:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170962-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Qn9V5A0j; 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-170962-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170962-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 043171F25C96 for ; Tue, 7 May 2024 09:36:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C713C1509A5; Tue, 7 May 2024 09:35:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qn9V5A0j" Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.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 40DE114E2F1; Tue, 7 May 2024 09:35:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715074539; cv=none; b=iAUEYkj4r9Wdg/6whBMmefgoSDVttfoA5gfB/K/qH9mbxC76dVOWggg0cySJKR/GhBXDEiws/zYef37nujA/szWRSMilG3M/kaGRtj1ZiaXBboUnonT9Oq5a2jAgepIJdFdH+X27Hzi2Df1QCOZZG7uHK2/lyg8NxFPYdgixykU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715074539; c=relaxed/simple; bh=+/Wzimi9IDd0AOad7JCOBMX+aJPeFaceFPRoaZUd6JQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZCWochjwwZwz9NztqWraIvMIuGg4l6idzMjg55a2fduCr/Z8Z1pg++R8NiPu+kSDJP5FZDpSJrB9qmijuq2h8K2u707NSmfl5RhXPjjFqoXgaz5XGzkaHAkgenyI97Jr3z8KKyk/vRrxCVFEA2qPRwpf5XnuCayIEZb7TqZ04Zs= 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=Qn9V5A0j; arc=none smtp.client-ip=209.85.208.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-lj1-f172.google.com with SMTP id 38308e7fff4ca-2db101c11beso36565341fa.0; Tue, 07 May 2024 02:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715074536; x=1715679336; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tHQ3wThlCa+tmPm7RaR+qFcrkGfD7gzEvoOA5PrmsZ8=; b=Qn9V5A0jesQZGCTXuVJHyqNGw/91oEXDjIgBz/SvXiZ9YgEOFnZ3GLIgWUxQi7Mkgi IdLpfkgpBsad/tqUYMYMscuLuqDTdvb7fdrjzWPazXJRw8/8nPYNrvq4GJKoHRzihu3p 6GT23cNQY1Qloec5lS22UXhNQmVsQK9OIAeaz63upP/VZZg4tDalQ7glnDbRvqTCRE19 LgNTPKaFuKycCmarguyQmGTyPMveC/07wz3cnsSV9wQ6qoxqgmO+I95gpdG+pnS3H/Ta 1UvVfnvx7a7iGATudsuL3BwehWn+Z5ZSKMm+3ERzR1rZkLWoYTeWfRr2mUGwCRRXTBv9 e4rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715074536; x=1715679336; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tHQ3wThlCa+tmPm7RaR+qFcrkGfD7gzEvoOA5PrmsZ8=; b=CXjPGBIQoCbgcXn7xVJu/XpAvOaif58H4PK87Gi+TlMk+289DJ2m2H2T8PfzgQX/jf MWoVyZVAozg4fQz4xO+HUf25/DnXY0nKqbu2SMCs3ehSnax+BU4kkiVeQZ9qe+lPo+8j ZON+W9eNMSIf4lo2ZzU1fEMfc4j5sS0KT9pEnQOy9mGkFV3KzBvDi+7G4Cyjd8m/FV2M QD7dE5nwM4AGlDdlX2KwSmkgtWFYM0HjqbqN+2jjGvFTI3hppykGFKjUZDNIcKpwyvii +heNTR9DFhrOCb8KsZ+mnxAo8GemcAJc+LN0vbWlajIZKC1jKaOLxM2X9MPmWSZ2Tetd njvg== X-Forwarded-Encrypted: i=1; AJvYcCX1J+RbDqD9+y0rw6COw06z8VEGi5ub7/EWn1T2VMLrTIvxOZNv7rUOmg4wRnynzazsr0KYF1gpcp6nrOKVq0xCtSNO6pHdnhH/QlECOwA57LgK/crFnk7OpFUgi49tTmGg+Dzp X-Gm-Message-State: AOJu0Yzth5zG1sWevcu579UGoEjy0q0draT/MwMZmMTrZRUU3gB6xS3W GJIEflqCsXSViVMphY3hFMPV769ryHnG5LsqkegdcXH/mXFd3OFz X-Received: by 2002:a2e:9585:0:b0:2df:b800:5bff with SMTP id w5-20020a2e9585000000b002dfb8005bffmr8142337ljh.7.1715074536291; Tue, 07 May 2024 02:35:36 -0700 (PDT) Received: from pc638.lan (host-185-121-47-193.sydskane.nu. [185.121.47.193]) by smtp.gmail.com with ESMTPSA id t18-20020a2e9d12000000b002e29c50c4dcsm1335473lji.27.2024.05.07.02.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 02:35:35 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: "Paul E . McKenney" Cc: RCU , Neeraj upadhyay , Boqun Feng , Hillf Danton , Joel Fernandes , LKML , Uladzislau Rezki , Oleksiy Avramchenko , Frederic Weisbecker , Eric Dumazet , Jakub Kicinski , "David S. Miller" , Yan Zhai , netdev@vger.kernel.org Subject: [PATCH 03/48] rcu: Add lockdep checks and kernel-doc header to rcu_softirq_qs() Date: Tue, 7 May 2024 11:34:45 +0200 Message-Id: <20240507093530.3043-4-urezki@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240507093530.3043-1-urezki@gmail.com> References: <20240507093530.3043-1-urezki@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" There is some indications that rcu_softirq_qs() might be more generally used than anticipated. This commit therefore adds some lockdep assertions and some cautionary tales in a new kernel-doc header. Link: https://lore.kernel.org/all/Zd4DXTyCf17lcTfq@debian.debian/ Signed-off-by: Paul E. McKenney Cc: Eric Dumazet Cc: Jakub Kicinski Cc: "David S. Miller" Cc: Yan Zhai Cc: Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index d9642dd06c25..2795a1457acf 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -240,8 +240,36 @@ static long rcu_get_n_cbs_cpu(int cpu) return 0; } +/** + * rcu_softirq_qs - Provide a set of RCU quiescent states in softirq processing + * + * Mark a quiescent state for RCU, Tasks RCU, and Tasks Trace RCU. + * This is a special-purpose function to be used in the softirq + * infrastructure and perhaps the occasional long-running softirq + * handler. + * + * Note that from RCU's viewpoint, a call to rcu_softirq_qs() is + * equivalent to momentarily completely enabling preemption. For + * example, given this code:: + * + * local_bh_disable(); + * do_something(); + * rcu_softirq_qs(); // A + * do_something_else(); + * local_bh_enable(); // B + * + * A call to synchronize_rcu() that began concurrently with the + * call to do_something() would be guaranteed to wait only until + * execution reached statement A. Without that rcu_softirq_qs(), + * that same synchronize_rcu() would instead be guaranteed to wait + * until execution reached statement B. + */ void rcu_softirq_qs(void) { + RCU_LOCKDEP_WARN(lock_is_held(&rcu_bh_lock_map) || + lock_is_held(&rcu_lock_map) || + lock_is_held(&rcu_sched_lock_map), + "Illegal rcu_softirq_qs() in RCU read-side critical section"); rcu_qs(); rcu_preempt_deferred_qs(current); rcu_tasks_qs(current, false); -- 2.39.2