2013-04-18 19:30:21

by Rob Herring

[permalink] [raw]
Subject: [PATCH 1/2] clocksource: arm_arch_timer: unify sched_clock init

From: Rob Herring <[email protected]>

In preparation to fix initial time and suspend/resume handling, unify
the sched_clock init and implementation for arch timer on arm and arm64.

Signed-off-by: Rob Herring <[email protected]>
Cc: Russell King <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: John Stultz <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Stephen Boyd <[email protected]>
---
arch/arm/kernel/arch_timer.c | 12 ------------
arch/arm64/kernel/time.c | 10 ----------
drivers/clocksource/arm_arch_timer.c | 14 ++++++++++++++
include/clocksource/arm_arch_timer.h | 1 +
4 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index 59dcdce..df6825e 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -22,13 +22,6 @@ static unsigned long arch_timer_read_counter_long(void)
return arch_timer_read_counter();
}

-static u32 sched_clock_mult __read_mostly;
-
-static unsigned long long notrace arch_timer_sched_clock(void)
-{
- return arch_timer_read_counter() * sched_clock_mult;
-}
-
static struct delay_timer arch_delay_timer;

static void __init arch_timer_delay_timer_register(void)
@@ -48,11 +41,6 @@ int __init arch_timer_arch_init(void)

arch_timer_delay_timer_register();

- /* Cache the sched_clock multiplier to save a divide in the hot path. */
- sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;
sched_clock_func = arch_timer_sched_clock;
- pr_info("sched_clock: ARM arch timer >56 bits at %ukHz, resolution %uns\n",
- arch_timer_rate / 1000, sched_clock_mult);
-
return 0;
}
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index a551f88..3a369aa 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -61,13 +61,6 @@ unsigned long profile_pc(struct pt_regs *regs)
EXPORT_SYMBOL(profile_pc);
#endif

-static u64 sched_clock_mult __read_mostly;
-
-unsigned long long notrace sched_clock(void)
-{
- return arch_timer_read_counter() * sched_clock_mult;
-}
-
int read_current_timer(unsigned long *timer_value)
{
*timer_value = arch_timer_read_counter();
@@ -84,9 +77,6 @@ void __init time_init(void)
if (!arch_timer_rate)
panic("Unable to initialise architected timer.\n");

- /* Cache the sched_clock multiplier to save a divide in the hot path. */
- sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;
-
/* Calibrate the delay loop directly */
lpj_fine = arch_timer_rate / HZ;
}
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 122ff05..17ed8e4 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -266,6 +266,15 @@ static struct notifier_block arch_timer_cpu_nb __cpuinitdata = {
.notifier_call = arch_timer_cpu_notify,
};

+static u64 sched_clock_mult __read_mostly;
+
+unsigned long long notrace arch_timer_sched_clock(void)
+{
+ return arch_timer_read_counter() * sched_clock_mult;
+}
+unsigned long long sched_clock(void) \
+ __attribute__((weak, alias("arch_timer_sched_clock")));
+
static int __init arch_timer_register(void)
{
int err;
@@ -318,6 +327,11 @@ static int __init arch_timer_register(void)
/* Immediately configure the timer on the boot CPU */
arch_timer_setup(this_cpu_ptr(arch_timer_evt));

+ /* Cache the sched_clock multiplier to save a divide in the hot path. */
+ sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;
+ pr_info("sched_clock: ARM arch timer >56 bits at %ukHz, resolution %lluns\n",
+ arch_timer_rate / 1000, sched_clock_mult);
+
return 0;

out_free_irq:
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h
index e6c9c4c..ded7c77 100644
--- a/include/clocksource/arm_arch_timer.h
+++ b/include/clocksource/arm_arch_timer.h
@@ -34,6 +34,7 @@
extern u32 arch_timer_get_rate(void);
extern u64 (*arch_timer_read_counter)(void);
extern struct timecounter *arch_timer_get_timecounter(void);
+extern unsigned long long notrace arch_timer_sched_clock(void);

#else

--
1.7.10.4


2013-04-18 19:30:32

by Rob Herring

[permalink] [raw]
Subject: [PATCH 2/2] clocksource: arm_arch_timer: add boot and suspend sched_clock offset

From: Rob Herring <[email protected]>

Commit 023796b (ARM: arch_timer: use full 64-bit counter for sched_clock)
fails to ensure sched_clock always starts at time 0 and counting is
suspended during suspend. arm64 sched_clock support also has the same
issues. This fixes all architected timer users by maintaining an initial
offset which is updated on resume.

Signed-off-by: Rob Herring <[email protected]>
Cc: Russell King <[email protected]>
Cc: John Stultz <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Stephen Boyd <[email protected]>
---
arch/arm/kernel/arch_timer.c | 1 +
drivers/clocksource/arm_arch_timer.c | 26 +++++++++++++++++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index df6825e..9a517fe 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -42,5 +42,6 @@ int __init arch_timer_arch_init(void)
arch_timer_delay_timer_register();

sched_clock_func = arch_timer_sched_clock;
+
return 0;
}
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 17ed8e4..cc0bd67 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -17,6 +17,7 @@
#include <linux/interrupt.h>
#include <linux/of_irq.h>
#include <linux/io.h>
+#include <linux/syscore_ops.h>

#include <asm/arch_timer.h>
#include <asm/virt.h>
@@ -267,14 +268,34 @@ static struct notifier_block arch_timer_cpu_nb __cpuinitdata = {
};

static u64 sched_clock_mult __read_mostly;
+static u64 arch_timer_suspend_cyc;
+static u64 arch_timer_sched_clock_offset;

unsigned long long notrace arch_timer_sched_clock(void)
{
- return arch_timer_read_counter() * sched_clock_mult;
+ u64 cyc = arch_timer_read_counter() - arch_timer_sched_clock_offset;
+ return cyc * sched_clock_mult;
}
unsigned long long sched_clock(void) \
__attribute__((weak, alias("arch_timer_sched_clock")));

+static int arch_timer_suspend(void)
+{
+ arch_timer_suspend_cyc = arch_timer_read_counter();
+ return 0;
+}
+
+static void arch_timer_resume(void)
+{
+ arch_timer_sched_clock_offset +=
+ arch_timer_read_counter() - arch_timer_suspend_cyc;
+}
+
+static struct syscore_ops arch_timer_ops = {
+ .suspend = arch_timer_suspend,
+ .resume = arch_timer_resume,
+};
+
static int __init arch_timer_register(void)
{
int err;
@@ -332,6 +353,9 @@ static int __init arch_timer_register(void)
pr_info("sched_clock: ARM arch timer >56 bits at %ukHz, resolution %lluns\n",
arch_timer_rate / 1000, sched_clock_mult);

+ arch_timer_sched_clock_offset = arch_timer_read_counter();
+ register_syscore_ops(&arch_timer_ops);
+
return 0;

out_free_irq:
--
1.7.10.4

2013-04-19 00:00:26

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 1/2] clocksource: arm_arch_timer: unify sched_clock init

On 04/18/13 12:30, Rob Herring wrote:
> diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
> index 122ff05..17ed8e4 100644
> --- a/drivers/clocksource/arm_arch_timer.c
> +++ b/drivers/clocksource/arm_arch_timer.c
> @@ -266,6 +266,15 @@ static struct notifier_block arch_timer_cpu_nb __cpuinitdata = {
> .notifier_call = arch_timer_cpu_notify,
> };
>
> +static u64 sched_clock_mult __read_mostly;
> +
> +unsigned long long notrace arch_timer_sched_clock(void)
> +{
> + return arch_timer_read_counter() * sched_clock_mult;
> +}
> +unsigned long long sched_clock(void) \
> + __attribute__((weak, alias("arch_timer_sched_clock")));

