* [PATCH 1/1] ARM: imx: Add sched_clock support to i.mx platform
@ 2011-03-30 8:07 Frank Li
2011-03-30 8:31 ` Jamie Iles
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Frank Li @ 2011-03-30 8:07 UTC (permalink / raw)
To: linux-arm-kernel
From: Xinyu Chen <xinyu.chen@freescale.com>
Add sched_clock() implement for i.mx platform to support nanosecond
resolution time for sched clock used by scheduler.
Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
arch/arm/plat-mxc/time.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index 9f0c261..de8a04f 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -123,6 +123,15 @@ static struct clocksource clocksource_mxc = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+unsigned long long sched_clock(void)
+{
+ if (!timer_base)
+ return 0;
+
+ return clocksource_cyc2ns(clocksource_mxc.read(&clocksource_mxc),
+ clocksource_mxc.mult, clocksource_mxc.shift);
+}
+
static int __init mxc_clocksource_init(struct clk *timer_clk)
{
unsigned int c = clk_get_rate(timer_clk);
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 1/1] ARM: imx: Add sched_clock support to i.mx platform
2011-03-30 8:07 [PATCH 1/1] ARM: imx: Add sched_clock support to i.mx platform Frank Li
@ 2011-03-30 8:31 ` Jamie Iles
2011-03-30 8:47 ` Uwe Kleine-König
2011-03-30 8:57 ` Russell King - ARM Linux
2 siblings, 0 replies; 4+ messages in thread
From: Jamie Iles @ 2011-03-30 8:31 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Wed, Mar 30, 2011 at 04:07:51PM +0800, Frank Li wrote:
> From: Xinyu Chen <xinyu.chen@freescale.com>
>
> Add sched_clock() implement for i.mx platform to support nanosecond
> resolution time for sched clock used by scheduler.
>
> Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
> Signed-off-by: Frank Li <Frank.Li@freescale.com>
> ---
> arch/arm/plat-mxc/time.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
> index 9f0c261..de8a04f 100644
> --- a/arch/arm/plat-mxc/time.c
> +++ b/arch/arm/plat-mxc/time.c
> @@ -123,6 +123,15 @@ static struct clocksource clocksource_mxc = {
> .flags = CLOCK_SOURCE_IS_CONTINUOUS,
> };
>
> +unsigned long long sched_clock(void)
> +{
> + if (!timer_base)
> + return 0;
> +
> + return clocksource_cyc2ns(clocksource_mxc.read(&clocksource_mxc),
> + clocksource_mxc.mult, clocksource_mxc.shift);
> +}
sched_clock() should be marked "notrace". Also, this should use the
sched_clock support in arch/arm/include/asm/sched_clock.h that takes
care of wrapping and making it monotonic.
Jamie
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] ARM: imx: Add sched_clock support to i.mx platform
2011-03-30 8:07 [PATCH 1/1] ARM: imx: Add sched_clock support to i.mx platform Frank Li
2011-03-30 8:31 ` Jamie Iles
@ 2011-03-30 8:47 ` Uwe Kleine-König
2011-03-30 8:57 ` Russell King - ARM Linux
2 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2011-03-30 8:47 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 30, 2011 at 04:07:51PM +0800, Frank Li wrote:
> From: Xinyu Chen <xinyu.chen@freescale.com>
>
> Add sched_clock() implement for i.mx platform to support nanosecond
> resolution time for sched clock used by scheduler.
>
> Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
> Signed-off-by: Frank Li <Frank.Li@freescale.com>
Some time ago Jan Weitzel sent a series with the same intention, but
Jan's patches look a bit more robust.
See http://thread.gmane.org/gmane.linux.ports.arm.kernel/110748
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] ARM: imx: Add sched_clock support to i.mx platform
2011-03-30 8:07 [PATCH 1/1] ARM: imx: Add sched_clock support to i.mx platform Frank Li
2011-03-30 8:31 ` Jamie Iles
2011-03-30 8:47 ` Uwe Kleine-König
@ 2011-03-30 8:57 ` Russell King - ARM Linux
2 siblings, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux @ 2011-03-30 8:57 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 30, 2011 at 04:07:51PM +0800, Frank Li wrote:
> From: Xinyu Chen <xinyu.chen@freescale.com>
>
> Add sched_clock() implement for i.mx platform to support nanosecond
> resolution time for sched clock used by scheduler.
NAK.
> diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
> index 9f0c261..de8a04f 100644
> --- a/arch/arm/plat-mxc/time.c
> +++ b/arch/arm/plat-mxc/time.c
> @@ -123,6 +123,15 @@ static struct clocksource clocksource_mxc = {
> .flags = CLOCK_SOURCE_IS_CONTINUOUS,
> };
>
> +unsigned long long sched_clock(void)
> +{
> + if (!timer_base)
> + return 0;
> +
> + return clocksource_cyc2ns(clocksource_mxc.read(&clocksource_mxc),
> + clocksource_mxc.mult, clocksource_mxc.shift);
> +}
This is buggy because it won't scale to the full 64-bit value which
sched_clock() requires. Please use the sched_clock() support I have
provided which ensures that a 32-bit counter is properly extended to
a full 64-bit value for sched_clock() - see arch/arm/kernel/sched_clock.c
and arch/arm/include/asm/sched_clock.h.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-30 8:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30 8:07 [PATCH 1/1] ARM: imx: Add sched_clock support to i.mx platform Frank Li
2011-03-30 8:31 ` Jamie Iles
2011-03-30 8:47 ` Uwe Kleine-König
2011-03-30 8:57 ` Russell King - ARM Linux
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).