From: Julien Grall <julien.grall@arm.com>
To: Benjamin Sanda <ben.sanda@dornerworks.com>,
xen-devel@lists.xenproject.org
Cc: sstabellini@kernel.org, Wei Liu <wei.liu2@citrix.com>,
George Dunlap <george.dunlap@eu.citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v3 3/5] xentrace: Timestamp support for ARM platform
Date: Fri, 8 Apr 2016 11:50:56 +0100 [thread overview]
Message-ID: <57078D10.1000609@arm.com> (raw)
In-Reply-To: <1459795727-3116-4-git-send-email-ben.sanda@dornerworks.com>
Hello Benjamin,
On 04/04/16 19:48, Benjamin Sanda wrote:
> Moved get_cycles() to time.c and modified to return the core timestamp
> tick count for use by the trace buffer timestamping routines in
> xentrace. get_cycles() was moved to the C file to avoid including the
> register specific header file in time.h and to commonize it with the
> get_s_time() function. Also defined cycles_t as uint64_t to simplify
> casting.
I'm not sure what you mean by "simplify casting".
The type cycles_t is not correctly defined for ARM32 because "unsigned
long" is always 32-bits. However, the physical count register (CNTPCT)
is always 64-bits. So the number of cycles would have been truncated.
The rest of the patch looks good to me.
> get_s_time() was also modified to now use the updated get_cycles() to
> retrieve the tick count instead of directly reading it.
>
> Signed-off-by: Benjamin Sanda <ben.sanda@dornerworks.com>
>
> ---
> Changed since v2:
> * Combined v2 patches 7 and 6 into one patch in v3. No code change.
>
> ---
> Changed since v1:
> * Moved get_cycles() to time.c
> * Added function prototype for get_cycles()
> ---
> xen/arch/arm/time.c | 9 ++++++++-
> xen/include/asm-arm/time.h | 11 +++++------
> 2 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
> index 7dae28b..9aface3 100644
> --- a/xen/arch/arm/time.c
> +++ b/xen/arch/arm/time.c
> @@ -192,10 +192,17 @@ int __init init_xen_time(void)
> /* Return number of nanoseconds since boot */
> s_time_t get_s_time(void)
> {
> - uint64_t ticks = READ_SYSREG64(CNTPCT_EL0) - boot_count;
> + cycles_t ticks = get_cycles();
> return ticks_to_ns(ticks);
> }
>
> +/* Return the number of ticks since boot */
> +cycles_t get_cycles(void)
> +{
> + /* return raw tick count of main timer */
> + return READ_SYSREG64(CNTPCT_EL0) - boot_count;
> +}
> +
> /* Set the timer to wake us up at a particular time.
> * Timeout is a Xen system time (nanoseconds since boot); 0 disables the timer.
> * Returns 1 on success; 0 if the timeout is too soon or is in the past. */
> diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h
> index 5b9a31d..b57f4c1 100644
> --- a/xen/include/asm-arm/time.h
> +++ b/xen/include/asm-arm/time.h
> @@ -5,12 +5,8 @@
> DT_MATCH_COMPATIBLE("arm,armv7-timer"), \
> DT_MATCH_COMPATIBLE("arm,armv8-timer")
>
> -typedef unsigned long cycles_t;
> -
> -static inline cycles_t get_cycles (void)
> -{
> - return 0;
> -}
> +/* Tick count type */
> +typedef uint64_t cycles_t;
>
> /* List of timer's IRQ */
> enum timer_ppi
> @@ -37,6 +33,9 @@ extern void init_timer_interrupt(void);
> /* Counter value at boot time */
> extern uint64_t boot_count;
>
> +/* Get raw system tick count */
> +cycles_t get_cycles(void);
> +
> extern s_time_t ticks_to_ns(uint64_t ticks);
> extern uint64_t ns_to_ticks(s_time_t ns);
>
>
Regards,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-04-08 10:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-04 18:48 [PATCH v3 0/5] xentrace/xenalyze Support on ARM Benjamin Sanda
2016-04-04 18:48 ` [PATCH v3 1/5] xentrace: Common Support for get_pg_owner/put_pg_owner on ARM and x86 Benjamin Sanda
2016-04-04 23:05 ` Andrew Cooper
2016-04-05 8:12 ` Jan Beulich
2016-04-14 19:59 ` Ben Sanda
2016-04-17 7:58 ` Jan Beulich
2016-04-04 18:48 ` [PATCH v3 2/5] xentrace: Memory/Page Mapping support for DOMID_XEN on ARM Benjamin Sanda
2016-04-08 10:42 ` Julien Grall
2016-04-08 15:49 ` Jan Beulich
2016-04-08 17:58 ` Andrew Cooper
2016-04-11 9:52 ` George Dunlap
2016-04-12 15:53 ` Julien Grall
2016-04-14 19:52 ` Ben Sanda
2016-04-20 12:48 ` Julien Grall
2016-04-22 9:42 ` Stefano Stabellini
2016-04-22 17:01 ` Julien Grall
2016-04-04 18:48 ` [PATCH v3 3/5] xentrace: Timestamp support for ARM platform Benjamin Sanda
2016-04-08 10:50 ` Julien Grall [this message]
2016-04-11 14:56 ` Konrad Rzeszutek Wilk
2016-04-04 18:48 ` [PATCH v3 4/5] xentrace: Trace Buffer Initialization on ARM Benjamin Sanda
2016-04-08 10:53 ` Julien Grall
2016-04-04 18:48 ` [PATCH v3 5/5] xenalyze: Build for Both ARM and x86 Platforms Benjamin Sanda
2016-04-05 8:09 ` [PATCH v3 0/5] xentrace/xenalyze Support on ARM Jan Beulich
2016-04-06 16:51 ` Ben Sanda
2016-04-06 16:59 ` Andrew Cooper
2016-04-06 17:03 ` Ben Sanda
2016-04-08 14:44 ` George Dunlap
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=57078D10.1000609@arm.com \
--to=julien.grall@arm.com \
--cc=andrew.cooper3@citrix.com \
--cc=ben.sanda@dornerworks.com \
--cc=george.dunlap@eu.citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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 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.