Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp84144ybb; Thu, 19 Mar 2020 12:05:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvCEaz8pSx9/k5lYweNoQkVwm2AaGiTaNeOs3AKrdYR37zhbzH3CIUI8Hck3f1pA6+w+S47 X-Received: by 2002:a05:6808:6d6:: with SMTP id m22mr3438705oih.164.1584644727262; Thu, 19 Mar 2020 12:05:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584644727; cv=none; d=google.com; s=arc-20160816; b=ZgZPjXUAxqWRtYPLhRDYMFJTGEX/ge5IKaNdDYltRbdu1KqI013kjr8id4SG8yTfFC 0wkArf7VFogCusEcLkx+dGfR39y8EHASIbIG1Mldv664Pu6t2sQXD4IWUuBrEjXJ7uF5 ksSoSc88Y90M8H5x3LuTQO38+/f7UzzldYQ6JFIPsJOt+liftZuV7Y4mjqu75V6NmJoA yGuqP0FfJXBR3bzx/0X/ljBQa57K0vniVepzxqRyA8EuLPsBPSYNTRPrXv4xtzpz8su7 Fnds7EC0srhrY2VUb5NTEs2A8cZ2xvkDJqCTQjmb2YcsvfC+zsQshQziK2WhmHKx6jx6 4+cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=ufWwR2Wqv0A60uZfa6yGd1IeBSbu4Ntn/rneeRo3tCY=; b=TL7bQ8vTYsSLFQkVnqiDrzbW1MzqmBp2wt0IL8nkAEo/Y3XMcCQDJ9woYDd/dksQaP AGBwIEHXrNoEQudQ9uzbO+vVhZuOcBNy35oFoEEWECk5B+Y0CZYXfSoPq6vasT+++mnx 278+JqC/83HLMgYms8DsEoNg4CMtRElop0LHi0FnwRNcFyQUz/jA7GaCYF+8TFeWjUUb Cd4DtzzBmI7IIH3Jx6F/sr/+E2jryf9UB8A2wydhyCxnUWxVMiCjT7bM4hu81d3QfqsU U5uM+tgHqThvSOsjim1S+wXXZeDDNoJU+6UkDAszeOqEM6iuuLMkxXdzoUD3fcOOdI+t jXtA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1si1453431oix.209.2020.03.19.12.05.15; Thu, 19 Mar 2020 12:05:27 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728001AbgCSTEi (ORCPT + 99 others); Thu, 19 Mar 2020 15:04:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:42626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727948AbgCSTEg (ORCPT ); Thu, 19 Mar 2020 15:04:36 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 D43442072C; Thu, 19 Mar 2020 19:04:33 +0000 (UTC) Date: Thu, 19 Mar 2020 15:04:32 -0400 From: Steven Rostedt To: paulmck@kernel.org Cc: rcu@vger.kernel.org, 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, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org Subject: Re: [PATCH RFC v2 tip/core/rcu 09/22] rcu-tasks: Add an RCU-tasks rude variant Message-ID: <20200319150432.1ac9dac9@gandalf.local.home> In-Reply-To: <20200319001100.24917-9-paulmck@kernel.org> References: <20200319001024.GA28798@paulmck-ThinkPad-P72> <20200319001100.24917-9-paulmck@kernel.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Mar 2020 17:10:47 -0700 paulmck@kernel.org wrote: > From: "Paul E. McKenney" > > This commit adds a "rude" variant of RCU-tasks that has as quiescent > states schedule(), cond_resched_tasks_rcu_qs(), userspace execution, > and (in theory, anyway) cond_resched(). In other words, RCU-tasks rude > readers are regions of code with preemption disabled, but excluding code > early in the CPU-online sequence and late in the CPU-offline sequence. > Updates make use of IPIs and force an IPI and a context switch on each > online CPU. This variant is useful in some situations in tracing. > > Suggested-by: Steven Rostedt > [ paulmck: Apply EXPORT_SYMBOL_GPL() feedback from Qiujun Huang. ] > Signed-off-by: Paul E. McKenney > --- > include/linux/rcupdate.h | 3 ++ > kernel/rcu/Kconfig | 12 +++++- > kernel/rcu/tasks.h | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 112 insertions(+), 1 deletion(-) > > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h > index 5523145..2be97a8 100644 > --- a/include/linux/rcupdate.h > +++ b/include/linux/rcupdate.h > @@ -37,6 +37,7 @@ > /* Exported common interfaces */ > void call_rcu(struct rcu_head *head, rcu_callback_t func); > void rcu_barrier_tasks(void); > +void rcu_barrier_tasks_rude(void); > void synchronize_rcu(void); > > #ifdef CONFIG_PREEMPT_RCU > @@ -138,6 +139,8 @@ static inline void rcu_init_nohz(void) { } > #define rcu_note_voluntary_context_switch(t) rcu_tasks_qs(t) > void call_rcu_tasks(struct rcu_head *head, rcu_callback_t func); > void synchronize_rcu_tasks(void); > +void call_rcu_tasks_rude(struct rcu_head *head, rcu_callback_t func); > +void synchronize_rcu_tasks_rude(void); > void exit_tasks_rcu_start(void); > void exit_tasks_rcu_finish(void); > #else /* #ifdef CONFIG_TASKS_RCU_GENERIC */ > diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig > index 38475d0..0d43ec1 100644 > --- a/kernel/rcu/Kconfig > +++ b/kernel/rcu/Kconfig > @@ -71,7 +71,7 @@ config TREE_SRCU > This option selects the full-fledged version of SRCU. > > config TASKS_RCU_GENERIC > - def_bool TASKS_RCU > + def_bool TASKS_RCU || TASKS_RUDE_RCU > select SRCU > help > This option enables generic infrastructure code supporting > @@ -84,6 +84,16 @@ config TASKS_RCU > only voluntary context switch (not preemption!), idle, and > user-mode execution as quiescent states. Not for manual selection. > > +config TASKS_RUDE_RCU > + def_bool 0 > + default n No need for "default n" as that's the default without it. > + help > + This option enables a task-based RCU implementation that uses > + only context switch (including preemption) and user-mode > + execution as quiescent states. It forces IPIs and context > + switches on all online CPUs, including idle ones, so use > + with caution. Not for manual selection. Really don't need the "Not for manual selection", as not having a prompt shows that too. > + > config RCU_STALL_COMMON > def_bool TREE_RCU > help > diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h > index d77921e..7ba1730 100644 > --- a/kernel/rcu/tasks.h > +++ b/kernel/rcu/tasks.h > @@ -180,6 +180,9 @@ static void __init rcu_tasks_bootup_oddness(void) > else > pr_info("\tTasks RCU enabled.\n"); > #endif /* #ifdef CONFIG_TASKS_RCU */ > +#ifdef CONFIG_TASKS_RUDE_RCU > + pr_info("\tRude variant of Tasks RCU enabled.\n"); > +#endif /* #ifdef CONFIG_TASKS_RUDE_RCU */ > } > > #endif /* #ifndef CONFIG_TINY_RCU */ > @@ -410,3 +413,98 @@ static int __init rcu_spawn_tasks_kthread(void) > core_initcall(rcu_spawn_tasks_kthread); > > #endif /* #ifdef CONFIG_TASKS_RCU */ > + > +#ifdef CONFIG_TASKS_RUDE_RCU > + > +//////////////////////////////////////////////////////////////////////// > +// > +// "Rude" variant of Tasks RCU, inspired by Steve Rostedt's trick of > +// passing an empty function to schedule_on_each_cpu(). This approach > +// provides an asynchronous call_rcu_rude() API and batching of concurrent > +// calls to the synchronous synchronize_rcu_rude() API. This sends IPIs > +// far and wide and induces otherwise unnecessary context switches on all > +// online CPUs, whether online or not. "on all online CPUs, whether online or not" ???? -- Steve > + > +// Empty function to allow workqueues to force a context switch. > +static void rcu_tasks_be_rude(struct work_struct *work) > +{ > +} > +