[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3bcac42-f268-fe65-b871-3d5e3718a30b@intel.com>
Date: Wed, 28 Apr 2021 16:16:45 +0300
From: Adrian Hunter <adrian.hunter@...el.com>
To: Leo Yan <leo.yan@...aro.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Steve MacLean <Steve.MacLean@...rosoft.com>,
Yonatan Goldschmidt <yonatan.goldschmidt@...nulate.io>,
Kan Liang <kan.liang@...ux.intel.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/4] perf tool: Change fields type in
perf_record_time_conv
On 28/04/21 3:09 pm, Leo Yan wrote:
> C standard claims "An object declared as type _Bool is large enough to
> store the values 0 and 1", bool type size can be 1 byte or larger than
> 1 byte. Thus it's uncertian for bool type size with different
> compilers.
>
> This patch changes the bool type in structure perf_record_time_conv to
> __u8 type, and pads extra bytes for 8-byte alignment; this can give
> reliable structure size.
>
> Suggested-by: Adrian Hunter <adrian.hunter@...el.com>
> Fixes: d110162cafc8 ("perf tsc: Support cap_user_time_short for event TIME_CONV")
> Signed-off-by: Leo Yan <leo.yan@...aro.org>
Acked-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
> tools/lib/perf/include/perf/event.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/perf/include/perf/event.h b/tools/lib/perf/include/perf/event.h
> index d82054225fcc..48583e441d9b 100644
> --- a/tools/lib/perf/include/perf/event.h
> +++ b/tools/lib/perf/include/perf/event.h
> @@ -346,8 +346,9 @@ struct perf_record_time_conv {
> __u64 time_zero;
> __u64 time_cycles;
> __u64 time_mask;
> - bool cap_user_time_zero;
> - bool cap_user_time_short;
> + __u8 cap_user_time_zero;
> + __u8 cap_user_time_short;
> + __u8 reserved[6]; /* For alignment */
> };
>
> struct perf_record_header_feature {
>
Powered by blists - more mailing lists