I'm still lost, how does this prevent the timer in ARM's 32 bit
sched_clock code from getting setup in sched_clock_postinit()? That
print is still there right? Who owns sched_clock() in multi-target builds?

Why can't we play along with the sched_clock code that lives in arm?
Maybe we should resurrect those clocksource sched_clock patches again.
Or maybe we should add support for setup_sched_clock_64() in arm's sched
clock code.

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

2013-04-19 01:37:31

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 1/2] clocksource: arm_arch_timer: unify sched_clock init

On 04/18/2013 07:00 PM, Stephen Boyd wrote:
> On 04/18/13 12:30, Rob Herring wrote:
>> diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
>> index 122ff05..17ed8e4 100644
>> --- a/drivers/clocksource/arm_arch_timer.c
>> +++ b/drivers/clocksource/arm_arch_timer.c
>> @@ -266,6 +266,15 @@ static struct notifier_block arch_timer_cpu_nb __cpuinitdata = {
>> .notifier_call = arch_timer_cpu_notify,
>> };
>>
>> +static u64 sched_clock_mult __read_mostly;
>> +
>> +unsigned long long notrace arch_timer_sched_clock(void)
>> +{
>> + return arch_timer_read_counter() * sched_clock_mult;
>> +}
>> +unsigned long long sched_clock(void) \
>> + __attribute__((weak, alias("arch_timer_sched_clock")));
>
> I'm still lost, how does this prevent the timer in ARM's 32 bit
> sched_clock code from getting setup in sched_clock_postinit()? That
> print is still there right? Who owns sched_clock() in multi-target builds?

For arm64, it does not define sched_clock, so it will get
arch_timer_sched_clock.

For arm, sched_clock is defined in arch/arm/kernel/sched_clock.c and the
weak alias is not used. The arm sched_clock function just calls a
function pointer which defaults to sched_clock_32 (which is the original
arm sched_clock implementation). If the arch timer is present, then the
function pointer is set to arch_timer_sched_clock and any calls to
setup_sched_clock and the sched_clock_postinit have no effect.
Otherwise, the functionality is basically unchanged for <=32-bit
sched_clock implementations.

> Why can't we play along with the sched_clock code that lives in arm?
> Maybe we should resurrect those clocksource sched_clock patches again.
> Or maybe we should add support for setup_sched_clock_64() in arm's sched
> clock code.

That's what I originally had which Russell objected to. The needs for
the arch timer is a bit different since we don't need to deal with
wrapping. And we need the same boot time offset and suspend handling in
both arm and arm64.

Rob

2013-04-19 14:46:11

by Catalin Marinas

[permalink] [raw]
Subject: Re: [PATCH 1/2] clocksource: arm_arch_timer: unify sched_clock init

On Thu, Apr 18, 2013 at 08:30:09PM +0100, Rob Herring wrote:
> From: Rob Herring <[email protected]>
>
> In preparation to fix initial time and suspend/resume handling, unify
> the sched_clock init and implementation for arch timer on arm and arm64.
>
> Signed-off-by: Rob Herring <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Catalin Marinas <[email protected]>
> Cc: Will Deacon <[email protected]>
> Cc: John Stultz <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Stephen Boyd <[email protected]>

For arm64:

Acked-by: Catalin Marinas <[email protected]>

2013-04-19 14:46:26

by Catalin Marinas

[permalink] [raw]
Subject: Re: [PATCH 2/2] clocksource: arm_arch_timer: add boot and suspend sched_clock offset

On Thu, Apr 18, 2013 at 08:30:10PM +0100, Rob Herring wrote:
> From: Rob Herring <[email protected]>
>
> Commit 023796b (ARM: arch_timer: use full 64-bit counter for sched_clock)
> fails to ensure sched_clock always starts at time 0 and counting is
> suspended during suspend. arm64 sched_clock support also has the same
> issues. This fixes all architected timer users by maintaining an initial
> offset which is updated on resume.
>
> Signed-off-by: Rob Herring <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: John Stultz <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Catalin Marinas <[email protected]>
> Cc: Will Deacon <[email protected]>
> Cc: Stephen Boyd <[email protected]>

For arm64:

Acked-by: Catalin Marinas <[email protected]>

2013-04-19 17:34:19

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 1/2] clocksource: arm_arch_timer: unify sched_clock init

On 04/18/13 18:37, Rob Herring wrote:
> On 04/18/2013 07:00 PM, Stephen Boyd wrote:
>> On 04/18/13 12:30, Rob Herring wrote:
>>> diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
>>> index 122ff05..17ed8e4 100644
>>> --- a/drivers/clocksource/arm_arch_timer.c
>>> +++ b/drivers/clocksource/arm_arch_timer.c
>>> @@ -266,6 +266,15 @@ static struct notifier_block arch_timer_cpu_nb __cpuinitdata = {
>>> .notifier_call = arch_timer_cpu_notify,
>>> };
>>>
>>> +static u64 sched_clock_mult __read_mostly;
>>> +
>>> +unsigned long long notrace arch_timer_sched_clock(void)
>>> +{
>>> + return arch_timer_read_counter() * sched_clock_mult;
>>> +}
>>> +unsigned long long sched_clock(void) \
>>> + __attribute__((weak, alias("arch_timer_sched_clock")));
>> I'm still lost, how does this prevent the timer in ARM's 32 bit
>> sched_clock code from getting setup in sched_clock_postinit()? That
>> print is still there right?

I still see this:

[ 0.000000] sched_clock: ARM arch timer >56 bits at 19200kHz,
resolution 52ns
[ 0.000000] Architected cp15 timer running at 19.20MHz (virt).
[ 0.000000] Switching to timer-based delay loop
[ 0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns,
wraps every 4294967286ms


>> Who owns sched_clock() in multi-target builds?
> For arm64, it does not define sched_clock, so it will get
> arch_timer_sched_clock.
>
> For arm, sched_clock is defined in arch/arm/kernel/sched_clock.c and the
> weak alias is not used. The arm sched_clock function just calls a
> function pointer which defaults to sched_clock_32 (which is the original
> arm sched_clock implementation). If the arch timer is present, then the
> function pointer is set to arch_timer_sched_clock and any calls to
> setup_sched_clock and the sched_clock_postinit have no effect.
> Otherwise, the functionality is basically unchanged for <=32-bit
> sched_clock implementations.

Ok. I was missing the part where the function pointer is assigned.

>
>> Why can't we play along with the sched_clock code that lives in arm?
>> Maybe we should resurrect those clocksource sched_clock patches again.
>> Or maybe we should add support for setup_sched_clock_64() in arm's sched
>> clock code.
> That's what I originally had which Russell objected to. The needs for
> the arch timer is a bit different since we don't need to deal with
> wrapping. And we need the same boot time offset and suspend handling in
> both arm and arm64.
>

I would much rather we play along with arm's sched_clock code. If we can
add support for 64 bits alongside the 32 bit stuff in the same file we
should be able to generalize the entire code to generic kernel code and
use it on even more arches. I'll try to put something together today.

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

2013-04-20 00:29:12

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH 1/4] ARM: sched_clock: Remove unused needs_suspend member

The needs_suspend member is unused now that we always do the
suspend/resume handling (see 6a4dae5 (ARM: 7565/1: sched: stop
sched_clock() during suspend, 2012-10-23)).

Signed-off-by: Stephen Boyd <[email protected]>
---
arch/arm/kernel/sched_clock.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
index 8805848..48ab64a 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/arch/arm/kernel/sched_clock.c
@@ -24,7 +24,6 @@ struct clock_data {
u32 mult;
u32 shift;
bool suspended;
- bool needs_suspend;
};

static void sched_clock_poll(unsigned long wrap_ticks);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

2013-04-20 00:29:11

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH 0/4] ARM 64 bit sched_clock take #2

This is what I was thinking. I don't see why we can't move this to generic code and have arm64 use it too. Those patches will follow once I find an arm64
compiler.

