Skip to contentSkip to conversation

bpf: Add config for skipping BTF enum64s

PATCH In review Martin Rodriguez Reboredo 5 participants 6 messages Aug 28, 2022 – Sep 4, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 bpf: Add config for skipping BTF enum64s

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.

v1 -> v2:
- Switch to off by default and remove the config option.
- Send it to stable instead.

---
 scripts/pahole-flags.sh | 3 +++
 1 file changed, 3 insertions(+)
scripts/pahole-flags.sh +3 -0
index 0d99ef17e4a5..0a48fd86bc68 100755
@@ -19,5 +19,8 @@ fi
 if [ "${pahole_ver}" -ge "122" ]; then
 	extra_paholeopt="${extra_paholeopt} -j"
 fi
+if [ "${pahole_ver}" -ge "124" ]; then
+	extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_enum64"
+fi
 
 echo ${extra_paholeopt}
Signature · 1 line
2.37.2
maintainer
#1 lore raw
Quoted 11 lines · Martin Rodriguez Reboredo

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.

v1 -> v2:
- Switch to off by default and remove the config option.
- Send it to stable instead.

This should only go to stable and not to bpf tree, right? To which stable versions? For stable tree submissions you'd need to send this to [email protected] in Cc and subject should say e.g. '[PATCH stable 5.4]' for 5.4 branch [0]. Either way, pls clarify.

[0] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/?h=linux-5.4.y

Thanks,
Daniel

Quoted 19 lines
---
  scripts/pahole-flags.sh | 3 +++
  1 file changed, 3 insertions(+)
scripts/pahole-flags.sh +3 -0
index 0d99ef17e4a5..0a48fd86bc68 100755
@@ -19,5 +19,8 @@ fi
  if [ "${pahole_ver}" -ge "122" ]; then
  	extra_paholeopt="${extra_paholeopt} -j"
  fi
+if [ "${pahole_ver}" -ge "124" ]; then
+	extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_enum64"
+fi
 
  echo ${extra_paholeopt}
#2 lore raw
In reply to Martin Rodriguez Reboredo
Quoted 11 lines · Martin Rodriguez Reboredo

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.

v1 -> v2:
- Switch to off by default and remove the config option.
- Send it to stable instead.

hi,
we have change that needs to go to stable kernels but does not have the equivalent fix in Linus tree

what would be the best way to submit it?

the issue is that new 'pahole' will generate BTF data that are not supported by older kernels, so we need to add --skip_encoding_btf_enum64 option to stable kernel's scripts/pahole-flags.sh to generate proper BTF data

we got complains that after upgrading to latest pahole the stable kernel compilation fails

thanks,
jirka

Quoted 22 lines
---
 scripts/pahole-flags.sh | 3 +++
 1 file changed, 3 insertions(+)
scripts/pahole-flags.sh +3 -0
index 0d99ef17e4a5..0a48fd86bc68 100755
@@ -19,5 +19,8 @@ fi
 if [ "${pahole_ver}" -ge "122" ]; then
 	extra_paholeopt="${extra_paholeopt} -j"
 fi
+if [ "${pahole_ver}" -ge "124" ]; then
+	extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_enum64"
+fi
 
 echo ${extra_paholeopt}
Signature · 1 line
2.37.2
maintainer
#3 lore raw
Quoted 9 lines · Jiri Olsa
Quoted 8 lines · Martin Rodriguez Reboredo

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.

Quoted 7 lines
Quoted 3 lines

v1 -> v2:
- Switch to off by default and remove the config option.
- Send it to stable instead.

hi,
we have change that needs to go to stable kernels but does not have the equivalent fix in Linus tree

Why isn't it also relevant in Linus's tree?

Quoted 1 line

what would be the best way to submit it?

Submit it here and document the heck out of why this isn't in Linus's tree, what changes instead fixed it there, and so on. Look in the archives for examples of how this is done, one recent one that I can think of is here:

	https://lore.kernel.org/r/[email protected]
Quoted 6 lines

the issue is that new 'pahole' will generate BTF data that are not supported by older kernels, so we need to add --skip_encoding_btf_enum64 option to stable kernel's scripts/pahole-flags.sh to generate proper BTF data

