All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource: arm_arch_timer: print timer value at init time
@ 2016-12-19 17:47 ` Olof Johansson
  0 siblings, 0 replies; 8+ messages in thread
From: Olof Johansson @ 2016-12-19 17:47 UTC (permalink / raw)
  To: mark.rutland, marc.zyngier
  Cc: daniel.lezcano, tglx, linux-arm-kernel, linux-kernel, Olof Johansson

This is useful to get an indication of how much time we spent in firmware.

It's not guaranteed that the timer started at 0 on reset, so it's just
an approximation, and might very well be invalid on some systems. But
it's still a useful metric to have access to.

Signed-off-by: Olof Johansson <olof@lixom.net>
---
 drivers/clocksource/arm_arch_timer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 02fef68..c26078b 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -521,6 +521,8 @@ arch_timer_detect_rate(void __iomem *cntbase, struct device_node *np)
 
 static void arch_timer_banner(unsigned type)
 {
+	unsigned long cnt = arch_timer_read_counter();
+
 	pr_info("Architected %s%s%s timer(s) running at %lu.%02luMHz (%s%s%s).\n",
 		     type & ARCH_CP15_TIMER ? "cp15" : "",
 		     type == (ARCH_CP15_TIMER | ARCH_MEM_TIMER) ?  " and " : "",
@@ -534,6 +536,8 @@ static void arch_timer_banner(unsigned type)
 		     type & ARCH_MEM_TIMER ?
 			arch_timer_mem_use_virtual ? "virt" : "phys" :
 			"");
+	pr_info("Initial timer value: 0x%lx: %ld.%02lds\n",
+		cnt, cnt/arch_timer_rate, (cnt/(arch_timer_rate/100)) % 100);
 }
 
 u32 arch_timer_get_rate(void)
-- 
2.8.0.rc3.29.gb552ff8

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] clocksource: arm_arch_timer: print timer value at init time
@ 2016-12-19 17:47 ` Olof Johansson
  0 siblings, 0 replies; 8+ messages in thread
From: Olof Johansson @ 2016-12-19 17:47 UTC (permalink / raw)
  To: linux-arm-kernel

This is useful to get an indication of how much time we spent in firmware.

It's not guaranteed that the timer started at 0 on reset, so it's just
an approximation, and might very well be invalid on some systems. But
it's still a useful metric to have access to.

Signed-off-by: Olof Johansson <olof@lixom.net>
---
 drivers/clocksource/arm_arch_timer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 02fef68..c26078b 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -521,6 +521,8 @@ arch_timer_detect_rate(void __iomem *cntbase, struct device_node *np)
 
 static void arch_timer_banner(unsigned type)
 {
+	unsigned long cnt = arch_timer_read_counter();
+
 	pr_info("Architected %s%s%s timer(s) running at %lu.%02luMHz (%s%s%s).\n",
 		     type & ARCH_CP15_TIMER ? "cp15" : "",
 		     type == (ARCH_CP15_TIMER | ARCH_MEM_TIMER) ?  " and " : "",
@@ -534,6 +536,8 @@ static void arch_timer_banner(unsigned type)
 		     type & ARCH_MEM_TIMER ?
 			arch_timer_mem_use_virtual ? "virt" : "phys" :
 			"");
+	pr_info("Initial timer value: 0x%lx: %ld.%02lds\n",
+		cnt, cnt/arch_timer_rate, (cnt/(arch_timer_rate/100)) % 100);
 }
 
 u32 arch_timer_get_rate(void)
-- 
2.8.0.rc3.29.gb552ff8

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] clocksource: arm_arch_timer: print timer value at init time
  2016-12-19 17:47 ` Olof Johansson
@ 2017-02-04  0:08   ` Olof Johansson
  -1 siblings, 0 replies; 8+ messages in thread
From: Olof Johansson @ 2017-02-04  0:08 UTC (permalink / raw)
  To: Mark Rutland, Marc Zyngier
  Cc: Daniel Lezcano, Thomas Gleixner, linux-arm-kernel, linux-kernel,
	Olof Johansson

On Mon, Dec 19, 2016 at 9:47 AM, Olof Johansson <olof@lixom.net> wrote:
> This is useful to get an indication of how much time we spent in firmware.
>
> It's not guaranteed that the timer started at 0 on reset, so it's just
> an approximation, and might very well be invalid on some systems. But
> it's still a useful metric to have access to.
>
> Signed-off-by: Olof Johansson <olof@lixom.net>

Friendly ping. Would be nice to see this land in 4.11.


Thanks,