First two patches should probably go in even if the 64 bit stuff doesn't go in
at the same time.

Stephen Boyd (4):
ARM: sched_clock: Remove unused needs_suspend member
ARM: sched_clock: Return suspended count earlier
ARM: sched_clock: Add support for >32 bit sched_clock
ARM: arch_timer: Move to setup_sched_clock_64()

arch/arm/include/asm/sched_clock.h | 5 +-
arch/arm/kernel/arch_timer.c | 14 +----
arch/arm/kernel/sched_clock.c | 111 ++++++++++++++++++++++++++-----------
3 files changed, 84 insertions(+), 46 deletions(-)

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

2013-04-20 00:29:40

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH 3/4] ARM: sched_clock: Add support for >32 bit sched_clock

The arm architected system counter has at least 56 bits of
useable bits. Add support to ARM's sched_clock implementation for
counters with more than 32 bits so we can avoid the complexity of
dealing with wraparound on these devices while benefiting from
the irqtime accounting and suspend/resume handling that the ARM
sched_clock code already has.

Signed-off-by: Stephen Boyd <[email protected]>
---

Maybe we need a union for the epoch_ns usage?

arch/arm/include/asm/sched_clock.h | 2 +
arch/arm/kernel/sched_clock.c | 101 +++++++++++++++++++++++++++----------
2 files changed, 77 insertions(+), 26 deletions(-)

diff --git a/arch/arm/include/asm/sched_clock.h b/arch/arm/include/asm/sched_clock.h
index 3d520dd..7fcd2ee 100644
--- a/arch/arm/include/asm/sched_clock.h
+++ b/arch/arm/include/asm/sched_clock.h
@@ -13,4 +13,6 @@ extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);

extern unsigned long long (*sched_clock_func)(void);

+extern void setup_sched_clock_64(u64 (*read)(void), int bits,
+ unsigned long rate);
#endif
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
index 29ac613..7875e9e 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/arch/arm/kernel/sched_clock.c
@@ -44,6 +44,7 @@ static u32 notrace jiffy_sched_clock_read(void)
}

static u32 __read_mostly (*read_sched_clock)(void) = jiffy_sched_clock_read;
+static u64 __read_mostly (*read_sched_clock_64)(void);

static inline u64 cyc_to_ns(u64 cyc, u32 mult, u32 shift)
{
@@ -104,24 +105,12 @@ static void sched_clock_poll(unsigned long wrap_ticks)
update_sched_clock();
}

-void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
+static u64 __init sched_clock_calc_wrap(int bits, unsigned long rate)
{
- unsigned long r, w;
+ unsigned long r;
u64 res, wrap;
char r_unit;

- if (cd.rate > rate)
- return;
-
- BUG_ON(bits > 32);
- WARN_ON(!irqs_disabled());
- read_sched_clock = read;
- sched_clock_mask = (1 << bits) - 1;
- cd.rate = rate;
-
- /* calculate the mult/shift to convert counter ticks to ns. */
- clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 0);
-
r = rate;
if (r >= 4000000) {
r /= 1000000;
@@ -135,12 +124,39 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
/* calculate how many ns until we wrap */
wrap = cyc_to_ns((1ULL << bits) - 1, cd.mult, cd.shift);
do_div(wrap, NSEC_PER_MSEC);
- w = wrap;

/* calculate the ns resolution of this counter */
res = cyc_to_ns(1ULL, cd.mult, cd.shift);
- pr_info("sched_clock: %u bits at %lu%cHz, resolution %lluns, wraps every %lums\n",
- bits, r, r_unit, res, w);
+ pr_info("sched_clock: %u bits at %lu%cHz, resolution %lluns, wraps every %llums\n",
+ bits, r, r_unit, res, wrap);
+
+ return wrap;
+}
+
+static void __init try_to_enable_irqtime(unsigned long rate)
+{
+ /* Enable IRQ time accounting if we have a fast enough sched_clock */
+ if (irqtime > 0 || (irqtime == -1 && rate >= 1000000))
+ enable_sched_clock_irqtime();
+}
+
+void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
+{
+ unsigned long w;
+
+ if (cd.rate > rate)
+ return;
+
+ BUG_ON(bits > 32);
+ WARN_ON(!irqs_disabled());
+ read_sched_clock = read;
+ sched_clock_mask = (1 << bits) - 1;
+ cd.rate = rate;
+
+ /* calculate the mult/shift to convert counter ticks to ns. */
+ clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 0);
+
+ w = sched_clock_calc_wrap(bits, rate);

/*
* Start the timer to keep sched_clock() properly updated and
@@ -154,9 +170,7 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
*/
cd.epoch_ns = 0;

- /* Enable IRQ time accounting if we have a fast enough sched_clock */
- if (irqtime > 0 || (irqtime == -1 && rate >= 1000000))
- enable_sched_clock_irqtime();
+ try_to_enable_irqtime(rate);

pr_debug("Registered %pF as sched_clock source\n", read);
}
@@ -169,6 +183,32 @@ static unsigned long long notrace sched_clock_32(void)

unsigned long long __read_mostly (*sched_clock_func)(void) = sched_clock_32;

+static unsigned long long notrace sched_clock_64(void)
+{
+ u64 cyc = read_sched_clock_64() - cd.epoch_ns;
+ return cyc * cd.mult;
+}
+
+void __init
+setup_sched_clock_64(u64 (*read)(void), int bits, unsigned long rate)
+{
+ if (cd.rate > rate)
+ return;
+
+ BUG_ON(bits <= 32);
+ WARN_ON(!irqs_disabled());
+ read_sched_clock_64 = read;
+ sched_clock_func = sched_clock_64;
+ cd.rate = rate;
+ cd.mult = NSEC_PER_SEC / rate;
+ cd.epoch_ns = read_sched_clock_64();
+
+ sched_clock_calc_wrap(bits, rate);
+
+ try_to_enable_irqtime(rate);
+ pr_debug("Registered %pF as %u bit sched_clock source\n", read, bits);
+}
+
unsigned long long notrace sched_clock(void)
{
if (cd.suspended)
@@ -181,25 +221,34 @@ void __init sched_clock_postinit(void)
{
/*
* If no sched_clock function has been provided at that point,
- * make it the final one one.
+ * make it the final one.
*/
- if (read_sched_clock == jiffy_sched_clock_read)
+ if (read_sched_clock == jiffy_sched_clock_read && !read_sched_clock_64)
setup_sched_clock(jiffy_sched_clock_read, 32, HZ);

- sched_clock_poll(sched_clock_timer.data);
+ if (sched_clock_func == sched_clock_32)
+ sched_clock_poll(sched_clock_timer.data);
}

static int sched_clock_suspend(void)
{
- sched_clock_poll(sched_clock_timer.data);
+ if (sched_clock_func == sched_clock_32)
+ sched_clock_poll(sched_clock_timer.data);
+ else
+ cd.epoch_ns = read_sched_clock_64();
+
cd.suspended = true;
return 0;
}

static void sched_clock_resume(void)
{
- cd.epoch_cyc = read_sched_clock();
- cd.epoch_cyc_copy = cd.epoch_cyc;
+ if (sched_clock_func == sched_clock_32) {
+ cd.epoch_cyc = read_sched_clock();
+ cd.epoch_cyc_copy = cd.epoch_cyc;
+ } else {
+ cd.epoch_ns += read_sched_clock_64() - cd.epoch_ns;
+ }
cd.suspended = false;
}

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

2013-04-20 00:29:38

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH 2/4] ARM: sched_clock: Return suspended count earlier

If we're suspended and sched_clock() is called we're going to
read the hardware one more time and throw away that value and
return back the cached value we saved during the suspend
callback. This is wasteful, let's short circuit all that and
return the cached value if we're suspended as early as possible.

