Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1671701rdb; Mon, 2 Oct 2023 18:18:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5B255aOp4eIaxC3PxEKHLNCd4WUbXQlHovgy4wOZVDBgYMR8PnuuCzmxu7VjS5T1u32Y/ X-Received: by 2002:a17:90a:2c46:b0:276:cd68:6081 with SMTP id p6-20020a17090a2c4600b00276cd686081mr10246524pjm.40.1696295930425; Mon, 02 Oct 2023 18:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696295930; cv=none; d=google.com; s=arc-20160816; b=uy5OtPqTslQ2cFxchNYzGs4/tKu9jpUe5nC8hyjCisMfbjeDCPZ1P8/3M0w3PkP1rY PDZQp5geriBzfuw5W5YCq6tKgHHd3GwSK1QXzTiWgcZmFJcyH8qijfaIKpEh+AUu5l0O ruJGJ6kRAPN3ABs/VQ7qxNFaogGaPAg+Hpw5p0Phd4ex2nxwiqe34Pl/AXnv7FE+xKYk sCi5FObgEF7uTI8Clv8jS48lvim5llSqU13KDQUou84BvlHXde2CsKdZkw/Wx9yFQWmJ 1e1bBBGCBC661iTwFgo4Yf+S+FINUboSBRGfaUpsP2PcL3S9ThQmf5TuCq5kaPyMBQ2H 63dA== 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:subject:cc:to:from:date; bh=nnU4iO8qA17VeZ3OIPf0AMe4YQIInRjOzMX4+OhTvC8=; fh=oZDm1xtFxu45cSuGo3PARkaoSLechv+u4NnnysE2mhE=; b=APFYlJ3Wz8aS9Utoi4n36C+TVVLOVtG/a58AIxLY5Syt69hn6KUn/uWAiLnM2k8r9s 3RDJU+OevBOVFn9Q8MXycnn2WZ6ycg+8X1E6jb4TWbf3awvqTywh6kX0XyqZTqGkjeSV VOk23SHyjNsH9maEdzEEKVzwVdPQZ7L41Xt3jYdvbQ3USK7wNzlFjrscwoihELYxHe9E C6IMu6NfoDTfJHUN0mRqpWXnj6BoQ8nsK0sF3OzLEOCNy0pogrhtGJzV1+dG2DGBY7rq RsZbrkEhj43t07OpTxauBTkswHAjqAQujd4uuL5v/zz0j+QpIuU0cr+e72Mt794uL9dI 3IgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id t21-20020a170902dcd500b001b9ffdd9488si197444pll.624.2023.10.02.18.18.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 18:18:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 92BAE8028F9C; Mon, 2 Oct 2023 18:18:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238955AbjJCBSl (ORCPT + 99 others); Mon, 2 Oct 2023 21:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238922AbjJCBSk (ORCPT ); Mon, 2 Oct 2023 21:18:40 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C33F2B8 for ; Mon, 2 Oct 2023 18:18:37 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0339C433C7; Tue, 3 Oct 2023 01:18:35 +0000 (UTC) Date: Mon, 2 Oct 2023 21:19:36 -0400 From: Steven Rostedt To: "Paul E. McKenney" 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: <20231002211936.5948253e@gandalf.local.home> In-Reply-To: <97c559c9-51cf-415c-8b0b-39eba47b8898@paulmck-laptop> 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> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, 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 agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 02 Oct 2023 18:18:47 -0700 (PDT) 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. -- Steve