[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zwq7LEbCluu3caLN@google.com>
Date: Sat, 12 Oct 2024 11:08:44 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: linux-kernel@...r.kernel.org, Adrian Hunter <adrian.hunter@...el.com>,
Anshuman Khandual <anshuman.khandual@....com>,
Ian Rogers <irogers@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Kan Liang <kan.liang@...ux.intel.com>,
Yury Norov <yury.norov@...il.com>
Subject: Re: [PATCH 1/1 fyi] tools headers UAPI: Sync linux/const.h with the
kernel headers
On Fri, Oct 11, 2024 at 03:23:20PM -0300, Arnaldo Carvalho de Melo wrote:
> tldr; Just FYI, I'm carrying this on the perf tools tree.
>
> Full explanation:
>
> There used to be no copies, with tools/ code using kernel headers
> directly. From time to time tools/perf/ broke due to legitimate kernel
> hacking. At some point Linus complained about such direct usage. Then we
> adopted the current model.
>
> The way these headers are used in perf are not restricted to just
> including them to compile something.
>
> There are sometimes used in scripts that convert defines into string
> tables, etc, so some change may break one of these scripts, or new MSRs
> may use some different #define pattern, etc.
>
> E.g.:
>
> $ ls -1 tools/perf/trace/beauty/*.sh | head -5
> tools/perf/trace/beauty/arch_errno_names.sh
> tools/perf/trace/beauty/drm_ioctl.sh
> tools/perf/trace/beauty/fadvise.sh
> tools/perf/trace/beauty/fsconfig.sh
> tools/perf/trace/beauty/fsmount.sh
> $
> $ tools/perf/trace/beauty/fadvise.sh
> static const char *fadvise_advices[] = {
> [0] = "NORMAL",
> [1] = "RANDOM",
> [2] = "SEQUENTIAL",
> [3] = "WILLNEED",
> [4] = "DONTNEED",
> [5] = "NOREUSE",
> };
> $
>
> The tools/perf/check-headers.sh script, part of the tools/ build
> process, points out changes in the original files.
>
> So its important not to touch the copies in tools/ when doing changes in
> the original kernel headers, that will be done later, when
> check-headers.sh inform about the change to the perf tools hackers.
I think you can mention tools/include/uapi/README. :)
Thanks,
Namhyung
>
> To pick up the changes in:
>
> 947697c6f0f75f98 ("uapi: Define GENMASK_U128")
>
> That causes no changes in tooling, just addresses this perf build
> warning:
>
> Warning: Kernel ABI header differences:
> diff -u tools/include/uapi/linux/const.h include/uapi/linux/const.h
>
> Cc: Adrian Hunter <adrian.hunter@...el.com>
> Cc: Anshuman Khandual <anshuman.khandual@....com>
> Cc: Ian Rogers <irogers@...gle.com>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Kan Liang <kan.liang@...ux.intel.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Yury Norov <yury.norov@...il.com>
> Link: https://lore.kernel.org/lkml/
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> ---
> tools/include/uapi/linux/const.h | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/tools/include/uapi/linux/const.h b/tools/include/uapi/linux/const.h
> index a429381e7ca507fe..e16be0d37746e14b 100644
> --- a/tools/include/uapi/linux/const.h
> +++ b/tools/include/uapi/linux/const.h
> @@ -28,6 +28,23 @@
> #define _BITUL(x) (_UL(1) << (x))
> #define _BITULL(x) (_ULL(1) << (x))
>
> +#if !defined(__ASSEMBLY__)
> +/*
> + * Missing asm support
> + *
> + * __BIT128() would not work in the asm code, as it shifts an
> + * 'unsigned __init128' data type as direct representation of
> + * 128 bit constants is not supported in the gcc compiler, as
> + * they get silently truncated.
> + *
> + * TODO: Please revisit this implementation when gcc compiler
> + * starts representing 128 bit constants directly like long
> + * and unsigned long etc. Subsequently drop the comment for
> + * GENMASK_U128() which would then start supporting asm code.
> + */
> +#define _BIT128(x) ((unsigned __int128)(1) << (x))
> +#endif
> +
> #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
> #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
>
> --
> 2.47.0
>
Powered by blists - more mailing lists