Signed-off-by: Stephen Boyd <[email protected]>
---
arch/arm/kernel/sched_clock.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
index 48ab64a..29ac613 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/arch/arm/kernel/sched_clock.c
@@ -55,9 +55,6 @@ static unsigned long long cyc_to_sched_clock(u32 cyc, u32 mask)
u64 epoch_ns;
u32 epoch_cyc;

- if (cd.suspended)
- return cd.epoch_ns;
-
/*
* Load the epoch_cyc and epoch_ns atomically. We do this by
* ensuring that we always write epoch_cyc, epoch_ns and
@@ -174,6 +171,9 @@ unsigned long long __read_mostly (*sched_clock_func)(void) = sched_clock_32;

unsigned long long notrace sched_clock(void)
{
+ if (cd.suspended)
+ return cd.epoch_ns;
+
return sched_clock_func();
}

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

2013-04-20 00:29:37

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH 4/4] ARM: arch_timer: Move to setup_sched_clock_64()

Register with the ARM sched_clock framework now that it supports
64 bits. This also fixes two problems with the current sched_clock
support for machines using the archited timers. First off, we
don't subtract the start value from subsequent sched_clock calls
so we can potentially start off with sched_clock returning
gigantic numbers. Second, there is no support for suspend/resume
handling so problems such as discussed in 6a4dae5 (ARM: 7565/1:
sched: stop sched_clock() during suspend, 2012-10-23) can happen.

Signed-off-by: Stephen Boyd <[email protected]>
---
arch/arm/include/asm/sched_clock.h | 3 ---
arch/arm/kernel/arch_timer.c | 14 ++------------
arch/arm/kernel/sched_clock.c | 3 ++-
3 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/arch/arm/include/asm/sched_clock.h b/arch/arm/include/asm/sched_clock.h
index 7fcd2ee..e6f765a 100644
--- a/arch/arm/include/asm/sched_clock.h
+++ b/arch/arm/include/asm/sched_clock.h
@@ -10,9 +10,6 @@

extern void sched_clock_postinit(void);
extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
-
-extern unsigned long long (*sched_clock_func)(void);
-
extern void setup_sched_clock_64(u64 (*read)(void), int bits,
unsigned long rate);
#endif
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index 59dcdce..b45250b 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -22,13 +22,6 @@ static unsigned long arch_timer_read_counter_long(void)
return arch_timer_read_counter();
}

-static u32 sched_clock_mult __read_mostly;
-
-static unsigned long long notrace arch_timer_sched_clock(void)
-{
- return arch_timer_read_counter() * sched_clock_mult;
-}
-
static struct delay_timer arch_delay_timer;

static void __init arch_timer_delay_timer_register(void)
@@ -48,11 +41,8 @@ int __init arch_timer_arch_init(void)

arch_timer_delay_timer_register();

- /* Cache the sched_clock multiplier to save a divide in the hot path. */
- sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;
- sched_clock_func = arch_timer_sched_clock;
- pr_info("sched_clock: ARM arch timer >56 bits at %ukHz, resolution %uns\n",
- arch_timer_rate / 1000, sched_clock_mult);
+ /* 56 bits minimum, so we assume worst case rollover */
+ setup_sched_clock_64(arch_timer_read_counter, 56, arch_timer_rate);

return 0;
}
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
index 7875e9e..b6067d8 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/arch/arm/kernel/sched_clock.c
@@ -181,7 +181,8 @@ static unsigned long long notrace sched_clock_32(void)
return cyc_to_sched_clock(cyc, sched_clock_mask);
}

-unsigned long long __read_mostly (*sched_clock_func)(void) = sched_clock_32;
+static unsigned long long __read_mostly
+(*sched_clock_func)(void) = sched_clock_32;

static unsigned long long notrace sched_clock_64(void)
{
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

2013-04-22 10:49:25

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCH 3/4] ARM: sched_clock: Add support for >32 bit sched_clock

Hi Stephen,

On Sat, Apr 20, 2013 at 01:29:05AM +0100, Stephen Boyd wrote:
> The arm architected system counter has at least 56 bits of
> useable bits. Add support to ARM's sched_clock implementation for
> counters with more than 32 bits so we can avoid the complexity of
> dealing with wraparound on these devices while benefiting from
> the irqtime accounting and suspend/resume handling that the ARM
> sched_clock code already has.
>
> Signed-off-by: Stephen Boyd <[email protected]>
> ---
>
> Maybe we need a union for the epoch_ns usage?
>
> arch/arm/include/asm/sched_clock.h | 2 +
> arch/arm/kernel/sched_clock.c | 101 +++++++++++++++++++++++++++----------
> 2 files changed, 77 insertions(+), 26 deletions(-)
>
> diff --git a/arch/arm/include/asm/sched_clock.h b/arch/arm/include/asm/sched_clock.h
> index 3d520dd..7fcd2ee 100644
> --- a/arch/arm/include/asm/sched_clock.h
> +++ b/arch/arm/include/asm/sched_clock.h
> @@ -13,4 +13,6 @@ extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
>
> extern unsigned long long (*sched_clock_func)(void);
>
> +extern void setup_sched_clock_64(u64 (*read)(void), int bits,
> + unsigned long rate);

Curious, but why do we need two setup_sched_clock functions, where the bits
are passed as a parameter? Can't we just do the right thing if the clock
claims to be more than 32 bits wide (and get rid of the BUG_ONs at the same
time)?

Will

2013-04-22 15:17:33

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 0/4] ARM 64 bit sched_clock take #2

On Saturday 20 April 2013, Stephen Boyd wrote:
> This is what I was thinking. I don't see why we can't move this to generic code
> and have arm64 use it too. Those patches will follow once I find an arm64
> compiler.

I don't have enough background to review the patches, but I know that you can
find an arm64 compiler in Ubuntu Raring. If you are running that on one
of your sysstems, just 'apt-get install gcc-aarch64-linux-gnu'.

Arnd

2013-04-22 15:34:32

by Mark Rutland

[permalink] [raw]
Subject: Re: [PATCH 0/4] ARM 64 bit sched_clock take #2

Hi Stephen,

On Sat, Apr 20, 2013 at 01:29:02AM +0100, Stephen Boyd wrote:
> This is what I was thinking. I don't see why we can't move this to generic
> code and have arm64 use it too. Those patches will follow once I find an
> arm64 compiler.
>
> First two patches should probably go in even if the 64 bit stuff doesn't go in
> at the same time.
>
> Stephen Boyd (4):
> ARM: sched_clock: Remove unused needs_suspend member
> ARM: sched_clock: Return suspended count earlier
> ARM: sched_clock: Add support for >32 bit sched_clock
> ARM: arch_timer: Move to setup_sched_clock_64()
>
> arch/arm/include/asm/sched_clock.h | 5 +-
> arch/arm/kernel/arch_timer.c | 14 +----
> arch/arm/kernel/sched_clock.c | 111 ++++++++++++++++++++++++++-----------
> 3 files changed, 84 insertions(+), 46 deletions(-)

I wanted to look at the series with more context, but I don't seem to be able
to apply patch 2 and beyond to my tree, and I couldn't figure out what tree
this series was based on.

What do I need to use as the base for this series?

Thanks,
Mark.

2013-04-22 15:35:44

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 3/4] ARM: sched_clock: Add support for >32 bit sched_clock

