Skip to contentSkip to conversation

kbuild: skip per-CPU BTF generation for pahole v1.18-v1.21

PATCH Applied Andrii Nakryiko 2 participants 2 messages May 30, 2021 – May 31, 2021

Subsystems (3)
lore
Share & tools
lore

Andrii Nakryiko

author maintainer
#0 lore raw

PATCH 1/1 kbuild: skip per-CPU BTF generation for pahole v1.18-v1.21

Commit "mm/page_alloc: convert per-cpu list protection to local_lock" introduced a zero-sized per-CPU variable, which causes pahole to generate invalid BTF. Only pahole versions 1.18 through 1.21 are impacted, as before 1.18 pahole doesn't know anything about per-CPU variables, and 1.22 contains the proper fix for the issue.

Luckily, pahole 1.18 got --skip_encoding_btf_vars option disabling BTF generation for per-CPU variables in anticipation of some unanticipated problems. So use this escape hatch to disable per-CPU var BTF info on those problematic pahole versions. Users relying on availability of per-CPU var BTFs would need to upgrade to pahole 1.22+, but everyone won't notice any regressions.

Cc Mel Gorman <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Hao Luo <[email protected]>
---
 scripts/link-vmlinux.sh | 4 ++++
 1 file changed, 4 insertions(+)
scripts/link-vmlinux.sh +4 -0
index 3b342b0b0b38..66e7053aa907 100755
@@ -233,6 +233,10 @@ gen_btf()
 
 	vmlinux_link ${1}
 
+	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"
+	fi
 	if [ "${pahole_ver}" -ge "121" ]; then
 		extra_paholeopt="${extra_paholeopt} --btf_gen_floats"
 	fi
Signature · 1 line
2.30.2
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Andrii Nakryiko

Commit "mm/page_alloc: convert per-cpu list protection to local_lock" introduced a zero-sized per-CPU variable, which causes pahole to generate invalid BTF. Only pahole versions 1.18 through 1.21 are impacted, as before 1.18 pahole doesn't know anything about per-CPU variables, and 1.22 contains the proper fix for the issue.

Luckily, pahole 1.18 got --skip_encoding_btf_vars option disabling BTF generation for per-CPU variables in anticipation of some unanticipated problems. So use this escape hatch to disable per-CPU var BTF info on those problematic pahole versions. Users relying on availability of per-CPU var BTFs would need to upgrade to pahole 1.22+, but everyone won't notice any regressions.

Quoted 4 lines
Cc Mel Gorman <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Hao Luo <[email protected]>
Signature · 2 lines
Mel Gorman
SUSE Labs