| 1 |
From f5f413cb3e8af235c5d310bea9942424fb242c2c Mon Sep 17 00:00:00 2001 |
| 2 |
Message-Id: <f5f413cb3e8af235c5d310bea9942424fb242c2c.1685662899.git.osandov@osandov.com> |
| 3 |
From: Andrii Nakryiko <[email protected]> |
| 4 |
Date: Wed, 19 Oct 2022 10:56:02 +0200 |
| 5 |
Subject: [PATCH] kbuild: skip per-CPU BTF generation for pahole v1.18-v1.21 |
| 6 |
|
| 7 |
commit a0b8200d06ad6450c179407baa5f0f52f8cfcc97 upstream. |
| 8 |
|
| 9 |
[small context changes due to missing floats support in 5.10] |
| 10 |
|
| 11 |
Commit "mm/page_alloc: convert per-cpu list protection to local_lock" will |
| 12 |
introduce a zero-sized per-CPU variable, which causes pahole to generate |
| 13 |
invalid BTF. Only pahole versions 1.18 through 1.21 are impacted, as |
| 14 |
before 1.18 pahole doesn't know anything about per-CPU variables, and 1.22 |
| 15 |
contains the proper fix for the issue. |
| 16 |
|
| 17 |
Luckily, pahole 1.18 got --skip_encoding_btf_vars option disabling BTF |
| 18 |
generation for per-CPU variables in anticipation of some unanticipated |
| 19 |
problems. So use this escape hatch to disable per-CPU var BTF info on |
| 20 |
those problematic pahole versions. Users relying on availability of |
| 21 |
per-CPU var BTFs would need to upgrade to pahole 1.22+, but everyone won't |
| 22 |
notice any regressions. |
| 23 |
|
| 24 |
Link: https://lkml.kernel.org/r/[email protected] |
| 25 |
Signed-off-by: Andrii Nakryiko <[email protected]> |
| 26 |
Acked-by: Mel Gorman <[email protected]> |
| 27 |
Cc: Arnaldo Carvalho de Melo <[email protected]> |
| 28 |
Cc: Hao Luo <[email protected]> |
| 29 |
Cc: Michal Suchanek <[email protected]> |
| 30 |
Cc: Jiri Olsa <[email protected]> |
| 31 |
Signed-off-by: Andrew Morton <[email protected]> |
| 32 |
Signed-off-by: Linus Torvalds <[email protected]> |
| 33 |
Signed-off-by: Jiri Olsa <[email protected]> |
| 34 |
Signed-off-by: Greg Kroah-Hartman <[email protected]> |
| 35 |
--- |
| 36 |
scripts/link-vmlinux.sh | 5 +++++ |
| 37 |
1 file changed, 5 insertions(+) |
| 38 |
|
| 39 |
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh |
| 40 |
index 72bf14df6903..bbb22be4c8f1 100755 |
| 41 |
--- a/scripts/link-vmlinux.sh |
| 42 |
+++ b/scripts/link-vmlinux.sh |
| 43 |
@@ -161,6 +161,11 @@ gen_btf() |
| 44 |
|
| 45 |
vmlinux_link ${1} |
| 46 |
|
| 47 |
+ if [ "${pahole_ver}" -ge "118" ] && [ "${pahole_ver}" -le "121" ]; then |
| 48 |
+ # pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars |
| 49 |
+ extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_vars" |
| 50 |
+ fi |
| 51 |
+ |
| 52 |
info "BTF" ${2} |
| 53 |
LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${extra_paholeopt} ${1} |
| 54 |
|
| 55 |
-- |
| 56 |
2.40.1 |
| 57 |
|