On 04/22/13 03:48, Will Deacon wrote:
> Hi Stephen,
>
> On Sat, Apr 20, 2013 at 01:29:05AM +0100, Stephen Boyd wrote:
>> The arm architected system counter has at least 56 bits of
>> useable bits. Add support to ARM's sched_clock implementation for
>> counters with more than 32 bits so we can avoid the complexity of
>> dealing with wraparound on these devices while benefiting from
>> the irqtime accounting and suspend/resume handling that the ARM
>> sched_clock code already has.
>>
>> Signed-off-by: Stephen Boyd <[email protected]>
>> ---
>>
>> Maybe we need a union for the epoch_ns usage?
>>
>> arch/arm/include/asm/sched_clock.h | 2 +
>> arch/arm/kernel/sched_clock.c | 101 +++++++++++++++++++++++++++----------
>> 2 files changed, 77 insertions(+), 26 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/sched_clock.h b/arch/arm/include/asm/sched_clock.h
>> index 3d520dd..7fcd2ee 100644
>> --- a/arch/arm/include/asm/sched_clock.h
>> +++ b/arch/arm/include/asm/sched_clock.h
>> @@ -13,4 +13,6 @@ extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
>>
>> extern unsigned long long (*sched_clock_func)(void);
>>
>> +extern void setup_sched_clock_64(u64 (*read)(void), int bits,
>> + unsigned long rate);
> Curious, but why do we need two setup_sched_clock functions, where the bits
> are passed as a parameter? Can't we just do the right thing if the clock
> claims to be more than 32 bits wide (and get rid of the BUG_ONs at the same
> time)?

This is to avoid having to change a bunch of code that is using
setup_sched_clock() already where their read function returns a u32
instead of a u64. I suppose we could make the 64 bit version fall back
to the 32 bit version if the bits aren't large enough and provide some
sort of u32 wrapper function around the u64 callback. It may also be
useful if we can determine that the timer wraps too quickly even when
there are more than 32 bits.

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

2013-04-22 15:36:17

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 0/4] ARM 64 bit sched_clock take #2

On 04/22/13 08:34, Mark Rutland wrote:
> Hi Stephen,
>
> On Sat, Apr 20, 2013 at 01:29:02AM +0100, Stephen Boyd wrote:
>> This is what I was thinking. I don't see why we can't move this to generic
>> code and have arm64 use it too. Those patches will follow once I find an
>> arm64 compiler.
>>
>> First two patches should probably go in even if the 64 bit stuff doesn't go in
>> at the same time.
>>
>> Stephen Boyd (4):
>> ARM: sched_clock: Remove unused needs_suspend member
>> ARM: sched_clock: Return suspended count earlier
>> ARM: sched_clock: Add support for >32 bit sched_clock
>> ARM: arch_timer: Move to setup_sched_clock_64()
>>
>> arch/arm/include/asm/sched_clock.h | 5 +-
>> arch/arm/kernel/arch_timer.c | 14 +----
>> arch/arm/kernel/sched_clock.c | 111 ++++++++++++++++++++++++++-----------
>> 3 files changed, 84 insertions(+), 46 deletions(-)
> I wanted to look at the series with more context, but I don't seem to be able
> to apply patch 2 and beyond to my tree, and I couldn't figure out what tree
> this series was based on.
>
> What do I need to use as the base for this series?

These are based on next-20130419.

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

2013-04-22 15:52:14

by Mark Rutland

[permalink] [raw]
Subject: Re: [PATCH 0/4] ARM 64 bit sched_clock take #2

On Mon, Apr 22, 2013 at 04:36:14PM +0100, Stephen Boyd wrote:
> On 04/22/13 08:34, Mark Rutland wrote:
> > Hi Stephen,
> >
> > On Sat, Apr 20, 2013 at 01:29:02AM +0100, Stephen Boyd wrote:
> >> This is what I was thinking. I don't see why we can't move this to generic
> >> code and have arm64 use it too. Those patches will follow once I find an
> >> arm64 compiler.
> >>
> >> First two patches should probably go in even if the 64 bit stuff doesn't go in
> >> at the same time.
> >>
> >> Stephen Boyd (4):
> >> ARM: sched_clock: Remove unused needs_suspend member
> >> ARM: sched_clock: Return suspended count earlier
> >> ARM: sched_clock: Add support for >32 bit sched_clock
> >> ARM: arch_timer: Move to setup_sched_clock_64()
> >>
> >> arch/arm/include/asm/sched_clock.h | 5 +-
> >> arch/arm/kernel/arch_timer.c | 14 +----
> >> arch/arm/kernel/sched_clock.c | 111 ++++++++++++++++++++++++++-----------
> >> 3 files changed, 84 insertions(+), 46 deletions(-)
> > I wanted to look at the series with more context, but I don't seem to be able
> > to apply patch 2 and beyond to my tree, and I couldn't figure out what tree
> > this series was based on.
> >
> > What do I need to use as the base for this series?
>
> These are based on next-20130419.

Cheers!

Mark.

2013-04-22 17:00:45

by John Stultz

[permalink] [raw]
Subject: Re: [PATCH 0/4] ARM 64 bit sched_clock take #2

On 04/19/2013 05:29 PM, Stephen Boyd wrote:
> This is what I was thinking. I don't see why we can't move this to generic code and have arm64 use it too. Those patches will follow once I find an arm64
> compiler.

I think moving this to generic code sounds like a good idea. You could
probably also prototype and test the 64bit code with x86_64, using the
TSC counter.

thanks
-john

2013-04-22 20:46:53

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 0/4] ARM 64 bit sched_clock take #2

On 04/22/2013 12:00 PM, John Stultz wrote:
> On 04/19/2013 05:29 PM, Stephen Boyd wrote:
>> This is what I was thinking. I don't see why we can't move this to
>> generic code and have arm64 use it too. Those patches will follow once
>> I find an arm64
>> compiler.
>
> I think moving this to generic code sounds like a good idea. You could
> probably also prototype and test the 64bit code with x86_64, using the
> TSC counter.

I agree this should all be common, but I'd like to see the common
version first. That is not going to make it for 3.10. For 3.10, the
immediate need is to fix suspend and initial time for the arch timer. I
think this should be fixed locally in arch timer code for 3.10. The
alternative is to revert linux-next commit 023796b9be3a77481cd5 (ARM:
arch_timer: use full 64-bit counter for sched_clock) which will cause
the arch timer to not be used as sched_clock if another higher frequency
sched_clock is registered.

Rob

2013-04-23 16:34:55

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 0/4] ARM 64 bit sched_clock take #2

On 04/22/13 13:46, Rob Herring wrote:
> On 04/22/2013 12:00 PM, John Stultz wrote:
>> On 04/19/2013 05:29 PM, Stephen Boyd wrote:
>>> This is what I was thinking. I don't see why we can't move this to
>>> generic code and have arm64 use it too. Those patches will follow once
>>> I find an arm64
>>> compiler.
>> I think moving this to generic code sounds like a good idea. You could
>> probably also prototype and test the 64bit code with x86_64, using the
>> TSC counter.
> I agree this should all be common, but I'd like to see the common
> version first. That is not going to make it for 3.10. For 3.10, the
> immediate need is to fix suspend and initial time for the arch timer. I
> think this should be fixed locally in arch timer code for 3.10. The
> alternative is to revert linux-next commit 023796b9be3a77481cd5 (ARM:
> arch_timer: use full 64-bit counter for sched_clock) which will cause
> the arch timer to not be used as sched_clock if another higher frequency
> sched_clock is registered.

This would make sense to me if we were already in the 3.10-rc1 or rc2
phase, but this code isn't even in Linus' tree yet. Why can't we just
fix it properly before sending off to Linus? Obviously this is up to the
maintainers to decide, so if we can't fix it properly with this patch
series I propose we revert like you say.

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

2013-05-01 00:54:48

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH 6/4] arm64: Move to generic sched_clock infrastructure

Use the generic sched_clock infrastructure instead of rolling our
own. This has the added benefit of fixing suspend/resume as
outlined in 6a4dae5 (ARM: 7565/1: sched: stop sched_clock()
during suspend, 2012-10-23) and correcting the timestamps when
the hardware returns a value instead of 0 upon the first read.

