public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clocksource: arm_arch_timer: print timer value at init time
Date: Sat, 4 Feb 2017 09:41:18 +0100	[thread overview]
Message-ID: <20170204084118.GB2160@mai> (raw)
In-Reply-To: <1482169657-15773-1-git-send-email-olof@lixom.net>

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

  parent reply	other threads:[~2017-02-04  8:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 17:47 [PATCH] clocksource: arm_arch_timer: print timer value at init time Olof Johansson
2017-02-04  0:08 ` Olof Johansson
2017-02-04  8:41 ` Daniel Lezcano [this message]
2017-02-06 17:41   ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170204084118.GB2160@mai \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox