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: <20210918072200.95304-2-zhengd@lemote.com>
Date:   Sat, 18 Sep 2021 15:21:59 +0800
From:   Dian zheng <paniaguaholt597336@...il.com>
To:     jiaxun.yang@...goat.com
Cc:     cand@....com, chenhuacai@...nel.org, daniel.lezcano@...aro.org,
        drjones@...hat.com, fancer.lancer@...il.com, huangll@...ote.com,
        john.garry@...wei.com, linux-kernel@...r.kernel.org,
        linux-mips@...r.kernel.org, marcan@...can.st,
        mgorman@...hsingularity.net, ndesaulniers@...gle.com,
        paul@...pouillou.net, romain.naour@...il.com,
        sudipm.mukherjee@...il.com, sumanthk@...ux.ibm.com,
        tanj@...ote.com, tglx@...utronix.de, tmricht@...ux.ibm.com,
        tom.zanussi@...ux.intel.com, tsbogend@...ha.franken.de,
        will@...nel.org, yangtiezhu@...ngson.cn,
        zhangshaokun@...ilicon.com, zhengd@...ote.com,
        zhouyanjie@...yeetech.com
Subject: [PATCH v1 2/3] MIPS: time: Add plat_have_sched_clock That variable That variable would allow platform to register their own sched_clock instead of csrc-r4k.

From: Dian Zheng <zhengd@...ote.com>

Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
Signed-off-by: Dian Zheng <zhengd@...ote.com>
---
 arch/mips/include/asm/time.h | 3 +++
 arch/mips/kernel/csrc-r4k.c  | 5 ++---
 arch/mips/kernel/time.c      | 3 +++
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h
index e855a3611d92..e235b8a27768 100644
--- a/arch/mips/include/asm/time.h
+++ b/arch/mips/include/asm/time.h
@@ -28,6 +28,9 @@ extern void plat_time_init(void);
  */
 extern unsigned int mips_hpt_frequency;
 
+/* True if platform registered sched_clock by itself */
+extern bool plat_have_sched_clock __initdata;
+
 /*
  * The performance counter IRQ on MIPS is a close relative to the timer IRQ
  * so it lives here.
diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
index edc4afc080fa..b50a24da6528 100644
--- a/arch/mips/kernel/csrc-r4k.c
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -122,9 +122,8 @@ int __init init_r4k_clocksource(void)
 
 	clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);
 
-#ifndef CONFIG_CPU_FREQ
-	sched_clock_register(r4k_read_sched_clock, 32, mips_hpt_frequency);
-#endif
+	if (!IS_ENABLED(CONFIG_CPU_FREQ) && !plat_have_sched_clock)
+		sched_clock_register(r4k_read_sched_clock, 32, mips_hpt_frequency);
 
 	return 0;
 }
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index caa01457dce6..baf33da8c79d 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -123,6 +123,9 @@ EXPORT_SYMBOL(perf_irq);
 unsigned int mips_hpt_frequency;
 EXPORT_SYMBOL_GPL(mips_hpt_frequency);
 
+/* True if platform registered sched_clock by itself */
+bool plat_have_sched_clock __initdata;
+
 static __init int cpu_has_mfc0_count_bug(void)
 {
 	switch (current_cpu_type()) {
-- 
2.18.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