All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ani Sinha <ani@anisinha.ca>
To: linux-kernel@vger.kernel.org
Cc: anirban.sinha@nokia.com, tglx@linutronix.de,
	Ani Sinha <ani@anisinha.ca>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@kernel.org>
Subject: [PATCH v1] Add info log when user enables NOHZ in commandline but NOHZ is not possible
Date: Sun, 27 Jun 2021 12:58:33 +0530	[thread overview]
Message-ID: <20210627072833.2199463-1-ani@anisinha.ca> (raw)

Commit 4f49b90abb4aca ("sched-clock: Migrate to use new tick
dependency mask model") had also removed the kernel warning
message informing the user that it was not possible to turn
on NO_HZ_FULL. This warning was added in commit e12d0271774fe
("nohz: Warn if the machine can not perform nohz_full") in order
to warn users when they enabled NOHZ using the kernel commandline
but kernel could not enable NOHZ. Removal of this log defeats this
purpose because we still do not want users thinking that they are
getting the benefit of nohz when their machine can not support it.
Hence this patch brings back the information log.

If at some point the conditions that prevented NOHZ from being
enabled goes away and the previous info log was printed, we print
another log informing the user that NOHZ was again possible.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
---
 kernel/time/tick-sched.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

See also thread: https://lkml.org/lkml/2021/6/20/32

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 828b091501ca..fbef95b57b1d 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -930,6 +930,7 @@ static void tick_nohz_full_update_tick(struct tick_sched *ts)
 {
 #ifdef CONFIG_NO_HZ_FULL
 	int cpu = smp_processor_id();
+	static bool no_tick_warned;
 
 	if (!tick_nohz_full_cpu(cpu))
 		return;
@@ -937,10 +938,24 @@ static void tick_nohz_full_update_tick(struct tick_sched *ts)
 	if (!ts->tick_stopped && ts->nohz_mode == NOHZ_MODE_INACTIVE)
 		return;
 
-	if (can_stop_full_tick(cpu, ts))
+	if (can_stop_full_tick(cpu, ts)) {
 		tick_nohz_stop_sched_tick(ts, cpu);
-	else if (ts->tick_stopped)
-		tick_nohz_restart_sched_tick(ts, ktime_get());
+		if (no_tick_warned) {
+			pr_info("NO_HZ_FULL is now enabled in the system.\n");
+			no_tick_warned = false;
+		}
+	} else {
+		/*
+		 * Don't allow the user to think they can get
+		 * full NO_HZ with this machine.
+		 */
+		if (!no_tick_warned && tick_nohz_full_running) {
+			pr_info("NO_HZ_FULL has been disabled in the system.");
+			no_tick_warned = true;
+		}
+		if (ts->tick_stopped)
+			tick_nohz_restart_sched_tick(ts, ktime_get());
+	}
 #endif
 }
 
-- 
2.25.1


             reply	other threads:[~2021-06-27  7:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-27  7:28 Ani Sinha [this message]
2021-07-03 17:29 ` [PATCH v1] Add info log when user enables NOHZ in commandline but NOHZ is not possible Ani Sinha
2021-07-07 10:16 ` Thomas Gleixner
2021-07-07 10:43   ` Frederic Weisbecker
2021-07-10  3:57     ` Ani Sinha

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=20210627072833.2199463-1-ani@anisinha.ca \
    --to=ani@anisinha.ca \
    --cc=anirban.sinha@nokia.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.