From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BA6AC982C3 for ; Wed, 16 Sep 2026 14:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dRzGIp8BZC3HTfXO+TCW/m41vLXjfhf9X+2OCoM1kLM=; b=1N4Ah2kLaTQx8SPAt2iU9y6mSd rzBFJMhzWofxZstvXHfiJfgLp+oopmdS92Gr6fKw5F2/VdQIygpj+PcepkPS8CJISrSuG6sfl02ZA DGZ+bB2mopp9r+F1Gqd6TLRU9x6GaEn7jhe0uyQS2aqrvNGliyvbQCY1zAa/93yNj6b8jmY5MrOln dK0gD14PqvfWaN9vmB8XZxQNUgWZqoiQHcGPdLcVUIbWRxb7iNbcCdPKUCzr6/Ag1gNYeoPWGsoLs g1Nu5/gnYiTZar5qUPNRrqynWKrUpVdNZ6Lwr2dV9O7aLpD7bmHMy+sF4vd7eV1kp3+CFD8BWd+gW b7fhi3qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x6qjs-00000009RK6-1J3D; Wed, 16 Sep 2026 14:35:56 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x6qjq-00000009RIs-3nLc for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2026 14:35:55 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 28FCC60008; Wed, 16 Sep 2026 14:35:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 284711F00893; Wed, 16 Sep 2026 14:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789569353; bh=dRzGIp8BZC3HTfXO+TCW/m41vLXjfhf9X+2OCoM1kLM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=FA5kMueDfHQy6e7vnoQFHpYhwZpX7iem27nD89IbZJX2O9EUmarZgs1YNP4KAYjAK QifdGNffl2hCcco37lyGuH3hnSh6qg+tY3yJtb3RWolk50ac+Z7PmhikxXXLCDUc3l CnuwVmM9f3JUI5Ylx7XQYhbg4O78htzc8S2XmH7oHC9F2WbMqRXZ2mLRizxW4+c6IK wLhbL7RGjN9QRqvaBL7HmI70fgIgjcWABsFnNBBIbszSofHGVMPtQmr61SstIQUgeI nEaLyqYTCaYzHG7enXG6FfKdw6evl82vQs3bPs+7qBV93sYtEKnTZ4HL2C4CoAyN71 tmAdxw/yHaJMw== Date: Wed, 16 Sep 2026 16:35:50 +0200 From: Frederic Weisbecker To: "Paul E. McKenney" Cc: Josef Bacik , Neeraj Upadhyay , Joel Fernandes , Boqun Feng , Thomas Gleixner , Peter Zijlstra , Steven Rostedt , Masami Hiramatsu , Mark Rutland , Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , x86@kernel.org, Catalin Marinas , Will Deacon , Puranjay Mohan , Xu Kuohai , Andy Lutomirski , Josh Triplett , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Juergen Gross , Luis Chamberlain , Ihor Solodrai , linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, xen-devel@lists.xenproject.org Subject: Re: [PATCH RFC v3 03/13] rcu-tasks: Add a Tasks RCU implementation for reader-marked trampolines Message-ID: References: <20260915-b4-rcu-tasks-preempt-qs-v3-0-0ad30c4c5ee7@toxicpanda.com> <20260915-b4-rcu-tasks-preempt-qs-v3-3-0ad30c4c5ee7@toxicpanda.com> <91687748-0781-4133-baed-43cf82f35ff5@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <91687748-0781-4133-baed-43cf82f35ff5@paulmck-laptop> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Le Wed, Sep 16, 2026 at 07:26:35AM -0700, Paul E. McKenney a écrit : > On Wed, Sep 16, 2026 at 02:40:20PM +0200, Frederic Weisbecker wrote: > > Le Tue, Sep 15, 2026 at 04:56:41PM -0700, Paul E. McKenney a écrit : > > > > Alternatively the approach could be generalized to vanilla RCU, it could be > > > > possible to define a .text.rcu_no_qs section within which code running is > > > > considered as an RCU reader (with a pause while on the explicit RCU tasks > > > > section). It would be forbidden to voluntary sleep inside > > > > and to put explicit preemption points (CONFIG_PROVE_RCU could report misuses). > > > > > > > > Based on IP, RCU could consider those interrupted section as readers. This would > > > > require PREEMPT_RCU though. > > > > > > > > And then synchronize_rcu() would do the 1, 2, 4 jobs. > > > > > > If I am following correctly (ha!), sleepable BPF programs rule out use > > > of RCU in this manner. > > > > > > But your point is nevertheless valid, in that SRCU could be used. > > > And because rcu_read_lock_trace() is a thin wrapper around SRCU-fast, we > > > *might* be able to instead use rcu_read_lock_tasks_trace(), which would > > > skip the task-struct increment and decrement, saving a few instructions. > > > Then, instead of waiting for each task's counter to go to zero, instead > > > just invoke synchronize_rcu_tasks_trace(). > > > > > > Which is pretty close to what Josef is proposing, just with the new RCU > > > Tasks Trace read-side primitives. I think. ;-) > > > > > > This assumes that we do not need to flatten partially overlapping RCU > > > Tasks Trace readers into one big reader. > > > > > > Or am I missing something here? > > > > Yes I think that's what Josef does in this patchset. The problem is about > > handling the few instructions: > > > > 1) between the begining of the trampoline and the call to rcu_read_lock_trace() > > > > 2) between the call to rcu_read_unlock_trace() and the end of the trampoline > > > > So what I'm proposing is to make those two parts implicit RCU read lock sections. > > > > So the whole trampoline would be .text.rcu_no_qs: > > > > .text.rcu_no_qs trampoline: > > __________________________________________________________________________________________ > > |Few instructions 1 | rcu_read_lock_trace() .... rcu_read_unlock_trace | Few instructions 2| > > ___________________________________________________________________________________________ > > > > Then when a tick fires, rcu_flavor_sched_clock_irq() discards the interrupted > > code as QS if the IP was within .text.rcu_no_qs _unless_ it is in the > > rcu_read_lock_trace. Both are easy and quick to verify. > > > > Also preempt_schedule_irq() would make sure to verify the same condition and > > enqueue the task as a GP blocker if preempting inside "Few instructions 1" > > or "Few instructions 2". > > Ah, OK, I might be following now. ;-) > > We also need both versions of rcu_exp_handler() to check the IP as well, > given that sooner or later someone is going to want trampoline removal > to go faster. Or am I still missing a turn in here somewhere? Yes indeed, missed the exp part! > > > And since RCU tasks already does a synchronize RCU before and after the scan, > > that's all we would have to do. > > This is going to need some *serious* documentation. Yes :-) > Also, what would be a good way to add tests for this to rcutorture? > Designate some new rcutorture function as being in .text.rcu_no_qs and > add this as another type of rcutorture reader? Or is there a better way? Yes that sounds good! > > Thanx, Paul -- Frederic Weisbecker SUSE Labs