we got complains that after upgrading to latest pahole the stable kernel compilation fails

And what is happening in Linus's tree for this same issue?

thanks,

greg k-h

#4 lore raw

Em Sat, Sep 03, 2022 at 07:26:58AM +0200, Greg KH escreveu:

Quoted 14 lines · Jiri Olsa
Quoted 13 lines · Martin Rodriguez Reboredo
Quoted 11 lines

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.

v1 -> v2:
- Switch to off by default and remove the config option.
- Send it to stable instead.

Quoted 5 lines
Quoted 3 lines

hi,
we have change that needs to go to stable kernels but does not have the equivalent fix in Linus tree

Why isn't it also relevant in Linus's tree?

See below.

Quoted 8 lines
Quoted 1 line

what would be the best way to submit it?

Submit it here and document the heck out of why this isn't in Linus's tree, what changes instead fixed it there, and so on. Look in the archives for examples of how this is done, one recent one that I can think of is here:

	https://lore.kernel.org/r/[email protected]
Quoted 8 lines
Quoted 6 lines

the issue is that new 'pahole' will generate BTF data that are not supported by older kernels, so we need to add --skip_encoding_btf_enum64 option to stable kernel's scripts/pahole-flags.sh to generate proper BTF data

we got complains that after upgrading to latest pahole the stable kernel compilation fails

And what is happening in Linus's tree for this same issue?

So, BTF_KIND_ENUM64 is a new BTF tag, one that is not accepted by older kernels, but is accepted by the BPF verifier on Linus' tree.

Its about avoiding having a pahole command line with lots of --enable-new-feature-foo for new stuff with the default producing the most recent BTF spec.

One way to documenting it: if you update pahole, then please use --skip_encoding_FOO for these new FOO features on kernels where those aren't supported.

So this isn't a backport from a fix on Linus' tree, as both the older pahole that doesn't encode BTF_KIND_ENUM64 and the new one, that encodes it by default, work with Linus' tree.

Does this violates the stable@ rules?

- Arnaldo

maintainer
#5 lore raw
Quoted 51 lines · Arnaldo Carvalho de Melo

Em Sat, Sep 03, 2022 at 07:26:58AM +0200, Greg KH escreveu:

Quoted 14 lines · Jiri Olsa
Quoted 13 lines · Martin Rodriguez Reboredo
Quoted 11 lines

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.

v1 -> v2:
- Switch to off by default and remove the config option.
- Send it to stable instead.

Quoted 5 lines
Quoted 3 lines

hi,
we have change that needs to go to stable kernels but does not have the equivalent fix in Linus tree

Why isn't it also relevant in Linus's tree?

See below.

Quoted 8 lines
Quoted 1 line

what would be the best way to submit it?

Submit it here and document the heck out of why this isn't in Linus's tree, what changes instead fixed it there, and so on. Look in the archives for examples of how this is done, one recent one that I can think of is here:

	https://lore.kernel.org/r/[email protected]
Quoted 8 lines
Quoted 6 lines

the issue is that new 'pahole' will generate BTF data that are not supported by older kernels, so we need to add --skip_encoding_btf_enum64 option to stable kernel's scripts/pahole-flags.sh to generate proper BTF data

we got complains that after upgrading to latest pahole the stable kernel compilation fails

And what is happening in Linus's tree for this same issue?

So, BTF_KIND_ENUM64 is a new BTF tag, one that is not accepted by older kernels, but is accepted by the BPF verifier on Linus' tree.

Its about avoiding having a pahole command line with lots of --enable-new-feature-foo for new stuff with the default producing the most recent BTF spec.

One way to documenting it: if you update pahole, then please use --skip_encoding_FOO for these new FOO features on kernels where those aren't supported.

Quoted 5 lines

So this isn't a backport from a fix on Linus' tree, as both the older pahole that doesn't encode BTF_KIND_ENUM64 and the new one, that encodes it by default, work with Linus' tree.

Does this violates the stable@ rules?

Not really, if it fixes an issue for those kernels when using newer tools, that's fine. Just document it well like you did here.

thanks,

greg k-h