Skip to contentSkip to conversation

msm: timer: Support sched_clock()

PATCH In review Stephen Boyd 3 participants 8 messages Feb 22, 2012 – Feb 25, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 msm: timer: Support sched_clock()

Now that sched_clock is mandatory on ARM it's simple to add sched_clock support to the MSM timer code. Add it so that we get more accurate sched_clock output than the jiffies based version that's provided by default.

Cc Marc Zyngier <[email protected]>
Cc David Brown <[email protected]>

---

This is based on Marc's mandatory sched_clock patch series located at

git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git sched_clock-v3.3-rc3

 arch/arm/mach-msm/timer.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
arch/arm/mach-msm/timer.c +10 -2
index 11d0d8f..61983da 100644
@@ -24,6 +24,7 @@
 #include <asm/mach/time.h>
 #include <asm/hardware/gic.h>
 #include <asm/localtimer.h>
+#include <asm/sched_clock.h>
 
 #include <mach/msm_iomap.h>
 #include <mach/cpu.h>
@@ -105,12 +106,12 @@ static union {
 
 static void __iomem *source_base;
 
-static cycle_t msm_read_timer_count(struct clocksource *cs)
+static notrace cycle_t msm_read_timer_count(struct clocksource *cs)
 {
 	return readl_relaxed(source_base + TIMER_COUNT_VAL);
 }
 
-static cycle_t msm_read_timer_count_shift(struct clocksource *cs)
+static notrace cycle_t msm_read_timer_count_shift(struct clocksource *cs)
 {
 	/*
 	 * Shift timer count down by a constant due to unreliable lower bits
@@ -127,6 +128,11 @@ static struct clocksource msm_clocksource = {
 	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
+static notrace u32 msm_sched_clock_read(void)
+{
+	return msm_clocksource.read(&msm_clocksource);
+}
+
 static void __init msm_timer_init(void)
 {
 	struct clock_event_device *ce = &msm_clockevent;
@@ -189,6 +195,8 @@ err:
 	res = clocksource_register_hz(cs, dgt_hz);
 	if (res)
 		pr_err("clocksource_register failed\n");
+	setup_sched_clock(msm_sched_clock_read,
+			cpu_is_msm7x01() ? 32 - MSM_DGT_SHIFT : 32, dgt_hz);
 }
 
 #ifdef CONFIG_LOCAL_TIMERS
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Stephen Boyd

Now that sched_clock is mandatory on ARM it's simple to add sched_clock support to the MSM timer code. Add it so that we get more accurate sched_clock output than the jiffies based version that's provided by default.

Cc Marc Zyngier <[email protected]>
Cc David Brown <[email protected]>

Marc, are you able to pull this into your series, so they can all go in together? If so:

Thanks,
David

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Acked-by
#2 lore raw
Quoted 6 lines · David Brown
Quoted 5 lines · Stephen Boyd

Now that sched_clock is mandatory on ARM it's simple to add sched_clock support to the MSM timer code. Add it so that we get more accurate sched_clock output than the jiffies based version that's provided by default.

Quoted 8 lines
Quoted 3 lines
Cc Marc Zyngier <[email protected]>
Cc David Brown <[email protected]>

Marc, are you able to pull this into your series, so they can all go in together? If so:

David, Stephen,

Russell already pulled my sched_clock() patch series, so I'm not sure it is actually useful for me to carry it (and there is actually no dependency between this patch and the series). Maybe putting it in the patch system or via armsoc would be best?

Otherwise:

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#3 lore raw
Quoted 18 lines · Marc Zyngier
Quoted 6 lines · David Brown
Quoted 5 lines · Stephen Boyd

Now that sched_clock is mandatory on ARM it's simple to add sched_clock support to the MSM timer code. Add it so that we get more accurate sched_clock output than the jiffies based version that's provided by default.

Quoted 8 lines
Quoted 3 lines
Cc Marc Zyngier <[email protected]>
Cc David Brown <[email protected]>

Marc, are you able to pull this into your series, so they can all go in together? If so:

David, Stephen,

Quoted 7 lines

Russell already pulled my sched_clock() patch series, so I'm not sure it is actually useful for me to carry it (and there is actually no dependency between this patch and the series). Maybe putting it in the patch system or via armsoc would be best?

Otherwise:

I'll keep an eye on it then, and push it into the ARM soc tree when the dependencies are there.

David

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#4 lore raw
Quoted 24 lines · David Brown
Quoted 23 lines · Marc Zyngier
Quoted 6 lines · David Brown
Quoted 5 lines · Stephen Boyd

Now that sched_clock is mandatory on ARM it's simple to add sched_clock support to the MSM timer code. Add it so that we get more accurate sched_clock output than the jiffies based version that's provided by default.

Quoted 8 lines
Quoted 3 lines
Cc Marc Zyngier <[email protected]>
Cc David Brown <[email protected]>

Marc, are you able to pull this into your series, so they can all go in together? If so:

David, Stephen,

Russell already pulled my sched_clock() patch series, so I'm not sure it is actually useful for me to carry it (and there is actually no dependency between this patch and the series). Maybe putting it in the patch system or via armsoc would be best?

Quoted 5 lines
Quoted 2 lines

Otherwise:

I'll keep an eye on it then, and push it into the ARM soc tree when the dependencies are there.

The whole thing is that there's no dependency. The sched_clock() stuff has hit mainline during the merge window. This patch could go in right now, without any harm.

What Russell pulled is just a cleanup to convert the last two platforms having their own sched_clock() and not relying on our framework.

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#5 lore raw

Hi Marc,

Quoted 11 lines · Marc Zyngier
Quoted 2 lines · David Brown

I'll keep an eye on it then, and push it into the ARM soc tree when the dependencies are there.

The whole thing is that there's no dependency. The sched_clock() stuff has hit mainline during the merge window. This patch could go in right now, without any harm.

What Russell pulled is just a cleanup to convert the last two platforms having their own sched_clock() and not relying on our framework.

This patch relies on the fact that the HAVE_SCHED_CLOCK config option no longer exists. We could push it in if the patch had that option added to the Kconfig, but then it would conflict with the removal of the Kconfig by 6905a65 (ARM: Make the sched_clock framework mandatory, 2012-01-18).

So I guess we send it through the arm-soc tree?

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#6 lore raw
Quoted 15 lines · Stephen Boyd

Hi Marc,

Quoted 11 lines · Marc Zyngier
Quoted 2 lines · David Brown

I'll keep an eye on it then, and push it into the ARM soc tree when the dependencies are there.

The whole thing is that there's no dependency. The sched_clock() stuff has hit mainline during the merge window. This patch could go in right now, without any harm.

What Russell pulled is just a cleanup to convert the last two platforms having their own sched_clock() and not relying on our framework.

Quoted 4 lines

This patch relies on the fact that the HAVE_SCHED_CLOCK config option no longer exists. We could push it in if the patch had that option added to the Kconfig, but then it would conflict with the removal of the Kconfig by 6905a65 (ARM: Make the sched_clock framework mandatory, 2012-01-18).

Ah! Indeed, you're perfectly right.

Quoted 1 line

So I guess we send it through the arm-soc tree?

I don't think arm-soc tracks rmk/for-next, so this has to go via Russell's tree. I'll take the patch and send Russell another pull request then.

Cheers,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#7 lore raw
Quoted 5 lines · Marc Zyngier
Quoted 4 lines

This patch relies on the fact that the HAVE_SCHED_CLOCK config option no longer exists. We could push it in if the patch had that option added to the Kconfig, but then it would conflict with the removal of the Kconfig by 6905a65 (ARM: Make the sched_clock framework mandatory, 2012-01-18).

Quoted 7 lines

Ah! Indeed, you're perfectly right.

Quoted 1 line

So I guess we send it through the arm-soc tree?

I don't think arm-soc tracks rmk/for-next, so this has to go via Russell's tree. I'll take the patch and send Russell another pull request then.

Thanks, Marc.

David

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.