Re: [PATCH 12/12] clocksource: Add some debug info about clocksources being registered

2015-03-11 Thread John Stultz
On Sat, Mar 7, 2015 at 1:50 AM, Ingo Molnar  wrote:
>
> * John Stultz  wrote:
>
>> Print the mask, max_cycles, and max_idle_ns values for clocksources
>> being registered.
>>
>> Cc: Dave Jones 
>> Cc: Linus Torvalds 
>> Cc: Thomas Gleixner 
>> Cc: Richard Cochran 
>> Cc: Prarit Bhargava 
>> Cc: Stephen Boyd 
>> Cc: Ingo Molnar 
>> Cc: Peter Zijlstra 
>> Signed-off-by: John Stultz 
>> ---
>>  kernel/time/clocksource.c | 4 
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
>> index 3f24bb3..9b75316 100644
>> --- a/kernel/time/clocksource.c
>> +++ b/kernel/time/clocksource.c
>> @@ -697,6 +697,10 @@ void __clocksource_updatefreq_scale(struct clocksource 
>> *cs, u32 scale, u32 freq)
>
> So that name should really be something like 
> __clocksource_update_freq_scale(),
> right?

Sure, I can add an extra patch to address that...


>>   cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
>>cs->maxadj, cs->mask,
>>&cs->max_cycles);
>> +
>> + pr_info("clocksource %s: mask: 0x%llx max_cycles: 0x%llx, max_idle_ns: 
>> %lld ns\n",
>> + cs->name, cs->mask, cs->max_cycles, cs->max_idle_ns);
>> +
>
> Also, why is this function exported? No in-tree module uses it.

So, its mostly due to the fact that the inline function
__clocksource_updatefreq_hz() in clocksource.h uses it, which may be
used by some clocksources in their enable() hooks. And those
clocksources may be compiled as a module.


> Also, when I read the code, I noticed:
>
> /**
>  * __clocksource_updatefreq_scale - Used update clocksource with new freq
>  * @cs: clocksource to be registered
>  * @scale:  Scale factor multiplied against freq to get clocksource hz
>  * @freq:   clocksource frequency (cycles per second) divided by scale
>  *
>  * This should only be called from the clocksource->enable() method.
>  *
>  * This *SHOULD NOT* be called directly! Please use the
>  * clocksource_updatefreq_hz() or clocksource_updatefreq_khz helper functions.
>
> One more reason to not export it?
>
> Also, typo in the description.
>
> Plus, one helper function is marked with '()', the other not ...

I'll address that in the new patch as well.

thanks
-john
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 12/12] clocksource: Add some debug info about clocksources being registered

2015-03-07 Thread Ingo Molnar

* John Stultz  wrote:

> Print the mask, max_cycles, and max_idle_ns values for clocksources
> being registered.
> 
> Cc: Dave Jones 
> Cc: Linus Torvalds 
> Cc: Thomas Gleixner 
> Cc: Richard Cochran 
> Cc: Prarit Bhargava 
> Cc: Stephen Boyd 
> Cc: Ingo Molnar 
> Cc: Peter Zijlstra 
> Signed-off-by: John Stultz 
> ---
>  kernel/time/clocksource.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
> index 3f24bb3..9b75316 100644
> --- a/kernel/time/clocksource.c
> +++ b/kernel/time/clocksource.c
> @@ -697,6 +697,10 @@ void __clocksource_updatefreq_scale(struct clocksource 
> *cs, u32 scale, u32 freq)

So that name should really be something like __clocksource_update_freq_scale(),
right?

>   cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
>cs->maxadj, cs->mask,
>&cs->max_cycles);
> +
> + pr_info("clocksource %s: mask: 0x%llx max_cycles: 0x%llx, max_idle_ns: 
> %lld ns\n",
> + cs->name, cs->mask, cs->max_cycles, cs->max_idle_ns);
> +

Also, why is this function exported? No in-tree module uses it.

Also, when I read the code, I noticed:

/**
 * __clocksource_updatefreq_scale - Used update clocksource with new freq
 * @cs: clocksource to be registered
 * @scale:  Scale factor multiplied against freq to get clocksource hz
 * @freq:   clocksource frequency (cycles per second) divided by scale
 *
 * This should only be called from the clocksource->enable() method.
 *
 * This *SHOULD NOT* be called directly! Please use the
 * clocksource_updatefreq_hz() or clocksource_updatefreq_khz helper functions.

One more reason to not export it?

Also, typo in the description.

Plus, one helper function is marked with '()', the other not ...

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/12] clocksource: Add some debug info about clocksources being registered

2015-03-06 Thread John Stultz
Print the mask, max_cycles, and max_idle_ns values for clocksources
being registered.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 kernel/time/clocksource.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 3f24bb3..9b75316 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -697,6 +697,10 @@ void __clocksource_updatefreq_scale(struct clocksource 
*cs, u32 scale, u32 freq)
cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
 cs->maxadj, cs->mask,
 &cs->max_cycles);
+
+   pr_info("clocksource %s: mask: 0x%llx max_cycles: 0x%llx, max_idle_ns: 
%lld ns\n",
+   cs->name, cs->mask, cs->max_cycles, cs->max_idle_ns);
+
 }
 EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/12] clocksource: Add some debug info about clocksources being registered

2015-01-22 Thread John Stultz
Print the mask, max_cycles, and max_idle_ns values for clocksources
being registered.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 kernel/time/clocksource.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index b56f4b9..ec7b552 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -773,6 +773,10 @@ void __clocksource_updatefreq_scale(struct clocksource 
*cs, u32 scale, u32 freq)
cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
 cs->maxadj, cs->mask,
 &cs->max_cycles);
+
+   pr_info("clocksource %s: mask: 0x%llx max_cycles: 0x%llx, max_idle_ns: 
%lld ns\n",
+   cs->name, cs->mask, cs->max_cycles, cs->max_idle_ns);
+
 }
 EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/