-Olof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] clocksource: arm_arch_timer: print timer value at init time
@ 2017-02-04  0:08   ` Olof Johansson
  0 siblings, 0 replies; 8+ messages in thread
From: Olof Johansson @ 2017-02-04  0:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Dec 19, 2016 at 9:47 AM, Olof Johansson <olof@lixom.net> wrote:
> This is useful to get an indication of how much time we spent in firmware.
>
> It's not guaranteed that the timer started at 0 on reset, so it's just
> an approximation, and might very well be invalid on some systems. But
> it's still a useful metric to have access to.
>
> Signed-off-by: Olof Johansson <olof@lixom.net>

Friendly ping. Would be nice to see this land in 4.11.


Thanks,

-Olof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] clocksource: arm_arch_timer: print timer value at init time
  2016-12-19 17:47 ` Olof Johansson
@ 2017-02-04  8:41   ` Daniel Lezcano
  -1 siblings, 0 replies; 8+ messages in thread
From: Daniel Lezcano @ 2017-02-04  8:41 UTC (permalink / raw)
  To: Olof Johansson
  Cc: mark.rutland, marc.zyngier, daniel.lezcano, tglx,
	linux-arm-kernel, linux-kernel

On Mon, Dec 19, 2016 at 09:47:37AM -0800, Olof Johansson wrote:
> This is useful to get an indication of how much time we spent in firmware.
> 
> It's not guaranteed that the timer started at 0 on reset, so it's just
> an approximation, and might very well be invalid on some systems. But
> it's still a useful metric to have access to.

Hi Olof,

[ ... ]

> --- a/drivers/clocksource/arm_arch_timer.c
> +++ b/drivers/clocksource/arm_arch_timer.c
> @@ -521,6 +521,8 @@ arch_timer_detect_rate(void __iomem *cntbase, struct device_node *np)
>  
>  static void arch_timer_banner(unsigned type)
>  {
> +	unsigned long cnt = arch_timer_read_counter();
> +

arch_timer_banner() is called before arch_counter_register() where the
arch_timer_read_counter() function pointer is set.

Perhaps the arch_timer_banner() and arch_counter_register() should be swapped in
arch_timer_common_init().

>  	pr_info("Architected %s%s%s timer(s) running at %lu.%02luMHz (%s%s%s).\n",
>  		     type & ARCH_CP15_TIMER ? "cp15" : "",
>  		     type == (ARCH_CP15_TIMER | ARCH_MEM_TIMER) ?  " and " : "",
> @@ -534,6 +536,8 @@ static void arch_timer_banner(unsigned type)
>  		     type & ARCH_MEM_TIMER ?
>  			arch_timer_mem_use_virtual ? "virt" : "phys" :
>  			"");
> +	pr_info("Initial timer value: 0x%lx: %ld.%02lds\n",
> +		cnt, cnt/arch_timer_rate, (cnt/(arch_timer_rate/100)) % 100);
>  }
>  

-- 

 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] clocksource: arm_arch_timer: print timer value at init time
@ 2017-02-04  8:41   ` Daniel Lezcano
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Lezcano @ 2017-02-04  8:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Dec 19, 2016 at 09:47:37AM -0800, Olof Johansson wrote:
> This is useful to get an indication of how much time we spent in firmware.
> 
> It's not guaranteed that the timer started at 0 on reset, so it's just
> an approximation, and might very well be invalid on some systems. But
> it's still a useful metric to have access to.

Hi Olof,

[ ... ]

> --- a/drivers/clocksource/arm_arch_timer.c
> +++ b/drivers/clocksource/arm_arch_timer.c
> @@ -521,6 +521,8 @@ arch_timer_detect_rate(void __iomem *cntbase, struct device_node *np)
>  
>  static void arch_timer_banner(unsigned type)
>  {
> +	unsigned long cnt = arch_timer_read_counter();
> +

arch_timer_banner() is called before arch_counter_register() where the
arch_timer_read_counter() function pointer is set.

Perhaps the arch_timer_banner() and arch_counter_register() should be swapped in
arch_timer_common_init().

>  	pr_info("Architected %s%s%s timer(s) running at %lu.%02luMHz (%s%s%s).\n",
>  		     type & ARCH_CP15_TIMER ? "cp15" : "",
>  		     type == (ARCH_CP15_TIMER | ARCH_MEM_TIMER) ?  " and " : "",
> @@ -534,6 +536,8 @@ static void arch_timer_banner(unsigned type)
>  		     type & ARCH_MEM_TIMER ?
>  			arch_timer_mem_use_virtual ? "virt" : "phys" :
>  			"");
> +	pr_info("Initial timer value: 0x%lx: %ld.%02lds\n",
> +		cnt, cnt/arch_timer_rate, (cnt/(arch_timer_rate/100)) % 100);
>  }
>  

-- 

 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] clocksource: arm_arch_timer: print timer value at init time
  2017-02-04  8:41   ` Daniel Lezcano
@ 2017-02-06 17:41     ` Mark Rutland
  -1 siblings, 0 replies; 8+ messages in thread
From: Mark Rutland @ 2017-02-06 17:41 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Olof Johansson, marc.zyngier, daniel.lezcano, tglx,
	linux-arm-kernel, linux-kernel

