Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp526394rwo; Fri, 21 Jul 2023 16:27:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlEoePH9lhqhOl8lA1E1fOj38jD2LyqQeb8mLt3J867qikkHfOC1xPQPrcAfSYjmX0jetyVH X-Received: by 2002:a05:6402:60a:b0:51d:d1af:df15 with SMTP id n10-20020a056402060a00b0051dd1afdf15mr2392546edv.23.1689982029468; Fri, 21 Jul 2023 16:27:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689982029; cv=none; d=google.com; s=arc-20160816; b=d42A7JArI8P7Ao+tyIwYOmGvv9CY+2/dK2yLC1ruw3qbP4zfKUPl/I/24VHRkt8K4L lTW6kARzK3ktXpVHk10WH31RmesaA0H5GPapW32XNCshL8oizcqfTPXvN13+YUqz0fE8 ZnjePJ+yj4swKsxHlBCn4CaZ4Nq3ZkgrevDcCpBvlAWChx4hKZURFSOLsZivz1GOdqC2 uj4BnFd6ziVCI9xoMazQckg7zr13Im3YrCKHpG+aOLfXJtEoE46hM91TY7PrB+EJn1nm zAH+G0jYSju+ARMzP6olwRqk96k8VvYz1DEzh5YtV4iUyE0qEOst0UupLFdzpxiQtiHS vzWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=fMKrU0p/0TsDMd/uIQ4dIVBdRMQEPVKghmu2/GXt040=; fh=IedS5I5vclAhV+CoXLhoqdm3pnuhPDKn/0v8laTcVII=; b=F0ShAOlfJu6r6kp1mXQ+MNPEBGi0mMMxa0NyYo9VsueSHf+BziPI/H33s61Sb97GSS nBrOB6cHteOSocdS802sOkLYBHxCtcpqbVXhYfgxIq/DzAJHbWVVflMjdGd7tm9NSOjZ THcpDRcJIXhI5036VXItUVLRDNx+OlbAUTJ3w06tNA5ptqraNdlGVKUkOTJK0RCGo7Rd nBAu88ZvQu9ZZsDACJKCP2RIKLrIWH7ulOL4km4bA7f1gbTqLBgTPjpv+IYE857eIgJs nGmJTMzS+G2929gR7wAtcEGsAfG8+IGfl0SsmTBAz3XCiYUeLYog6eMpZd8Qcxz0qiy5 vGew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q4puTUED; 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 b19-20020a05640202d300b0051e0c612208si2876436edx.546.2023.07.21.16.26.45; Fri, 21 Jul 2023 16:27:09 -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=q4puTUED; 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 S230330AbjGUWea (ORCPT + 99 others); Fri, 21 Jul 2023 18:34:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbjGUWe3 (ORCPT ); Fri, 21 Jul 2023 18:34:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD14B3583; Fri, 21 Jul 2023 15:34:28 -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 5BE5961DA8; Fri, 21 Jul 2023 22:34:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9E34C433C8; Fri, 21 Jul 2023 22:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689978867; bh=amtm4eN/GW9Th2XfpHJtyiophvhqrM44V8MCh9awRZw=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=q4puTUEDW0RsT7X4yMNkOgD5jCqxug/5WCqqBZkcYD4MyCC+psfmnstCWtJRZAOrh AaaMArDzMSa+UROyuJulApvn2XVqjXW4H3Ytp4ATj2TzVnA4tcjGPmOpoxkXrkzDMJ FHwO67Og0C4quuC1IpK2cRPlIhqR5hT6IKpvnOnvsmqke/YbWz9GxqDyl/WSS8n6yZ 9p7qx03L0Lh8r1UF1aMDYaFiDxW3vQmu85OPMawYMXnQIGZQCedFuRaxzq1ewdVeKm 9fENDTtsJ35Law+2qcs/+Je9Iieve+cq0TumAp8lf/sCNGjaz4S2X9Bw3r4TakQAUG 5SiAEsH+pnWyQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 4025ECE09E0; Fri, 21 Jul 2023 15:34:27 -0700 (PDT) Date: Fri, 21 Jul 2023 15:34:27 -0700 From: "Paul E. McKenney" To: Joe Perches Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Andy Whitcroft , Dwaipayan Ray , Lukas Bulwahn , Alexei Starovoitov , Daniel Borkmann , John Fastabend , bpf@vger.kernel.org Subject: Re: [PATCH rcu 5/5] checkpatch: Complain about unexpected uses of RCU Tasks Trace Message-ID: <3ef4021c-fceb-4b49-866b-400c505f2545@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20230717180454.1097714-5-paulmck@kernel.org> <04e74fd214a01bee0fb5ac690730cb386536cced.camel@perches.com> <8477fd32-38a5-4d66-8deb-a61b0e290df5@paulmck-laptop> <589412dd594b7efc618728fe68ad6c86f3c60878.camel@perches.com> <798959b0-b107-44c4-8262-075930ebfeaa@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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,URIBL_BLOCKED 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 On Thu, Jul 20, 2023 at 09:38:51PM -0700, Joe Perches wrote: > On Thu, 2023-07-20 at 20:56 -0700, Paul E. McKenney wrote: > > > > > > That works much better, thank you! I will update the patch on my > > > next rebase. > > > > As shown below. Is this what you had in mind? > [] > > commit 496aa3821b40459b107f4bbc14ca867daad21fb6 > > Author: Paul E. McKenney > > Date: Thu Jul 6 11:48:07 2023 -0700 > > > > checkpatch: Complain about unexpected uses of RCU Tasks Trace > > > > 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. > [] > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > [] > > @@ -7457,6 +7457,30 @@ sub process { > > } > > } > > > > +# Complain about RCU Tasks Trace used outside of BPF (and of course, RCU). > > + our $rcu_trace_funcs = qr{(?x: > > + rcu_read_lock_trace | > > + rcu_read_lock_trace_held | > > + rcu_read_unlock_trace | > > + call_rcu_tasks_trace | > > + synchronize_rcu_tasks_trace | > > + rcu_barrier_tasks_trace | > > + rcu_request_urgent_qs_task > > + )}; > > + our $rcu_trace_paths = qr{(?x: > > + kernel/bpf/ | > > + include/linux/bpf | > > + net/bpf/ | > > + kernel/rcu/ | > > + include/linux/rcu > > + )}; > > + if ($line =~ /\b$rcu_trace_funcs\s*\(/) { > > + if ($realfile !~ m@^$rcu_trace_paths@) { > > + WARN("RCU_TASKS_TRACE", > > + "use of RCU tasks trace is incorrect outside BPF or core RCU code\n" . $herecurr); > > Exactly yes. > > (though I still suggest a capture group to show the function like below) > > if ($line =~ /\b($rcu_trace_funcs)\s*\(/ && > $realfile !~ m{^$rcu_trace_paths}) { > WARN("RCU_TASKS_TRACE", > "use of RCU task trace '$1' is incorrect outside BPF or core RCU code\n" . $herecurr); > } That does seem to work! I will fold this change in on my next rebase. Thanx, Paul