lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210608120442.93587-3-frederic@kernel.org>
Date:   Tue,  8 Jun 2021 14:04:42 +0200
From:   Frederic Weisbecker <frederic@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Frederic Weisbecker <frederic@...nel.org>
Subject: [PATCH 2/2] sched: Always print out preempt dynamic state

Previously the preempt dynamic mode wasn't printed out if it wasn't
overriden with the "preempt=" boot option.

But now that the default preempt dynamic behaviour can be selected at
Kconfig time, we can't assume anymore that preempt=full is the default.
The only way to retrieve that information is to browse the kernel config
file.

Better print it out unconditionally then.

Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
---
 kernel/sched/core.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index df47a8275c37..6b883adad8f7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6262,6 +6262,21 @@ int sched_dynamic_mode(const char *str)
 
 void sched_dynamic_update(int mode)
 {
+	switch (mode) {
+		case preempt_dynamic_none:
+			pr_info("Dynamic Preempt: none\n");
+			break;
+		case preempt_dynamic_voluntary:
+			pr_info("Dynamic Preempt: voluntary\n");
+			break;
+		case preempt_dynamic_full:
+			pr_info("Dynamic Preempt: full\n");
+			break;
+		default:
+			pr_info("Dynamic Preempt: incorrect\n");
+			return;
+	}
+
 	if (preempt_dynamic_mode == mode)
 		return;
 
@@ -6282,7 +6297,6 @@ void sched_dynamic_update(int mode)
 		static_call_update(preempt_schedule, NULL);
 		static_call_update(preempt_schedule_notrace, NULL);
 		static_call_update(irqentry_exit_cond_resched, NULL);
-		pr_info("Dynamic Preempt: none\n");
 		break;
 
 	case preempt_dynamic_voluntary:
@@ -6291,7 +6305,6 @@ void sched_dynamic_update(int mode)
 		static_call_update(preempt_schedule, NULL);
 		static_call_update(preempt_schedule_notrace, NULL);
 		static_call_update(irqentry_exit_cond_resched, NULL);
-		pr_info("Dynamic Preempt: voluntary\n");
 		break;
 
 	case preempt_dynamic_full:
@@ -6300,7 +6313,6 @@ void sched_dynamic_update(int mode)
 		static_call_update(preempt_schedule, __preempt_schedule_func);
 		static_call_update(preempt_schedule_notrace, __preempt_schedule_notrace_func);
 		static_call_update(irqentry_exit_cond_resched, irqentry_exit_cond_resched);
-		pr_info("Dynamic Preempt: full\n");
 		break;
 	}
 
@@ -6323,8 +6335,7 @@ __setup("preempt=", setup_preempt_mode);
 
 static void __init init_preempt(void)
 {
-	if (preempt_dynamic_mode_init != preempt_dynamic_full)
-		sched_dynamic_update(preempt_dynamic_mode_init);
+	sched_dynamic_update(preempt_dynamic_mode_init);
 }
 #else
 static inline void init_preempt(void) { }
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