Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5895687rwp; Mon, 17 Jul 2023 11:07:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlEMVEhHOG5Nfzyu3KDAkYSkDePAMYLmaokxqwevfDOcBzAM0RYrpZ4jf8e7I4C5s37UrMVH X-Received: by 2002:a17:902:ab8e:b0:1b9:de67:286f with SMTP id f14-20020a170902ab8e00b001b9de67286fmr12724426plr.49.1689617254716; Mon, 17 Jul 2023 11:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689617254; cv=none; d=google.com; s=arc-20160816; b=AOSAU9dqpStuOsS8h8ELLmsVyUzkOu5EVBKFhn3tv1cfwBwbmt6kTJI5ReTCo74BMc xK2ZrTxXqy0z4G6an9SWH2/Vu57bCtRL8YM0KQMxF4YmHoftwJ4hrZ8daGpubB26SkSF u6YSphsBIE/qL17jfUOEPlNPSVrRc5yu1+9SimzPosTxsVwblWDZj4YQKHhSnlQJADIY fKIcVJily60zOq68OLxNcwJWEQ+2+r6pH/s0XSLmDnzTXH5xHtWHYzkyFq3FtjwD+Q01 MSB9W7P1eIK1GYipN/xMcuf3LW98FhqxT6fUNbx0sYH9pIYs5eOERfYnHiI4bX1ZPRDp almQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LUu8yPL+TihtaK3YE73m0ctCDqTauhwQZ9E1tuEMyWU=; fh=eLXbMm+eGRAZkdfxShUD1Q5QJ3hk2RPTnaEqoab7MyI=; b=WLa+VaNNbL4zz8aRrZS8G6EbyOA16Bg9zs0G3lZwiQIo5H1mTR0qGL9YzMDIxoNwU6 eK31EjKgNoqojGLP3ECdq7eyDzbotMJ7Dv/ng1WPT5HYyyqXV/H7cq3aBsAqjDeP3olB f3XDCdzjpWA0dSx04CpnaDMs+D1P6Uo8Gb9G/C5Om+DJsLJAk0ghVCbV7x7BSw1iVE8Z xeJx+znKETRgI4zReB5tNGL4cuK7nXR/eNNK5nG3YRDOmHfqLxhPohTWjZqMLNpDNvzD mUGa18gOPH3Ze8xhi0lkxOwxxx2nEnrIoKfDyXKq0O4izVtLrO+O0Myrj5Cp4Qbo3mNN GPrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cYt2oIUY; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t7-20020a17090340c700b001b53a3fbcc3si188232pld.328.2023.07.17.11.07.21; Mon, 17 Jul 2023 11:07:34 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=cYt2oIUY; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231423AbjGQSFY (ORCPT + 99 others); Mon, 17 Jul 2023 14:05:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231263AbjGQSFJ (ORCPT ); Mon, 17 Jul 2023 14:05:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F02401BE1; Mon, 17 Jul 2023 11:04:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 45E44611D5; Mon, 17 Jul 2023 18:04:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2388C433CC; Mon, 17 Jul 2023 18:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689617095; bh=z5xJPNvzuFRjo2lR/l/wLkVKNv1SHd09S5ncMfb7TjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cYt2oIUYUT5pC68a8AdfGvE7WCB9HYuDQCTvgQXOZYLpS4p1Hxh4GFFaGy7Iuj2AT MAoo0tdMoFMV264r7XQFcDWalXuQqA/Tg2hd3g1obZ9k+DGOkOHT4bEEeyW4Usvy8Q PLAJcrOLgPZb9m40+DnRS7yEFB6BL5wcLYNYsfLen+9EpHRfxVZq36bPsRKOHlsMnK 1bFVAiFBvrIA8UF17g6tw6Xw40hQGAN+4PceBM2Sx0egUp+QaJ9zs4OGrol7eA2mnG qNbZ0je4cj+eUqLh/tkOKAzZYlVun9e2B62ePPtJh2RnrmbykNJX46G+DIPj/86bhX 03iiHStrPifgQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 5ED95CE0902; Mon, 17 Jul 2023 11:04:55 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Alexei Starovoitov , Daniel Borkmann , John Fastabend , bpf@vger.kernel.org Subject: [PATCH rcu 5/5] checkpatch: Complain about unexpected uses of RCU Tasks Trace Date: Mon, 17 Jul 2023 11:04:54 -0700 Message-Id: <20230717180454.1097714-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 RCU Tasks Trace is quite specialized, having been created specifically for sleepable BPF programs. Because it allows general blocking within readers, any new use of RCU Tasks Trace must take current use cases into account. Therefore, update checkpatch.pl to complain about use of any of the RCU Tasks Trace API members outside of BPF and outside of RCU itself. Cc: Andy Whitcroft (maintainer:CHECKPATCH) Cc: Joe Perches (maintainer:CHECKPATCH) Cc: Dwaipayan Ray (reviewer:CHECKPATCH) Cc: Lukas Bulwahn Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: John Fastabend Cc: Signed-off-by: Paul E. McKenney --- scripts/checkpatch.pl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 880fde13d9b8..24bab980bc6f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -7457,6 +7457,24 @@ sub process { } } +# Complain about RCU Tasks Trace used outside of BPF (and of course, RCU). + if ($line =~ /\brcu_read_lock_trace\s*\(/ || + $line =~ /\brcu_read_lock_trace_held\s*\(/ || + $line =~ /\brcu_read_unlock_trace\s*\(/ || + $line =~ /\bcall_rcu_tasks_trace\s*\(/ || + $line =~ /\bsynchronize_rcu_tasks_trace\s*\(/ || + $line =~ /\brcu_barrier_tasks_trace\s*\(/ || + $line =~ /\brcu_request_urgent_qs_task\s*\(/) { + if ($realfile !~ m@^kernel/bpf@ && + $realfile !~ m@^include/linux/bpf@ && + $realfile !~ m@^net/bpf@ && + $realfile !~ m@^kernel/rcu@ && + $realfile !~ m@^include/linux/rcu@) { + WARN("RCU_TASKS_TRACE", + "use of RCU tasks trace is incorrect outside BPF or core RCU code\n" . $herecurr); + } + } + # check for lockdep_set_novalidate_class if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ || $line =~ /__lockdep_no_validate__\s*\)/ ) { -- 2.40.1