How to use a different sched_clock() for ftrace on omap?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Tim Bird
Hi all,
I've worked up a replacement
sched_clockfor ftrace on my omap platform. The currentsched_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
Hi Tim,
If you're comiling mach-omap1/time.c than you've enabled the higher-resolution MPU timer with CONFIG_OMAP_MPU_TIMER, right?
In that case, you could make the one in plat-omap/common.c inside and #ifndef CONFIG_OMAP_MPU_TIMER and put the new one in the MPU_TIMER code.
To be complete, you should add the same to the mach-omap2/timer-gp.c as well.
Kevin
Quoted 59 lines
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(-)arch/arm/mach-omap1/time.c +9
-0@@ -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 arch/arm/plat-omap/common.c +1
-1@@ -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()tosched_clock_old()is a hack.I thought the
__attribute__((weak)) would be enough to have thesched_clock()incommon.cget out of the way, and allow my board-specificsched_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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 8 lines · Kevin Hilman
Quoted 6 lines · Tim Bird
Hi all,
I've worked up a replacement
sched_clockfor ftrace on my omap platform. The currentsched_clock, based on the 32K timer, has low resolution and doesn't provide very useful results.
Quoted 7 lines
Quoted 2 lines
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.cHi Tim,
If you're comiling
mach-omap1/time.cthan you've enabled the higher-resolution MPU timer withCONFIG_OMAP_MPU_TIMER, right?
Yes.
Quoted 6 lines
In that case, you could make the one in
plat-omap/common.cinside and #ifndefCONFIG_OMAP_MPU_TIMERand put the new one in theMPU_TIMERcode.To be complete, you should add the same to the
mach-omap2/timer-gp.cas well.
I was trying to avoid using #ifdefs, but maybe in this case it makes sense. There are tradeoffs in using the different timers (nicely described in plat-omap/Kconfig help entries), so IMHO it would be good to make this a config preference.
I'll work up a patch in this style and send it along.
-- Tim
=============================
Tim Bird
Architecture Group Chair, CE Linux Forum Senior Staff Engineer, Sony Corporation of America
=============================
Quoted 23 lines · Tim Bird
Quoted 8 lines · Kevin Hilman
Quoted 6 lines · Tim Bird
Hi all,
I've worked up a replacement
sched_clockfor ftrace on my omap platform. The currentsched_clock, based on the 32K timer, has low resolution and doesn't provide very useful results.Quoted 7 lines
Quoted 2 lines
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.cHi Tim,
If you're comiling
mach-omap1/time.cthan you've enabled the higher-resolution MPU timer withCONFIG_OMAP_MPU_TIMER, right?Yes.
Quoted 4 lines
In that case, you could make the one in
plat-omap/common.cinside and #ifndefCONFIG_OMAP_MPU_TIMERand put the new one in theMPU_TIMERcode.
Quoted 7 lines
Quoted 2 lines
To be complete, you should add the same to the
mach-omap2/timer-gp.cas well.I was trying to avoid using #ifdefs, but maybe in this case it makes sense. There are tradeoffs in using the different timers (nicely described in plat-omap/Kconfig help entries), so IMHO it would be good to make this a config preference.
Yes, we have PM reasons for wanting to choose between the different timers.
Quoted 1 line
I'll work up a patch in this style and send it along.
OK, please send it to linux-omap as well.
On a related note, and not your problem here but something that would be nice to see is the default sched_clock implementation using the clocksource instead of jiffies.
Then, platform code just registers its preferred clocksource and sched_clock() gets the same resolution as the clocksource. Not sure how yet to handle clocksources being added and removed though...
Kevin