lkml.org 
[lkml]   [2021]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 5/8] entry: Explicitly flush pending rcuog wakeup before last rescheduling points
On Sat, Jan 09, 2021 at 03:05:33AM +0100, Frederic Weisbecker wrote:
> Following the idle loop model, cleanly check for pending rcuog wakeup
> before the last rescheduling point on resuming to user mode. This
> way we can avoid to do it from rcu_user_enter() with the last resort
> self-IPI hack that enforces rescheduling.
>
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar<mingo@kernel.org>
> Cc: Paul E. McKenney <paulmck@kernel.org>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> kernel/entry/common.c | 6 ++++++
> kernel/rcu/tree.c | 12 +++++++-----
> 2 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/entry/common.c b/kernel/entry/common.c
> index 378341642f94..8f3292b5f9b7 100644
> --- a/kernel/entry/common.c
> +++ b/kernel/entry/common.c
> @@ -178,6 +178,9 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs,
> /* Architecture specific TIF work */
> arch_exit_to_user_mode_work(regs, ti_work);
>
> + /* Check if any of the above work has queued a deferred wakeup */
> + rcu_nocb_flush_deferred_wakeup();

So this needs to be moved to the IRQs disabled section, just a few lines later,
otherwise preemption may schedule another task that in turn do call_rcu() and create
new deferred wake up (thank Paul for the warning). Not to mention moving to
another CPU with its own deferred wakeups to flush...

I'll fix that for the next version.

Thanks.

\
 
 \ /
  Last update: 2021-01-11 01:42    [W:0.124 / U:2.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site