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>] [day] [month] [year] [list]
Message-Id: <20211110192740.358437-1-joshdon@google.com>
Date:   Wed, 10 Nov 2021 11:27:40 -0800
From:   Josh Don <joshdon@...gle.com>
To:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>
Cc:     Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Joel Fernandes <joel@...lfernandes.org>,
        Vineeth Pillai <vineethrp@...il.com>,
        Hao Luo <haoluo@...gle.com>, linux-kernel@...r.kernel.org,
        Josh Don <joshdon@...gle.com>
Subject: [PATCH] sched/core: explicitly initialize coresched state

Some coresched state may be left as non-zero when we flip off coresched
(ie. core_cookie, core_forceidle_count, etc.). This won't cause any
issues when we flip coresched back on, but it is better to be more
explicit about resetting this state.

Signed-off-by: Josh Don <joshdon@...gle.com>
---
 kernel/sched/core.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b0be8ad6bb7e..2c17f5e91402 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -282,13 +282,23 @@ static void __sched_core_flip(bool enabled)
 	cpumask_copy(&sched_core_mask, cpu_online_mask);
 	for_each_cpu(cpu, &sched_core_mask) {
 		const struct cpumask *smt_mask = cpu_smt_mask(cpu);
+		struct rq *rq;
 
 		sched_core_lock(cpu, &flags);
 
-		for_each_cpu(t, smt_mask)
-			cpu_rq(t)->core_enabled = enabled;
+		for_each_cpu(t, smt_mask) {
+			rq = cpu_rq(t);
+
+			rq->core_pick = NULL;
+			rq->core_enabled = enabled;
+
+		}
 
-		cpu_rq(cpu)->core->core_forceidle_start = 0;
+		rq = cpu_rq(cpu)->core;
+		rq->core_cookie = 0;
+		rq->core_forceidle_count = 0;
+		rq->core_forceidle_occupation = 0;
+		rq->core_forceidle_start = 0;
 
 		sched_core_unlock(cpu, &flags);
 
-- 
2.34.0.rc0.344.g81b53c2807-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