Signed-off-by: Stephen Boyd <[email protected]>
---
arch/arm64/Kconfig | 1 +
arch/arm64/kernel/time.c | 11 ++---------
2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 4f4c418..b941cca 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -13,6 +13,7 @@ config ARM64
select GENERIC_IOMAP
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
+ select GENERIC_SCHED_CLOCK
select GENERIC_SMP_IDLE_THREAD
select GENERIC_TIME_VSYSCALL
select HARDIRQS_SW_RESEND
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index a551f88..fd07ef9 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -33,6 +33,7 @@
#include <linux/irq.h>
#include <linux/delay.h>
#include <linux/clocksource.h>
+#include <linux/sched_clock.h>

#include <clocksource/arm_arch_timer.h>

@@ -61,13 +62,6 @@ unsigned long profile_pc(struct pt_regs *regs)
EXPORT_SYMBOL(profile_pc);
#endif

-static u64 sched_clock_mult __read_mostly;
-
-unsigned long long notrace sched_clock(void)
-{
- return arch_timer_read_counter() * sched_clock_mult;
-}
-
int read_current_timer(unsigned long *timer_value)
{
*timer_value = arch_timer_read_counter();
@@ -84,8 +78,7 @@ void __init time_init(void)
if (!arch_timer_rate)
panic("Unable to initialise architected timer.\n");

- /* Cache the sched_clock multiplier to save a divide in the hot path. */
- sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;
+ setup_sched_clock_64(arch_timer_read_counter, 56, arch_timer_rate);

/* Calibrate the delay loop directly */
lpj_fine = arch_timer_rate / HZ;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

2013-05-01 00:55:07

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH 5/4] sched: Make ARM's sched_clock generic for all architectures

Here's the patch to make sched_clock generic. I didn't know
where to put it so I just made a new file in kernel/sched
for now.

Signed-off-by: Stephen Boyd <[email protected]>
---

arch/arm/Kconfig | 1 +
arch/arm/common/timer-sp.c | 2 +-
arch/arm/kernel/Makefile | 2 +-
arch/arm/kernel/arch_timer.c | 2 +-
arch/arm/kernel/time.c | 4 +---
arch/arm/mach-davinci/time.c | 2 +-
arch/arm/mach-imx/time.c | 2 +-
arch/arm/mach-integrator/integrator_ap.c | 2 +-
arch/arm/mach-ixp4xx/common.c | 2 +-
arch/arm/mach-mmp/time.c | 2 +-
arch/arm/mach-msm/timer.c | 2 +-
arch/arm/mach-omap1/time.c | 2 +-
arch/arm/mach-omap2/timer.c | 2 +-
arch/arm/mach-pxa/time.c | 2 +-
arch/arm/mach-sa1100/time.c | 2 +-
arch/arm/mach-u300/timer.c | 2 +-
arch/arm/plat-iop/time.c | 2 +-
arch/arm/plat-omap/counter_32k.c | 2 +-
arch/arm/plat-orion/time.c | 2 +-
arch/arm/plat-samsung/samsung-time.c | 2 +-
arch/arm/plat-versatile/sched-clock.c | 2 +-
drivers/clocksource/bcm2835_timer.c | 2 +-
drivers/clocksource/clksrc-dbx500-prcmu.c | 3 +--
drivers/clocksource/dw_apb_timer_of.c | 2 +-
drivers/clocksource/mxs_timer.c | 2 +-
drivers/clocksource/nomadik-mtu.c | 2 +-
drivers/clocksource/tegra20_timer.c | 2 +-
drivers/clocksource/time-armada-370-xp.c | 2 +-
drivers/clocksource/timer-marco.c | 2 +-
drivers/clocksource/timer-prima2.c | 2 +-
{arch/arm/include/asm => include/linux}/sched_clock.h | 9 +++++++--
init/Kconfig | 3 +++
init/main.c | 2 ++
kernel/sched/Makefile | 1 +
{arch/arm/kernel => kernel/sched}/sched_clock.c | 3 +--
35 files changed, 44 insertions(+), 36 deletions(-)
rename {arch/arm/include/asm => include/linux}/sched_clock.h (76%)
rename {arch/arm/kernel => kernel/sched}/sched_clock.c (99%)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 10c3466..ce1a020 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -14,6 +14,7 @@ config ARM
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
select GENERIC_PCI_IOMAP
+ select GENERIC_SCHED_CLOCK
select GENERIC_SMP_IDLE_THREAD
select GENERIC_IDLE_LOOP
select GENERIC_IDLE_POLL_SETUP
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index ddc7407..023ee63 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -28,8 +28,8 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
+#include <linux/sched_clock.h>

-#include <asm/sched_clock.h>
#include <asm/hardware/arm_timer.h>
#include <asm/hardware/timer-sp.h>

diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 00d703c..44ea2de 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -16,7 +16,7 @@ CFLAGS_REMOVE_return_address.o = -pg
# Object file lists.

obj-y := elf.o entry-common.o irq.o opcodes.o \
- process.o ptrace.o return_address.o sched_clock.o \
+ process.o ptrace.o return_address.o \
setup.o signal.o stacktrace.o sys_arm.o time.o traps.o

obj-$(CONFIG_ATAGS) += atags_parse.o
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index b45250b..e1ea2bf 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -11,9 +11,9 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/errno.h>
+#include <linux/sched_clock.h>

#include <asm/delay.h>
-#include <asm/sched_clock.h>

#include <clocksource/arm_arch_timer.h>

diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index abff4e9..98aee32 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -24,9 +24,9 @@
#include <linux/timer.h>
#include <linux/clocksource.h>
#include <linux/irq.h>
+#include <linux/sched_clock.h>

#include <asm/thread_info.h>
-#include <asm/sched_clock.h>
#include <asm/stacktrace.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
@@ -120,6 +120,4 @@ void __init time_init(void)
machine_desc->init_time();
else
clocksource_of_init();
-
- sched_clock_postinit();
}
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index bad361e..7a55b5c 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -18,8 +18,8 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/platform_device.h>
+#include <linux/sched_clock.h>

-#include <asm/sched_clock.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>

diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index fea9131..cd46529 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -26,8 +26,8 @@
#include <linux/clockchips.h>
#include <linux/clk.h>
#include <linux/err.h>
+#include <linux/sched_clock.h>

-#include <asm/sched_clock.h>
#include <asm/mach/time.h>

#include "common.h"
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index b23c8e4..aa43462 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -41,6 +41,7 @@
#include <linux/stat.h>
#include <linux/sys_soc.h>
#include <linux/termios.h>
+#include <linux/sched_clock.h>
#include <video/vga.h>

#include <mach/hardware.h>
@@ -49,7 +50,6 @@
#include <asm/setup.h>
#include <asm/param.h> /* HZ */
#include <asm/mach-types.h>
-#include <asm/sched_clock.h>

#include <mach/lm.h>
#include <mach/irqs.h>
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 6600cff..58307cf 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -30,6 +30,7 @@
#include <linux/export.h>
#include <linux/gpio.h>
#include <linux/cpu.h>
+#include <linux/sched_clock.h>

#include <mach/udc.h>
#include <mach/hardware.h>
@@ -38,7 +39,6 @@
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/irq.h>
-#include <asm/sched_clock.h>
#include <asm/system_misc.h>

#include <asm/mach/map.h>
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index 86a18b3..7ac41e8 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -28,8 +28,8 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
+#include <linux/sched_clock.h>

-#include <asm/sched_clock.h>
#include <mach/addr-map.h>
#include <mach/regs-timers.h>
#include <mach/regs-apbc.h>
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 284313f..b6418fd 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -23,10 +23,10 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
+#include <linux/sched_clock.h>

#include <asm/mach/time.h>
#include <asm/localtimer.h>
-#include <asm/sched_clock.h>

#include "common.h"

diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 726ec23..80603d2 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -43,9 +43,9 @@
#include <linux/clocksource.h>
#include <linux/clockchips.h>
#include <linux/io.h>
+#include <linux/sched_clock.h>

#include <asm/irq.h>
-#include <asm/sched_clock.h>

#include <mach/hardware.h>
#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index ce57228..6e7885e 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -41,10 +41,10 @@
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/platform_data/dmtimer-omap.h>
+#include <linux/sched_clock.h>

#include <asm/mach/time.h>
#include <asm/smp_twd.h>
-#include <asm/sched_clock.h>

#include "omap_hwmod.h"
#include "omap_device.h"
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index 8f1ee92..9aa852a 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -16,11 +16,11 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/clockchips.h>
+#include <linux/sched_clock.h>

#include <asm/div64.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>
-#include <asm/sched_clock.h>
#include <mach/regs-ost.h>
#include <mach/irqs.h>

diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index a59a13a..713c86c 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -14,9 +14,9 @@
#include <linux/irq.h>
#include <linux/timex.h>
#include <linux/clockchips.h>
+#include <linux/sched_clock.h>

#include <asm/mach/time.h>
-#include <asm/sched_clock.h>
#include <mach/hardware.h>
#include <mach/irqs.h>

diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
index d9e7320..af771b7 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/arch/arm/mach-u300/timer.c
@@ -18,12 +18,12 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/irq.h>
+#include <linux/sched_clock.h>

#include <mach/hardware.h>
#include <mach/irqs.h>

/* Generic stuff */
-#include <asm/sched_clock.h>
#include <asm/mach/map.h>
#include <asm/mach/time.h>

diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
index 837a2d5..29606bd7 100644
--- a/arch/arm/plat-iop/time.c
+++ b/arch/arm/plat-iop/time.c
@@ -22,9 +22,9 @@
#include <linux/clocksource.h>
#include <linux/clockchips.h>
#include <linux/export.h>
+#include <linux/sched_clock.h>
#include <mach/hardware.h>
#include <asm/irq.h>
-#include <asm/sched_clock.h>
#include <asm/uaccess.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index 5b0b86b..d9bc98e 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -18,9 +18,9 @@
#include <linux/err.h>
#include <linux/io.h>
#include <linux/clocksource.h>
+#include <linux/sched_clock.h>

#include <asm/mach/time.h>
-#include <asm/sched_clock.h>

#include <plat/counter-32k.h>

diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c
index 5d5ac0f..9d2b2ac 100644
--- a/arch/arm/plat-orion/time.c
+++ b/arch/arm/plat-orion/time.c
@@ -16,7 +16,7 @@
#include <linux/clockchips.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
-#include <asm/sched_clock.h>
+#include <linux/sched_clock.h>

/*
* MBus bridge block registers.
diff --git a/arch/arm/plat-samsung/samsung-time.c b/arch/arm/plat-samsung/samsung-time.c
index f899cbc..2957075 100644
--- a/arch/arm/plat-samsung/samsung-time.c
+++ b/arch/arm/plat-samsung/samsung-time.c
@@ -15,12 +15,12 @@
#include <linux/clk.h>
#include <linux/clockchips.h>
#include <linux/platform_device.h>
+#include <linux/sched_clock.h>

#include <asm/smp_twd.h>
#include <asm/mach/time.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
-#include <asm/sched_clock.h>

#include <mach/map.h>
#include <plat/devs.h>
diff --git a/arch/arm/plat-versatile/sched-clock.c b/arch/arm/plat-versatile/sched-clock.c
index b33b74c..51b109e 100644
--- a/arch/arm/plat-versatile/sched-clock.c
+++ b/arch/arm/plat-versatile/sched-clock.c
@@ -20,8 +20,8 @@
*/
#include <linux/kernel.h>
#include <linux/io.h>
+#include <linux/sched_clock.h>

-#include <asm/sched_clock.h>
#include <plat/sched_clock.h>

static void __iomem *ctr;
diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
index 766611d..07ea7ce 100644
--- a/drivers/clocksource/bcm2835_timer.c
+++ b/drivers/clocksource/bcm2835_timer.c
@@ -28,8 +28,8 @@
#include <linux/of_platform.h>
#include <linux/slab.h>
#include <linux/string.h>
+#include <linux/sched_clock.h>

-#include <asm/sched_clock.h>
#include <asm/irq.h>

#define REG_CONTROL 0x00
diff --git a/drivers/clocksource/clksrc-dbx500-prcmu.c b/drivers/clocksource/clksrc-dbx500-prcmu.c
index 54f3d11..0a7fb24 100644
--- a/drivers/clocksource/clksrc-dbx500-prcmu.c
+++ b/drivers/clocksource/clksrc-dbx500-prcmu.c
@@ -14,8 +14,7 @@
*/
#include <linux/clockchips.h>
#include <linux/clksrc-dbx500-prcmu.h>
-
-#include <asm/sched_clock.h>
+#include <linux/sched_clock.h>

#define RATE_32K 32768

diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index ab09ed3..f417e50 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -20,9 +20,9 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
+#include <linux/sched_clock.h>

#include <asm/mach/time.h>
-#include <asm/sched_clock.h>

static void timer_get_base_and_rate(struct device_node *np,
void __iomem **base, u32 *rate)
diff --git a/drivers/clocksource/mxs_timer.c b/drivers/clocksource/mxs_timer.c
index 02af420..0f5e65f 100644
--- a/drivers/clocksource/mxs_timer.c
+++ b/drivers/clocksource/mxs_timer.c
@@ -29,9 +29,9 @@
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/stmp_device.h>
+#include <linux/sched_clock.h>

#include <asm/mach/time.h>
-#include <asm/sched_clock.h>

