Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1969277rdb; Tue, 3 Oct 2023 06:45:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFAgr1B8JTF5kwjw3AFTes/wa8qnx389TK4FEMBY33h238EbZko0SoS3Yf9rYF3UUA/dCp X-Received: by 2002:a05:6a00:17a3:b0:690:28d0:b7b3 with SMTP id s35-20020a056a0017a300b0069028d0b7b3mr16914233pfg.13.1696340724437; Tue, 03 Oct 2023 06:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696340724; cv=none; d=google.com; s=arc-20160816; b=GYwtEcvkHYAwMSv/pp2rD30zuNhfOR1snik3c7vIGuB4P2eVngdGd4RI1HgoH96e0g 6kt19Xv4tLL3iT3umWi2ank6M+gqwMaDM2kYbBv7fh0KFM02Xi+Z8Xk2CHYh4deAV+a+ C7ULxBAHYMe5rbPUAmecbOHWNdX7zTbOxUBoztDq6rRnqk+I3LLPmYyCr+SbEHAZBYKh 4rYcKiJFju/iCe8vsmVJesZgBxE049PrUZ5ht7amIPQlh/KKIlPhoLx8h6ti0d78AZpc VzSUzpKrpXOe7m7yquuwTkUfVVxWIwDpSXfkhtDozYde1wrVu+K1yK3Uxyr/qYD8552h hB2g== 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=/r76s25eZGRIK1moB4/q8/Q7DWGAuk1PUGOtDe5VTP8=; fh=M0FdwxzQOlRlN37tS//bGEyDFTI04Xlr3o5hhLzahhQ=; b=InUD2/V/5skXpaeGDEGyxF1NENCUtPoc0we7L7gjRcY3gGSBaLXtCAifSA8X63BiIf aBeFnfUJ5zjgIFEZPCJwcp9zAAWF3Zk0GY1d5RakByd67zPgZoRsbnKhy1qGS6Nh51OH UfKp6U8jaUjUNl/1tyGwNJEIrxG9ruyGtDRRNRasjoL7D7mr25ytoF0SwBkAKOW2p5F0 AIknsz66p1QhRP9LGzPtYtNe71Jntj3kac9kZuRnZ1i7x+y5RmAzcnjShYAEH6kCR65Z a0xR3ALqPQkk89JlTWeKM66VHN1gokoa3JaALKe+xBU7GQDyxmCuGtTdu3UsKdfLKxTk ns4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AN+1dPKR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id b22-20020a056a000a9600b0068e48477befsi1579432pfl.211.2023.10.03.06.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 06:45:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AN+1dPKR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 79F3A806E3C9; Tue, 3 Oct 2023 06:45:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232284AbjJCNoy (ORCPT + 99 others); Tue, 3 Oct 2023 09:44:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232137AbjJCNoy (ORCPT ); Tue, 3 Oct 2023 09:44:54 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8200EA9 for ; Tue, 3 Oct 2023 06:44:51 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EDC2C433C8; Tue, 3 Oct 2023 13:44:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696340691; bh=aAH2goKSo92Tg7G8KsAwfY3FaO2dVx0hF4I/byTCcnc=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=AN+1dPKRLCVoxy97fSO5Ks+2VHfyfc2VxACUzs/UvVaJYJBF709jw70N3CmVokyHm 1dEkUwIQz4KCawfSRC6Xla8Z6d95e3bqKzVo9Wm3P/8BrUMG+QhO7blcFfoCW9t/uO v8/PgpYfbZttbpKijoQNEQcyDZC5ariD3pt8GGO7iWjAsx5k8bkythBoSK2NXTEHYj d5h5Ya2C7JV3YYrLsiDc+3t8m9DGrzxMrNttEEs/Sblb1hDdCe2HtLIzdsRlpfHMhg KgbIS6Y8LkHNcn1tmMrBgx/xFwDBgtuKc1Ekqmy+ubqgrVxxWo27IAGrJJs68TGEVv rc3NwdQqJVgrQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 9E5FFCE1143; Tue, 3 Oct 2023 06:44:50 -0700 (PDT) Date: Tue, 3 Oct 2023 06:44:50 -0700 From: "Paul E. McKenney" To: Steven Rostedt Cc: Mathieu Desnoyers , linux-kernel@vger.kernel.org, Michael Jeanson , Peter Zijlstra , Alexei Starovoitov , Yonghong Song , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , bpf@vger.kernel.org, Joel Fernandes Subject: Re: [RFC PATCH v3 1/5] tracing: Introduce faultable tracepoints (v3) Message-ID: <5d0771e9-332c-42cd-acf3-53d46bb691f3@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20231002202531.3160-1-mathieu.desnoyers@efficios.com> <20231002202531.3160-2-mathieu.desnoyers@efficios.com> <20231002191023.6175294d@gandalf.local.home> <97c559c9-51cf-415c-8b0b-39eba47b8898@paulmck-laptop> <20231002211936.5948253e@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231002211936.5948253e@gandalf.local.home> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 03 Oct 2023 06:45:04 -0700 (PDT) On Mon, Oct 02, 2023 at 09:19:36PM -0400, Steven Rostedt wrote: > On Mon, 2 Oct 2023 17:14:39 -0700 > "Paul E. McKenney" wrote: > > > On Mon, Oct 02, 2023 at 07:10:23PM -0400, Steven Rostedt wrote: > > > On Mon, 2 Oct 2023 16:25:27 -0400 > > > Mathieu Desnoyers wrote: > > > > > > > @@ -202,8 +198,12 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) > > > > if (WARN_ON_ONCE(RCUIDLE_COND(rcuidle))) \ > > > > return; \ > > > > \ > > > > - /* keep srcu and sched-rcu usage consistent */ \ > > > > - preempt_disable_notrace(); \ > > > > + if (mayfault) { \ > > > > + rcu_read_lock_trace(); \ > > > > > > I thought rcu_trace was for the case that a task can not voluntarily call > > > schedule. If this tracepoint tries to read user space memory that isn't > > > paged in, and faults, can't the faulting logic call schedule and break this > > > requirement? > > > > Well, additional new uses of rcu_read_lock_trace() do bear close scrutiny, > > but RCU Tasks Trace readers are permitted to block for page faults. > > The BPF folks already use it for this purpose, so this should be OK. > > (If for some unknown-to-me reason it isn't, I am sure that Alexei, > > who is on CC, will not suffer in silence.) > > > > One way of thinking of RCU Tasks Trace is as a form of SRCU with > > lightweight readers. Except that, unlike SRCU, there is only one global > > RCU Tasks Trace. This means that all RCU Tasks Trace users need to keep > > each other informed, because one users' unruly readers will affect all > > RCU Tasks Trace users. > > > > But given that the BPF folks already have page faults in RCU Tasks Trace > > readers, this one should be OK. > > Then I think we should update the documentation. > > From: Documentation/RCU/checklist.rst: > > If the updater uses call_rcu_tasks() or synchronize_rcu_tasks(), > then the readers must refrain from executing voluntary > context switches, that is, from blocking. If the updater uses > call_rcu_tasks_trace() or synchronize_rcu_tasks_trace(), then > the corresponding readers must use rcu_read_lock_trace() and > rcu_read_unlock_trace(). If an updater uses call_rcu_tasks_rude() > or synchronize_rcu_tasks_rude(), then the corresponding readers > must use anything that disables preemption, for example, > preempt_disable() and preempt_enable(). > > Because it's all one paragraph it's a bit confusing to know what uses what. > Perhaps it should be broken up a bit more? > > If the updater uses call_rcu_tasks() or synchronize_rcu_tasks(), > then the readers must refrain from executing voluntary > context switches, that is, from blocking. > > If the updater uses call_rcu_tasks_trace() or > synchronize_rcu_tasks_trace(), then the corresponding readers must > use rcu_read_lock_trace() and rcu_read_unlock_trace(). > > If an updater uses call_rcu_tasks_rude() or synchronize_rcu_tasks_rude(), > then the corresponding readers must use anything that disables > preemption, for example, preempt_disable() and preempt_enable(). > > That way it is clear what uses what, as I read the original paragraph a > couple of times and could have sworn that rcu_read_lock_trace() required > tasks to not block. That would work for me. Would you like to send a patch, or would you rather we made the adjustments? Thanx, Paul