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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon,  9 Mar 2015 22:32:55 +0100
From:	Rabin Vincent <rabin@....in>
To:	jesper.nilsson@...s.com
Cc:	linux-kernel@...r.kernel.org, linux-cris-kernel@...s.com,
	Rabin Vincent <rabin@....in>
Subject: [PATCH 3/4] CRISv32: use GENERIC_SCHED_CLOCK

Provide a fast sched clock using the free-running timer and the generic
sched_clock infrastructure.

Signed-off-by: Rabin Vincent <rabin@....in>
---
 arch/cris/Kconfig                | 1 +
 arch/cris/arch-v32/kernel/time.c | 9 +++++++++
 arch/cris/kernel/time.c          | 2 ++
 3 files changed, 12 insertions(+)

diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index bd920cc..0314e32 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -57,6 +57,7 @@ config CRIS
 	select OF_EARLY_FLATTREE if ETRAX_ARCH_V32
 	select CLKSRC_MMIO if ETRAX_ARCH_V32
 	select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32
+	select GENERIC_SCHED_CLOCK if ETRAX_ARCH_V32
 
 config HZ
 	int
diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c
index f5002ff..e5a8045 100644
--- a/arch/cris/arch-v32/kernel/time.c
+++ b/arch/cris/arch-v32/kernel/time.c
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/threads.h>
 #include <linux/cpufreq.h>
+#include <linux/sched_clock.h>
 #include <linux/mm.h>
 #include <asm/types.h>
 #include <asm/signal.h>
@@ -242,6 +243,11 @@ static struct irqaction irq_timer = {
 	.dev_id = &crisv32_clockevent,
 };
 
+static u64 notrace crisv32_timer_sched_clock(void)
+{
+	return REG_RD(timer, timer_base, r_time);
+}
+
 static void __init crisv32_timer_init(void)
 {
 	reg_timer_rw_intr_mask timer_intr_mask;
@@ -275,6 +281,9 @@ void __init time_init(void)
 
 	crisv32_timer_init();
 
+	sched_clock_register(crisv32_timer_sched_clock, 32,
+			     CRISV32_TIMER_FREQ);
+
 	clocksource_mmio_init(timer_base + REG_RD_ADDR_timer_r_time,
 			      "crisv32-timer", CRISV32_TIMER_FREQ,
 			      300, 32, clocksource_mmio_readl_up);
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index fe6acda..7780d37 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -79,11 +79,13 @@ cris_do_profile(struct pt_regs* regs)
 #endif
 }
 
+#ifndef CONFIG_GENERIC_SCHED_CLOCK
 unsigned long long sched_clock(void)
 {
 	return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ) +
 		get_ns_in_jiffie();
 }
+#endif
 
 static int
 __init init_udelay(void)
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