Re: [RFC PATCH 1/2] arm64/tracing: add cntvct based trace clock
From: Nicolas Saenz Julienne
Date: Wed Nov 24 2021 - 04:45:51 EST
On Mon, 2021-11-22 at 09:57 -0500, Steven Rostedt wrote:
> On Fri, 19 Nov 2021 11:21:17 +0100
> Nicolas Saenz Julienne <nsaenzju@xxxxxxxxxx> wrote:
>
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +#ifndef _ASM_ARM64_TRACE_CLOCK_H
> > +#define _ASM_ARM64_TRACE_CLOCK_H
> > +
> > +#include <linux/types.h>
> > +
> > +extern u64 notrace trace_clock_arm64_cntvct(void);
> > +
> > +# define ARCH_TRACE_CLOCKS \
> > + { trace_clock_arm64_cntvct, "cntvct", .in_ns = 0 },
> > +
> > +#endif /* _ASM_ARM64_TRACE_CLOCK_H */
>
> So this will appear as a usable clock in trace-cmd.
>
> And since this will be used to synchronize between host and guest like the
> x86_tsc is used, that means that trace-cmd needs to know that this is the
> an arch "CPU" clock. I wonder if we should rename x86_clock (or at least
> make it an alias) to "kvm_clock". Then we can have trace-cmd use
> "kvm_clock" as the clock for synchronization between host and guests for
> all architectures?
>
> Thinking about this, instead of renaming it, I'll add code to create an
> alias to these clocks. Then every arch can pick what clock is used that is
> the same between hosts and guests such that user space tooling doesn't have
> to keep a database of what clocks are used for synchronization between
> hosts and guests for each arch.
>
> I'll go add some code ;-)
I really like the idea, please keep me in the loop if you send something
upstream.
--
Nicolás Sáenz