From: Yury Norov <yury.norov@gmail.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Adrian Hunter <adrian.hunter@intel.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>,
Kan Liang <kan.liang@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH 1/1 fyi] tools headers: Synchronize {uapi/}linux/bits.h with the kernel sources
Date: Mon, 28 Oct 2024 07:40:51 -0700 [thread overview]
Message-ID: <Zx-icwjwSxT1T9K5@yury-ThinkPad> (raw)
In-Reply-To: <Zx-ZVH7bHqtFn8Dv@x1>
On Mon, Oct 28, 2024 at 11:01:56AM -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.
>
> See further details at:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/include/uapi/README
>
> To pick up the changes in this cset:
>
> 947697c6f0f75f98 ("uapi: Define GENMASK_U128")
>
> This addresses these perf build warnings:
>
> Warning: Kernel ABI header differences:
> diff -u tools/include/uapi/linux/bits.h include/uapi/linux/bits.h
> diff -u tools/include/linux/bits.h include/linux/bits.h
>
> Please see tools/include/uapi/README for further details.
>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kan Liang <kan.liang@linux.intel.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Yury Norov <yury.norov@gmail.com>
> Link: https://lore.kernel.org/lkml/
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Thanks,
Acked-by: Yury Norov <yury.norov@gmail.com>
> ---
> tools/include/linux/bits.h | 15 +++++++++++++++
> tools/include/uapi/linux/bits.h | 3 +++
> 2 files changed, 18 insertions(+)
>
> diff --git a/tools/include/linux/bits.h b/tools/include/linux/bits.h
> index 0eb24d21aac2142c..60044b6088172b3f 100644
> --- a/tools/include/linux/bits.h
> +++ b/tools/include/linux/bits.h
> @@ -36,4 +36,19 @@
> #define GENMASK_ULL(h, l) \
> (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
>
> +#if !defined(__ASSEMBLY__)
> +/*
> + * Missing asm support
> + *
> + * __GENMASK_U128() depends on _BIT128() which would not work
> + * in the asm code, as it shifts an 'unsigned __init128' data
> + * type instead of direct representation of 128 bit constants
> + * such as long and unsigned long. The fundamental problem is
> + * that a 128 bit constant will get silently truncated by the
> + * gcc compiler.
> + */
> +#define GENMASK_U128(h, l) \
> + (GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l))
> +#endif
> +
> #endif /* __LINUX_BITS_H */
> diff --git a/tools/include/uapi/linux/bits.h b/tools/include/uapi/linux/bits.h
> index 3c2a101986a314f6..5ee30f882736cbd1 100644
> --- a/tools/include/uapi/linux/bits.h
> +++ b/tools/include/uapi/linux/bits.h
> @@ -12,4 +12,7 @@
> (((~_ULL(0)) - (_ULL(1) << (l)) + 1) & \
> (~_ULL(0) >> (__BITS_PER_LONG_LONG - 1 - (h))))
>
> +#define __GENMASK_U128(h, l) \
> + ((_BIT128((h)) << 1) - (_BIT128(l)))
> +
> #endif /* _UAPI_LINUX_BITS_H */
> --
> 2.47.0
prev parent reply other threads:[~2024-10-28 14:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 14:01 Arnaldo Carvalho de Melo
2024-10-28 14:40 ` Yury Norov [this message]
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=Zx-icwjwSxT1T9K5@yury-ThinkPad \
--to=yury.norov@gmail.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=anshuman.khandual@arm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®