linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ramesh.thomas@intel.com
To: linux-rt-users@vger.kernel.org
Cc: Ramesh Thomas <ramesh.thomas@intel.com>,
	williams@redhat.com, frederic@kernel.org, bigeasy@linutronix.de
Subject: [PATCH 1/1] dynticks/preempt_rt: Fix a nohz_full entry failure in preempt_rt
Date: Wed, 23 Dec 2020 04:20:36 -0500	[thread overview]
Message-ID: <20201223092034.528782-2-ramesh.thomas@intel.com> (raw)
In-Reply-To: <20201223092034.528782-1-ramesh.thomas@intel.com>

From: Ramesh Thomas <ramesh.thomas@intel.com>

After all conditions to enter nohz_full state are met, if a timer event
is detected in the next period, nohz_full entry is aborted in
tick_nohz_next_event(). In the failure condition, this scenario keeps
repeating. This has been reproduced in preempt_rt kernel, however it may
not be limited to it.

Not bailing out if CONFIG_NO_HZ_FULL is defined, fixes the issue. Since
in NO_HZ_FULL mode, idle state is not entered at tick stoppage, the
pending timer event can be handled where the next timer is programmed in
tick_nohz_stop_tick(). This also simplifies the logic by keeping a
common path to handle the entry/exit of nohz_full state, whether the
tick was already stopped or not.

(The entire check for the presence of a timer event in the next period
can possibly be skipped for NO_HZ_FULL)

Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
---
 kernel/time/tick-sched.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 308a98c28ee8..3798dbc5f082 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -739,10 +739,12 @@ static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu)
 		 * We've not stopped the tick yet, and there's a timer in the
 		 * next period, so no point in stopping it either, bail.
 		 */
+#ifndef CONFIG_NO_HZ_FULL
 		if (!ts->tick_stopped) {
 			ts->timer_expires = 0;
-			goto out;
+			return 0;
 		}
+#endif
 	}
 
 	/*
@@ -763,7 +765,6 @@ static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu)
 
 	ts->timer_expires = min_t(u64, expires, next_tick);
 
-out:
 	return ts->timer_expires;
 }
 
-- 
2.26.2


  reply	other threads:[~2020-12-23  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23  9:20 [PATCH 0/1] nohz_full state entry failure in preempt_rt and proposed fix ramesh.thomas
2020-12-23  9:20 ` ramesh.thomas [this message]
2021-01-14 14:48   ` [PATCH 1/1] dynticks/preempt_rt: Fix a nohz_full entry failure in preempt_rt Sebastian Andrzej Siewior

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=20201223092034.528782-2-ramesh.thomas@intel.com \
    --to=ramesh.thomas@intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    /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).