Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6142062rwp; Mon, 17 Jul 2023 16:00:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlHkss5tTx2pnBBhVnbKTYftsthqntfbiaq82vniqGxzK8OOPAdPExJof6TKF6D01K/IlS/i X-Received: by 2002:a17:907:1186:b0:991:e12e:9858 with SMTP id uz6-20020a170907118600b00991e12e9858mr11454682ejb.64.1689634854658; Mon, 17 Jul 2023 16:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689634854; cv=none; d=google.com; s=arc-20160816; b=zMuoDnsedbke62jvwYcGNJxaCFw3tNvb5NqJ6IyuULDgd4E28sOrHZ2gkylhT+Viyd uzePljJpHreaoBMjB7sgS19HIkJY3qzmGF3GIAURB10ryoMVe+bRrundq2QIcL+bmfJa agPTYSej/itnv8+4ue0qfsN/MApeHf8xmFIDppDEkuVOIK30cA0ouGxlYtuSbIrwQB0M iKFLhJhtzBpW9vRBcXgbVmCOxEl8MYuVjnQoVxfQ+QjO7+Yu/4KHqgHBWY60Q+8la6o4 5/y1pSRXUW7CyYY5azTYxogd91FzsO2BYeUO968AezZGL6GyAKVFQfGParyP7vWF/wlS k4Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=iKdZCxORyeTbFIueXKo/N3IgsK5hr4zMX2k2vAE0A38=; fh=n3W4F/d39+AaEfnlNxClWD8nKQZ4LdSFAygdPJUADgs=; b=RHG13BjPWikOifB9h0f2g7q8vG3DJiU837JoP+Rzrx407fxgMu5NP+Ado0kaGP4PvJ cKZ1y+6ktRtoyXwXLfjZe3uJJQ+eD+xUo2KM8V8ZDwc3XoW/fveKuJ5nHYW5Ppx9fewv alVB7QSauyBut+LbaTH9XfnFkPf6rwyPlsaICkvKK8wluR5f4nWfPy+zenWz1bn7hHr2 5Zvt4hVewhmjE3Dsl4J8H0Qb7V9BvkznoeKZVTF2OM782QuF4lGL+ZTvXk0lht7Jk2Ak lim/jmF+CbtrtyCuBeEuYIXNnIXtbefaEaGueQvU8pkLh0Pef+lVF9smccHgfwpHeSOn DuEg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q10-20020a170906540a00b00992b54ad681si266466ejo.773.2023.07.17.16.00.30; Mon, 17 Jul 2023 16:00:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230368AbjGQWeZ convert rfc822-to-8bit (ORCPT + 99 others); Mon, 17 Jul 2023 18:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbjGQWeZ (ORCPT ); Mon, 17 Jul 2023 18:34:25 -0400 Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B23FB5 for ; Mon, 17 Jul 2023 15:34:23 -0700 (PDT) Received: from omf07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D40B71A05CE; Mon, 17 Jul 2023 22:34:19 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf07.hostedemail.com (Postfix) with ESMTPA id 68AEC2002D; Mon, 17 Jul 2023 22:34:15 +0000 (UTC) Message-ID: <04e74fd214a01bee0fb5ac690730cb386536cced.camel@perches.com> Subject: Re: [PATCH rcu 5/5] checkpatch: Complain about unexpected uses of RCU Tasks Trace From: Joe Perches To: "Paul E. McKenney" , rcu@vger.kernel.org Cc: 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 Date: Mon, 17 Jul 2023 15:34:14 -0700 In-Reply-To: <20230717180454.1097714-5-paulmck@kernel.org> References: <20230717180454.1097714-5-paulmck@kernel.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Rspamd-Queue-Id: 68AEC2002D X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Rspamd-Server: rspamout02 X-Stat-Signature: ydqcdtaadgq3km87eotg8j8pd3mh6b44 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX199v8b1YJAszH97EHPUzWOIn/skmRIxrWs= X-HE-Tag: 1689633255-124912 X-HE-Meta: U2FsdGVkX18q26xURpW9+7yIL42BuR4Zkw3canI6Q+OaBoEjxOlN4sWO2r2VSPNWSpmqVT2U5xjk7hqFilI04qYOR0SfI2y77lfk9KiC3ksoCTNcalQJLUoOAbm22blsjRiMqKOOFrUtlbPz6p8+1d3RDEZbL/cNxlrRGIfcABTMjv3YW1yQx0HxurQICyXOXY9236m5b8jXkMAeP0DYKYxDMi65GeHRr0wfvh9DCQC0GClucM3KkPEVsRmbrk7JhWDR+6wyGr+fOq244GpBh558PLQ5RW7Lww8erKmNSkQT7MZpMM4KYity//XXO3qESACljOpJ+E3tdzooYjEbv8kH5JOZyxBEuVOEoeG832GISOUxT7dNW0VHoYb0GJ3O0Dfry58QH0V6GhebW2QhLmXhRMKWe3CIv9dyqT1ngG8zSlaC0dQSWlqxxIoWa3U7y2SNQ0Y7BcNEzDK9dcTvxzLAnjtAsIMeLRs+sbYfkB4NOOwrQ9nSYcmJO+ZB5L1M6UpJzh3c0UzxOi/2KW/ZI41TxOlm/8dRVG1Z+KpHLl8U10glR/PgjHnG7cFTil2GKT2UWE5WrRo= 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 Mon, 2023-07-17 at 11:04 -0700, Paul E. McKenney wrote: > 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 [] > @@ -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@) { Functions and paths like these tend to be accreted. Please use a variable or 2 like: 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/bfp/ | include/linux/bpf | net/bpf/ | kernel/rcu/ | include/linux/rcu )}; ... if ($line =~ /\b($rcu_trace_funcs)\s*\(/ && $realfile !~ m{^$rcu_trace_paths}) { WARN("RCU_TASKS_TRACE", "use of RCU tasks trace '$1' is incorrect outside BPF or core RCU code\n" . $herecurr); } }