BPF List
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Martin Reboredo <yakoyoku@gmail.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, Yonghong Song <yhs@fb.com>
Subject: Re: [PATCH bpf-next] bpf: Add config for skipping BTF enum64s
Date: Sun, 28 Aug 2022 19:36:37 +0200	[thread overview]
Message-ID: <Ywunpcdf3CZTghIt@krava> (raw)
In-Reply-To: <20220828165124.20261-1-yakoyoku@gmail.com>

On Sun, Aug 28, 2022 at 01:51:24PM -0300, Martin Reboredo wrote:
> From: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
> 
> After the release of pahole 1.24 some people in the dwarves mailing list
> notified issues related to building the kernel with the BTF_DEBUG_INFO
> option toggled. They seem to be happenning due to the kernel and
> resolve_btfids interpreting btf types erroneously. In the dwarves list
> I've proposed a change to the scripts that I've written while testing
> the Rust kernel, it simply passes the --skip_encoding_btf_enum64 to
> pahole if it has version 1.24, but it might be desirable to have the
> option to pass said flag.

as I wrote in the original thread, I think we need to do this just for
stable kernels that don't have enum64 support and use pahole 1.24

I think we should switch it off there by default without config option

jirka

> 
> Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
> ---
>  lib/Kconfig.debug       | 14 ++++++++++++++
>  scripts/pahole-flags.sh |  7 +++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 072e4b289c13..638a33cf9e57 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -356,6 +356,20 @@ config PAHOLE_HAS_BTF_TAG
>  	  btf_decl_tag) or not. Currently only clang compiler implements
>  	  these attributes, so make the config depend on CC_IS_CLANG.
>  
> +config PAHOLE_HAS_SKIP_ENCODING_BTF_ENUM64
> +	def_bool PAHOLE_VERSION >= 124
> +	help
> +	  Encoding BTF enum64s can be skipped with the
> +	  --skip_encoding_btf_enum64 pahole option.
> +
> +config DEBUG_INFO_BTF_SKIP_ENCODING_ENUM64
> +	def_bool n
> +	depends on DEBUG_INFO_BTF && PAHOLE_HAS_SKIP_ENCODING_BTF_ENUM64
> +	help
> +	  Omit the encoding of 64 bits enum values with pahole. With certain
> +	  kernel configurations having ENUM64s enabled may result in malformed
> +	  output binaries.
> +
>  config DEBUG_INFO_BTF_MODULES
>  	def_bool y
>  	depends on DEBUG_INFO_BTF && MODULES && PAHOLE_HAS_SPLIT_BTF
> diff --git a/scripts/pahole-flags.sh b/scripts/pahole-flags.sh
> index 0d99ef17e4a5..e44bc2a947ce 100755
> --- a/scripts/pahole-flags.sh
> +++ b/scripts/pahole-flags.sh
> @@ -9,6 +9,10 @@ fi
>  
>  pahole_ver=$($(dirname $0)/pahole-version.sh ${PAHOLE})
>  
> +is_enabled() {
> +	grep -q "^$1=y" include/config/auto.conf
> +}
> +
>  if [ "${pahole_ver}" -ge "118" ] && [ "${pahole_ver}" -le "121" ]; then
>  	# pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars
>  	extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_vars"
> @@ -19,5 +23,8 @@ fi
>  if [ "${pahole_ver}" -ge "122" ]; then
>  	extra_paholeopt="${extra_paholeopt} -j"
>  fi
> +if is_enabled DEBUG_INFO_BTF_SKIP_ENCODING_ENUM64; then
> +	extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_enum64"
> +fi
>  
>  echo ${extra_paholeopt}
> -- 
> 2.37.2
> 

  reply	other threads:[~2022-08-28 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-28 16:51 [PATCH bpf-next] bpf: Add config for skipping BTF enum64s Martin Reboredo
2022-08-28 17:36 ` Jiri Olsa [this message]
2022-08-28 19:03 ` kernel test robot

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=Ywunpcdf3CZTghIt@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=yakoyoku@gmail.com \
    --cc=yhs@fb.com \
    /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