linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Paul E . McKenney" <paulmck@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	stable@vger.kernel.org, Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH 2/5] rcu/nocb: Perform deferred wake up before last idle's need_resched() check
Date: Mon, 8 Feb 2021 15:53:08 +0100	[thread overview]
Message-ID: <20210208145308.GC3969@lothringen> (raw)
In-Reply-To: <YCFOnhwQAjMMkwGN@hirez.programming.kicks-ass.net>

On Mon, Feb 08, 2021 at 03:45:50PM +0100, Peter Zijlstra wrote:
> On Mon, Feb 01, 2021 at 12:05:45AM +0100, Frederic Weisbecker wrote:
> 
> > diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
> > index 305727ea0677..b601a3aa2152 100644
> > --- a/kernel/sched/idle.c
> > +++ b/kernel/sched/idle.c
> > @@ -55,6 +55,7 @@ __setup("hlt", cpu_idle_nopoll_setup);
> >  static noinline int __cpuidle cpu_idle_poll(void)
> >  {
> >  	trace_cpu_idle(0, smp_processor_id());
> > +	rcu_nocb_flush_deferred_wakeup();
> >  	stop_critical_timings();
> >  	rcu_idle_enter();
> >  	local_irq_enable();
> > @@ -173,6 +174,8 @@ static void cpuidle_idle_call(void)
> >  	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
> >  	int next_state, entered_state;
> >  
> > +	rcu_nocb_flush_deferred_wakeup();
> > +
> >  	/*
> >  	 * Check if the idle task must be rescheduled. If it is the
> >  	 * case, exit the function after re-enabling the local irq.
> 
> Ok if I do this instead?
> 
> --- a/kernel/sched/idle.c
> +++ b/kernel/sched/idle.c
> @@ -55,7 +55,6 @@ __setup("hlt", cpu_idle_nopoll_setup);
>  static noinline int __cpuidle cpu_idle_poll(void)
>  {
>  	trace_cpu_idle(0, smp_processor_id());
> -	rcu_nocb_flush_deferred_wakeup();
>  	stop_critical_timings();
>  	rcu_idle_enter();
>  	local_irq_enable();
> @@ -174,8 +173,6 @@ static void cpuidle_idle_call(void)
>  	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
>  	int next_state, entered_state;
>  
> -	rcu_nocb_flush_deferred_wakeup();
> -
>  	/*
>  	 * Check if the idle task must be rescheduled. If it is the
>  	 * case, exit the function after re-enabling the local irq.
> @@ -288,6 +285,7 @@ static void do_idle(void)
>  		}
>  
>  		arch_cpu_idle_enter();
> +		rcu_nocb_flush_deferred_wakeup();
>  
>  		/*
>  		 * In poll mode we reenable interrupts and spin. Also if we

Right, I think that should work. Nothing should call_rcu() before the
need_resched() call. And if it does, we still have the nocb_timer to do
the deferred wakeup in the worst case.

Thanks.


  reply	other threads:[~2021-02-08 14:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-31 23:05 [PATCH 0/5] rcu/sched: Fix ignored rescheduling after rcu_eqs_enter() v4 Frederic Weisbecker
2021-01-31 23:05 ` [PATCH 1/5] rcu: Pull deferred rcuog wake up to rcu_eqs_enter() callers Frederic Weisbecker
2021-02-10 13:53   ` [tip: sched/core] " tip-bot2 for Frederic Weisbecker
2021-02-17 13:17   ` tip-bot2 for Frederic Weisbecker
2021-01-31 23:05 ` [PATCH 2/5] rcu/nocb: Perform deferred wake up before last idle's need_resched() check Frederic Weisbecker
2021-02-08 14:45   ` Peter Zijlstra
2021-02-08 14:53     ` Frederic Weisbecker [this message]
2021-02-10 13:53   ` [tip: sched/core] " tip-bot2 for Frederic Weisbecker
2021-02-17 13:17   ` tip-bot2 for Frederic Weisbecker
2021-01-31 23:05 ` [PATCH 3/5] rcu/nocb: Trigger self-IPI on late deferred wake up before user resume Frederic Weisbecker
2021-02-10 13:53   ` [tip: sched/core] " tip-bot2 for Frederic Weisbecker
2021-02-17 13:17   ` tip-bot2 for Frederic Weisbecker
2021-01-31 23:05 ` [PATCH 4/5] entry: Explicitly flush pending rcuog wakeup before last rescheduling point Frederic Weisbecker
2021-02-10 13:53   ` [tip: sched/core] " tip-bot2 for Frederic Weisbecker
2021-02-17 13:17   ` tip-bot2 for Frederic Weisbecker
2021-01-31 23:05 ` [PATCH 5/5] entry/kvm: " Frederic Weisbecker
2021-02-10 13:53   ` [tip: sched/core] " tip-bot2 for Frederic Weisbecker
2021-02-17 13:17   ` tip-bot2 for Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210208145308.GC3969@lothringen \
    --to=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).