Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp796275ybh; Thu, 12 Mar 2020 11:16:48 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtEpi8amk5OPqYVjIO54q2yMOXpimaL6TPEDA9ZXmKRnOUrx7CIVrmzEJyafBZAs6uDLL2R X-Received: by 2002:a9d:7d89:: with SMTP id j9mr6907467otn.47.1584037007985; Thu, 12 Mar 2020 11:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584037007; cv=none; d=google.com; s=arc-20160816; b=GHwh3TIVRp1g+qYY2fN5piEImcbS6QUE7S50B+bh72LjKj4wD7kaWYC1bXVE4nkhSD Q3qOfuHttT5qaMOaL+CzQPCwQS3vaca0cJvR3WWtN2YOhO7lwMT0PdM5uThpinbbJSns L09RW6yMbA37jvT5Q64QGrRku6lyTvY61tf4gcXRJ1WuOpMTyHcoJm5y8TaxeKJKz8WZ FOxwQUX+pcOk5WIC7gGGSt0fG0i78UTfa6AgVTIaRefQvnxDDEV/uN45Dl7Q18Y/NXtS CyUg5vGyvzWSc9PukOEyk+JvtnALfasR5nSo6dCimeLi+ExvIhd2T/YbbF4Tb3qFoH+V I/5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=3b8b8Qk4PkQjSa8ES+B2vSmrWmIb4qTQJklWBdhzGdM=; b=mLbw5Cw6adHOgDANN8/3q2/dyIlBEO76yyyQnTE4e4o77XfrCsHQCOgqkNYQUX0g1I VCD+sVMt4tzg3AK5JwKGUmKS/VliuCZ0OJpZcDJza+gcXf9fKZmWxPtkDIvWQ8PPB6EA rRAWzidWSpPcVWsdXMDV92rioGu/q1YvtibUCrKAUFhMn0KfOdU67M6bTDQUGLsUH9Ck F6S5brkTUgNhRKZaG92U9smdfQkhSounNxomSpqeCln4MjuFumSbOJKWiOFbDru3I4BJ H9TjIfXRa3gHS0Ot9sdENVP6xDY04xEXDpplwlpShDQThNmv3HhC+06+/IckrZ7uvmKM fupA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i40WgyFp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v127si604315oib.25.2020.03.12.11.16.35; Thu, 12 Mar 2020 11:16:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i40WgyFp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726646AbgCLSQT (ORCPT + 99 others); Thu, 12 Mar 2020 14:16:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:51740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726504AbgCLSQS (ORCPT ); Thu, 12 Mar 2020 14:16:18 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6CB772067C; Thu, 12 Mar 2020 18:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584036978; bh=5Y/FXshugFk88mbf2jBH+CLi7LSB/TsKL13J+4ijKmk=; h=Date:From:To:Cc:Subject:Reply-To:From; b=i40WgyFpq1VeKVPJIPqmLQ1GYqvqpo6RpTzw/BQFf4H74rL3Yyyhc+g44+bH5Qp1q HsNpNaCroShYJofAnio0pRaWacMyMUdAqnMtbtwmH3gUwKqtiEGCrsjkZjTXlGOWwl UKK04NOCOcubwigGvzmoV6gM1Ff+qqCBYh42+Lqg= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 3BF9035226D0; Thu, 12 Mar 2020 11:16:18 -0700 (PDT) Date: Thu, 12 Mar 2020 11:16:18 -0700 From: "Paul E. McKenney" To: mutt@paulmck-ThinkPad-P72, rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org Subject: [PATCH RFC tip/core/rcu 0/16] Prototype RCU usable from idle, exception, offline Message-ID: <20200312181618.GA21271@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello! This series provides two variants of Tasks RCU, a rude variant inspired by Steven Rostedt's use of schedule_on_each_cpu(), and a tracing variant requested by the BPF folks and perhaps also of use for other tracing use cases. The tracing variant has explicit read-side markers to permit finite grace periods even given in-kernel loops in PREEMPT=n builds It also protects code in the idle loop, on exception entry/exit paths, and on the various CPU-hotplug online/offline code paths, thus having protection properties similar to SRCU. However, unlike SRCU, this variant avoids expensive instructions in the read-side primitives, thus having read-side overhead similar to that of preemptible RCU. There are of course downsides. The grace-period code can send IPIs to CPUs, even when those CPUs are in the idle loop or in nohz_full userspace. It is necessary to scan the full tasklist, much as for Tasks RCU. There is a single callback queue guarded by a single lock, again, much as for Tasks RCU. If needed, these downsides can be at least partially remedied. Perhaps most important, this variant of RCU does not affect the vanilla flavors, rcu_preempt and rcu_sched. The fact that RCU Tasks Trace readers can operate from idle, offline, and exception entry/exit in no way allows rcu_preempt and rcu_sched readers to also do so. This effort benefited greatly from off-list discussions of BPF requirements with Alexei Starovoitov and Andrii Nakryiko, as well as from numerous on-list discussions, at least some of which are captured in the "Link:" tags on the patches themselves. The patches in this series are as follows: 1. Add function to sample state of non-running function. I would guess that the API is still subject to change. ;-) 2. Use the above function to add per-task state to RCU CPU stall warnings. 3. Add rcutorture module parameter to produce non-busy-wait task stalls, thus allowing the above RCU CPU stall change to be exercised. 4. Move Tasks RCU to its own file. 5. Create struct to hold RCU-tasks state information. 6. Reinstate synchronize_rcu_mult(), as there will likely once again be a need to wait on multiple flavors of RCU. 7. Add an rcutorture test for synchronize_rcu_mult(). 8. Refactor RCU-tasks to allow variants to be added. 9. Add an RCU-tasks rude variant, based on Steven Rostedt's use of schedule_on_each_cpu(). 10. Add torture tests for RCU Tasks Rude. 11. Use unique names for RCU-Tasks kthreads and messages. 12. Further refactor RCU-tasks to allow adding even more variants. 13. Code movement to allow even more Tasks RCU variants. 14. Add an RCU Tasks Trace to simplify protection of tracing hooks, including BPF. 15. Add torture tests for RCU Tasks Trace. 16. Add stall warnings for RCU Tasks Trace. The new versions of Tasks RCU pass moderate rcutorture testing, and more severe testing is in the offing. They are not yet ready for production use, however! Thanx, Paul ------------------------------------------------------------------------ Documentation/admin-guide/kernel-parameters.txt | 5 include/linux/rcupdate.h | 9 include/linux/rcupdate_trace.h | 84 include/linux/rcupdate_wait.h | 19 include/linux/sched.h | 8 include/linux/wait.h | 2 init/init_task.c | 4 kernel/fork.c | 4 kernel/rcu/Kconfig | 34 kernel/rcu/Kconfig.debug | 4 kernel/rcu/rcu.h | 2 kernel/rcu/rcutorture.c | 96 kernel/rcu/tasks.h | 1730 +++++++++--- kernel/rcu/tree_stall.h | 38 kernel/rcu/update.c | 370 -- kernel/sched/core.c | 49 tools/testing/selftests/rcutorture/configs/rcu/CFLIST | 2 tools/testing/selftests/rcutorture/configs/rcu/RUDE01 | 10 tools/testing/selftests/rcutorture/configs/rcu/RUDE01.boot | 1 tools/testing/selftests/rcutorture/configs/rcu/TRACE01 | 10 tools/testing/selftests/rcutorture/configs/rcu/TRACE01.boot | 1 21 files changed, 1702 insertions(+), 780 deletions(-)