Re: [PATCH 02/11] perf/x86: Add support for TSC as a perf event clock

From: Peter Zijlstra
Date: Wed Feb 09 2022 - 08:11:40 EST


On Wed, Feb 09, 2022 at 10:49:20AM +0200, Adrian Hunter wrote:
> diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
> index 82858b697c05..150d2b70a41f 100644
> --- a/include/uapi/linux/perf_event.h
> +++ b/include/uapi/linux/perf_event.h
> @@ -290,6 +290,14 @@ enum {
> PERF_TXN_ABORT_SHIFT = 32,
> };
>
> +/*
> + * If supported, clockid value to select an architecture dependent hardware
> + * clock. Note this means the unit of time is ticks not nanoseconds.
> + * On x86, this is provided by the rdtsc instruction, and is not
> + * paravirtualized.
> + */
> +#define CLOCK_PERF_HW_CLOCK 0x10000000

This steps on the clockid_t space; are we good with that?

At some point there was talk of dynamic clock ids, that would complicate
things more than they are today.