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-next>] [day] [month] [year] [list]
Message-ID: <4A022333.8030200@am.sony.com>
Date:	Wed, 6 May 2009 16:54:27 -0700
From:	Tim Bird <tim.bird@...sony.com>
To:	Steven Rostedt <rostedt@...dmis.org>, Ingo Molnar <mingo@...e.hu>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>,
	linux kernel <linux-kernel@...r.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@...ts.arm.linux.org.uk>
Subject: How to use a different sched_clock() for ftrace on omap?

Hi all,

I've worked up a replacement sched_clock for ftrace on my omap platform.
The current sched_clock, based on the 32K timer, has low resolution and
doesn't provide very useful results.

Unfortunately, I'm not sure the best way to use my special one, in place
of a common one in arch/arm/plat-omap/common.c

Here's a patch:

---
 arch/arm/mach-omap1/time.c  |    9 +++++++++
 arch/arm/plat-omap/common.c |    2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -212,6 +212,15 @@ static struct clocksource clocksource_mp
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };

+unsigned long long notrace sched_clock(void)
+{
+	unsigned long long ret;
+
+	ret = (unsigned long long) ~omap_mpu_timer_read(1);
+	ret = (ret * clocksource_mpu.mult_orig) >>clocksource_mpu.shift;
+	return ret;
+}
+
 static void __init omap_init_clocksource(unsigned long rate)
 {
 	static char err[] __initdata = KERN_ERR
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -203,7 +203,7 @@ static struct clocksource clocksource_32
  * Returns current time from boot in nsecs. It's OK for this to wrap
  * around for now, as it's just a relative time stamp.
  */
-unsigned long long notrace sched_clock(void)
+__attribute__((weak)) unsigned long long notrace sched_clock_old(void)
 {
 	unsigned long long ret;


Obviously, renaming the common sched_clock() to sched_clock_old() is
a hack.

I thought the __attribute__ ((weak)) would be enough to have the
sched_clock() in common.c get out of the way, and allow my board-specific
sched_clock() to be used.  But that didn't work.  What is the recommended
way to specify a board-specific function at compile time?

Thanks,
 -- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Corporation of America
=============================

--
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