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] [day] [month] [year] [list]
Date:   Sat, 07 Jan 2023 11:36:40 -0000
From:   "tip-bot2 for Yair Podemsky" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Yair Podemsky <ypodemsk@...hat.com>,
        Ingo Molnar <mingo@...nel.org>,
        Valentin Schneider <vschneid@...hat.com>,
        Giovanni Gherdovich <ggherdovich@...e.cz>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: [tip: sched/urgent] sched/core: Fix arch_scale_freq_tick() on
 tickless systems

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     7fb3ff22ad8772bbf0e3ce1ef3eb7b09f431807f
Gitweb:        https://git.kernel.org/tip/7fb3ff22ad8772bbf0e3ce1ef3eb7b09f431807f
Author:        Yair Podemsky <ypodemsk@...hat.com>
AuthorDate:    Wed, 30 Nov 2022 14:51:21 +02:00
Committer:     Ingo Molnar <mingo@...nel.org>
CommitterDate: Sat, 07 Jan 2023 12:25:50 +01:00

sched/core: Fix arch_scale_freq_tick() on tickless systems

In order for the scheduler to be frequency invariant we measure the
ratio between the maximum CPU frequency and the actual CPU frequency.

During long tickless periods of time the calculations that keep track
of that might overflow, in the function scale_freq_tick():

  if (check_shl_overflow(acnt, 2*SCHED_CAPACITY_SHIFT, &acnt))
          goto error;

eventually forcing the kernel to disable the feature for all CPUs,
and show the warning message:

   "Scheduler frequency invariance went wobbly, disabling!".

Let's avoid that by limiting the frequency invariant calculations
to CPUs with regular tick.

Fixes: e2b0d619b400 ("x86, sched: check for counters overflow in frequency invariant accounting")
Suggested-by: "Peter Zijlstra (Intel)" <peterz@...radead.org>
Signed-off-by: Yair Podemsky <ypodemsk@...hat.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Reviewed-by: Valentin Schneider <vschneid@...hat.com>
Acked-by: Giovanni Gherdovich <ggherdovich@...e.cz>
Link: https://lore.kernel.org/r/20221130125121.34407-1-ypodemsk@redhat.com
---
 kernel/sched/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 25b582b..965d813 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5504,7 +5504,9 @@ void scheduler_tick(void)
 	unsigned long thermal_pressure;
 	u64 resched_latency;
 
-	arch_scale_freq_tick();
+	if (housekeeping_cpu(cpu, HK_TYPE_TICK))
+		arch_scale_freq_tick();
+
 	sched_clock_tick();
 
 	rq_lock(rq, &rf);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