/*
* There are 2 versions of the timrot on Freescale MXS-based SoCs.
diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c
index 071f6ea..e747fb1 100644
--- a/drivers/clocksource/nomadik-mtu.c
+++ b/drivers/clocksource/nomadik-mtu.c
@@ -18,8 +18,8 @@
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/platform_data/clocksource-nomadik-mtu.h>
+#include <linux/sched_clock.h>
#include <asm/mach/time.h>
-#include <asm/sched_clock.h>

/*
* The MTU device hosts four different counters, with 4 set of
diff --git a/drivers/clocksource/tegra20_timer.c b/drivers/clocksource/tegra20_timer.c
index ae877b0..9396170 100644
--- a/drivers/clocksource/tegra20_timer.c
+++ b/drivers/clocksource/tegra20_timer.c
@@ -26,10 +26,10 @@
#include <linux/io.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
+#include <linux/sched_clock.h>

#include <asm/mach/time.h>
#include <asm/smp_twd.h>
-#include <asm/sched_clock.h>

#define RTC_SECONDS 0x08
#define RTC_SHADOW_SECONDS 0x0c
diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
index 47a6730..efdca32 100644
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -27,8 +27,8 @@
#include <linux/of_address.h>
#include <linux/irq.h>
#include <linux/module.h>
+#include <linux/sched_clock.h>

-#include <asm/sched_clock.h>
#include <asm/localtimer.h>
#include <linux/percpu.h>
/*
diff --git a/drivers/clocksource/timer-marco.c b/drivers/clocksource/timer-marco.c
index 97738db..e5dc912 100644
--- a/drivers/clocksource/timer-marco.c
+++ b/drivers/clocksource/timer-marco.c
@@ -17,7 +17,7 @@
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
-#include <asm/sched_clock.h>
+#include <linux/sched_clock.h>
#include <asm/localtimer.h>
#include <asm/mach/time.h>

diff --git a/drivers/clocksource/timer-prima2.c b/drivers/clocksource/timer-prima2.c
index 7608826..ef3cfb2 100644
--- a/drivers/clocksource/timer-prima2.c
+++ b/drivers/clocksource/timer-prima2.c
@@ -18,7 +18,7 @@
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
-#include <asm/sched_clock.h>
+#include <linux/sched_clock.h>
#include <asm/mach/time.h>

#define SIRFSOC_TIMER_COUNTER_LO 0x0000
diff --git a/arch/arm/include/asm/sched_clock.h b/include/linux/sched_clock.h
similarity index 76%
rename from arch/arm/include/asm/sched_clock.h
rename to include/linux/sched_clock.h
index e6f765a..495d4c6 100644
--- a/arch/arm/include/asm/sched_clock.h
+++ b/include/linux/sched_clock.h
@@ -5,10 +5,15 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#ifndef ASM_SCHED_CLOCK
-#define ASM_SCHED_CLOCK
+#ifndef LINUX_SCHED_CLOCK
+#define LINUX_SCHED_CLOCK

+#ifdef CONFIG_GENERIC_SCHED_CLOCK
extern void sched_clock_postinit(void);
+#else
+static inline void sched_clock_postinit(void) { }
+#endif
+
extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
extern void setup_sched_clock_64(u64 (*read)(void), int bits,
unsigned long rate);
diff --git a/init/Kconfig b/init/Kconfig
index 346cd1b..19237b6 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -772,6 +772,9 @@ config LOG_BUF_SHIFT
config HAVE_UNSTABLE_SCHED_CLOCK
bool

+config GENERIC_SCHED_CLOCK
+ bool
+
#
# For architectures that want to enable the support for NUMA-affine scheduler
# balancing logic:
diff --git a/init/main.c b/init/main.c
index b3bc3c9..0e5504e 100644
--- a/init/main.c
+++ b/init/main.c
@@ -72,6 +72,7 @@
#include <linux/ptrace.h>
#include <linux/blkdev.h>
#include <linux/elevator.h>
+#include <linux/sched_clock.h>

#include <asm/io.h>
#include <asm/bugs.h>
@@ -552,6 +553,7 @@ asmlinkage void __init start_kernel(void)
softirq_init();
timekeeping_init();
time_init();
+ sched_clock_postinit();
profile_init();
call_function_init();
WARN(!irqs_disabled(), "Interrupts were enabled early\n");
diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index deaf90e..35abe4a 100644
--- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o
obj-$(CONFIG_SCHEDSTATS) += stats.o
obj-$(CONFIG_SCHED_DEBUG) += debug.o
obj-$(CONFIG_CGROUP_CPUACCT) += cpuacct.o
+obj-$(CONFIG_GENERIC_SCHED_CLOCK) += sched_clock.o
diff --git a/arch/arm/kernel/sched_clock.c b/kernel/sched/sched_clock.c
similarity index 99%
rename from arch/arm/kernel/sched_clock.c
rename to kernel/sched/sched_clock.c
index b6067d8..7556349 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/kernel/sched/sched_clock.c
@@ -13,8 +13,7 @@
#include <linux/sched.h>
#include <linux/syscore_ops.h>
#include <linux/timer.h>
-
-#include <asm/sched_clock.h>
+#include <linux/sched_clock.h>

struct clock_data {
u64 epoch_ns;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

2013-05-01 09:12:42

by Catalin Marinas

[permalink] [raw]
Subject: Re: [PATCH 6/4] arm64: Move to generic sched_clock infrastructure

On Wed, May 01, 2013 at 01:54:35AM +0100, Stephen Boyd wrote:
> Use the generic sched_clock infrastructure instead of rolling our
> own. This has the added benefit of fixing suspend/resume as
> outlined in 6a4dae5 (ARM: 7565/1: sched: stop sched_clock()
> during suspend, 2012-10-23) and correcting the timestamps when
> the hardware returns a value instead of 0 upon the first read.
>
> Signed-off-by: Stephen Boyd <[email protected]>

Looks ok.

Acked-by: Catalin Marinas <[email protected]>

2013-05-01 14:44:38

by Christopher Covington

[permalink] [raw]
Subject: Re: [PATCH 6/4] arm64: Move to generic sched_clock infrastructure

On 05/01/2013 05:11 AM, Catalin Marinas wrote:
> On Wed, May 01, 2013 at 01:54:35AM +0100, Stephen Boyd wrote:
>> Use the generic sched_clock infrastructure instead of rolling our
>> own. This has the added benefit of fixing suspend/resume as
>> outlined in 6a4dae5 (ARM: 7565/1: sched: stop sched_clock()
>> during suspend, 2012-10-23) and correcting the timestamps when
>> the hardware returns a value instead of 0 upon the first read.
>>
>> Signed-off-by: Stephen Boyd <[email protected]>
>
> Looks ok.
>
> Acked-by: Catalin Marinas <[email protected]>

I built and ran this change and dependencies on top of Catalin's
soc-armv8-model branch [1] and was able to verify that it fixed the printk
timestamp jump.

1.
http://git.kernel.org/cgit/linux/kernel/git/cmarinas/linux-aarch64.git/log/?h=soc-armv8-model

Tested-by: Christopher Covington <[email protected]>

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.

2013-05-31 20:40:57

by John Stultz

[permalink] [raw]
Subject: Re: [PATCH 5/4] sched: Make ARM's sched_clock generic for all architectures

On 04/30/2013 05:54 PM, Stephen Boyd wrote:
> Here's the patch to make sched_clock generic. I didn't know
> where to put it so I just made a new file in kernel/sched
> for now.
>
> Signed-off-by: Stephen Boyd <[email protected]>

Hey Stephen,
Baruch just asked a question about moving arm's sched_clock.c to be
generic, and it sounded familiar, so I dug around and found this mail
from a few months ago.

Just wanted to follow up and see what the status is with this? Is this
queued somewhere already?

thanks
-john

2013-05-31 22:14:06

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 5/4] sched: Make ARM's sched_clock generic for all architectures

On 05/31, John Stultz wrote:
> On 04/30/2013 05:54 PM, Stephen Boyd wrote:
> >Here's the patch to make sched_clock generic. I didn't know
> >where to put it so I just made a new file in kernel/sched
> >for now.
> >
> >Signed-off-by: Stephen Boyd <[email protected]>
>
> Hey Stephen,
> Baruch just asked a question about moving arm's sched_clock.c to
> be generic, and it sounded familiar, so I dug around and found this
> mail from a few months ago.
>
> Just wanted to follow up and see what the status is with this? Is
> this queued somewhere already?
>

As far as I know nothing has been queued. I refreshed the
patchset against 3.10-rc2 but haven't sent it out since it wasn't
clear if anyone wanted it. Shall I send it again?

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

2013-05-31 23:50:12

by John Stultz

[permalink] [raw]
Subject: Re: [PATCH 5/4] sched: Make ARM's sched_clock generic for all architectures

On 05/31/2013 03:13 PM, Stephen Boyd wrote:
> On 05/31, John Stultz wrote:
>> On 04/30/2013 05:54 PM, Stephen Boyd wrote:
>>> Here's the patch to make sched_clock generic. I didn't know
>>> where to put it so I just made a new file in kernel/sched
>>> for now.
>>>
>>> Signed-off-by: Stephen Boyd <[email protected]>
>> Hey Stephen,
>> Baruch just asked a question about moving arm's sched_clock.c to
>> be generic, and it sounded familiar, so I dug around and found this
>> mail from a few months ago.
>>
>> Just wanted to follow up and see what the status is with this? Is
>> this queued somewhere already?
>>
> As far as I know nothing has been queued. I refreshed the
> patchset against 3.10-rc2 but haven't sent it out since it wasn't
> clear if anyone wanted it. Shall I send it again?

Please. Even if it need an eventual deeper rework to be totally generic,
I think we need to start moving things in that generic direction.
Baruch's case is a clear example where non-arm code could share it, so I
think that's at least a good proof point that sharing is actually needed
(rather then just for theoretical reasons).

thanks
-john