On Sat, Feb 04, 2017 at 09:41:18AM +0100, Daniel Lezcano wrote:
> On Mon, Dec 19, 2016 at 09:47:37AM -0800, Olof Johansson wrote:
> > This is useful to get an indication of how much time we spent in firmware.
> > 
> > It's not guaranteed that the timer started at 0 on reset, so it's just
> > an approximation, and might very well be invalid on some systems. But
> > it's still a useful metric to have access to.
> 
> Hi Olof,
> 
> [ ... ]
> 
> > --- a/drivers/clocksource/arm_arch_timer.c
> > +++ b/drivers/clocksource/arm_arch_timer.c
> > @@ -521,6 +521,8 @@ arch_timer_detect_rate(void __iomem *cntbase, struct device_node *np)
> >  
> >  static void arch_timer_banner(unsigned type)
> >  {
> > +	unsigned long cnt = arch_timer_read_counter();
> > +
> 
> arch_timer_banner() is called before arch_counter_register() where the
> arch_timer_read_counter() function pointer is set.
> 
> Perhaps the arch_timer_banner() and arch_counter_register() should be swapped in
> arch_timer_common_init().

That would make sense to me.

> >  	pr_info("Architected %s%s%s timer(s) running at %lu.%02luMHz (%s%s%s).\n",
> >  		     type & ARCH_CP15_TIMER ? "cp15" : "",
> >  		     type == (ARCH_CP15_TIMER | ARCH_MEM_TIMER) ?  " and " : "",
> > @@ -534,6 +536,8 @@ static void arch_timer_banner(unsigned type)
> >  		     type & ARCH_MEM_TIMER ?
> >  			arch_timer_mem_use_virtual ? "virt" : "phys" :
> >  			"");
> > +	pr_info("Initial timer value: 0x%lx: %ld.%02lds\n",
> > +		cnt, cnt/arch_timer_rate, (cnt/(arch_timer_rate/100)) % 100);

Our tiemrs should be precise enough to give us a few more digits here
(e.g. down to ns, like printk). Are there any helpers we can use to do
that?

It would also be nice to log which counter we're reading from.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] clocksource: arm_arch_timer: print timer value at init time
@ 2017-02-06 17:41     ` Mark Rutland
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Rutland @ 2017-02-06 17:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Feb 04, 2017 at 09:41:18AM +0100, Daniel Lezcano wrote:
> On Mon, Dec 19, 2016 at 09:47:37AM -0800, Olof Johansson wrote:
> > This is useful to get an indication of how much time we spent in firmware.
> > 
> > It's not guaranteed that the timer started at 0 on reset, so it's just
> > an approximation, and might very well be invalid on some systems. But
> > it's still a useful metric to have access to.
> 
> Hi Olof,
> 
> [ ... ]
> 
> > --- a/drivers/clocksource/arm_arch_timer.c
> > +++ b/drivers/clocksource/arm_arch_timer.c
> > @@ -521,6 +521,8 @@ arch_timer_detect_rate(void __iomem *cntbase, struct device_node *np)
> >  
> >  static void arch_timer_banner(unsigned type)
> >  {
> > +	unsigned long cnt = arch_timer_read_counter();
> > +
> 
> arch_timer_banner() is called before arch_counter_register() where the
> arch_timer_read_counter() function pointer is set.
> 
> Perhaps the arch_timer_banner() and arch_counter_register() should be swapped in
> arch_timer_common_init().

That would make sense to me.

> >  	pr_info("Architected %s%s%s timer(s) running at %lu.%02luMHz (%s%s%s).\n",
> >  		     type & ARCH_CP15_TIMER ? "cp15" : "",
> >  		     type == (ARCH_CP15_TIMER | ARCH_MEM_TIMER) ?  " and " : "",
> > @@ -534,6 +536,8 @@ static void arch_timer_banner(unsigned type)
> >  		     type & ARCH_MEM_TIMER ?
> >  			arch_timer_mem_use_virtual ? "virt" : "phys" :
> >  			"");
> > +	pr_info("Initial timer value: 0x%lx: %ld.%02lds\n",
> > +		cnt, cnt/arch_timer_rate, (cnt/(arch_timer_rate/100)) % 100);

Our tiemrs should be precise enough to give us a few more digits here
(e.g. down to ns, like printk). Are there any helpers we can use to do
that?

It would also be nice to log which counter we're reading from.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-02-06 17:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 17:47 [PATCH] clocksource: arm_arch_timer: print timer value at init time Olof Johansson
2016-12-19 17:47 ` Olof Johansson
2017-02-04  0:08 ` Olof Johansson
2017-02-04  0:08   ` Olof Johansson
2017-02-04  8:41 ` Daniel Lezcano
2017-02-04  8:41   ` Daniel Lezcano
2017-02-06 17:41   ` Mark Rutland
2017-02-06 17:41     ` Mark Rutland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.