Skip to content

Conversation

@kernel-patches-daemon-bpf-rc
Copy link

Pull request for series with
subject: bpf: Make migrate_{disable,enable} always inline if in header file
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1017413

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 2cbb259
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1017413
version: 1

With latest bpf/bpf-next tree and latest pahole master, I got the following
build failure:

  $ make LLVM=1 -j
    ...
    LD      vmlinux.o
    GEN     .vmlinux.objs
    ...
    BTF     .tmp_vmlinux1.btf.o
    ...
    AS      .tmp_vmlinux2.kallsyms.o
    LD      vmlinux.unstripped
    BTFIDS  vmlinux.unstripped
  WARN: resolve_btfids: unresolved symbol migrate_enable
  WARN: resolve_btfids: unresolved symbol migrate_disable
  make[2]: *** [/home/yhs/work/bpf-next/scripts/Makefile.vmlinux:72: vmlinux.unstripped] Error 255
  make[2]: *** Deleting file 'vmlinux.unstripped'
  make[1]: *** [/home/yhs/work/bpf-next/Makefile:1242: vmlinux] Error 2
  make: *** [/home/yhs/work/bpf-next/Makefile:248: __sub-make] Error 2

In pahole patch [1], if two functions having identical names but different
addresses, then this function name is considered ambiguous and later on
this function will not be added to vmlinux/module BTF.

Commit 378b770 ("sched: Make migrate_{en,dis}able() inline") changed
original global funcitons migrate_{enable,disable} to
  - in kernel/sched/core.c, migrate_{enable,disable} are global funcitons.
  - in other places, migrate_{enable,disable} may survive as static functions
    since they are marked as 'inline' in include/linux/sched.h and the
    'inline' attribute does not garantee inlining.

If I build with clang compiler (make LLVM=1 -j) (llvm21 and llvm22), I found
there are four symbols for migrate_{enable,disable} respectively, three
static functions and one global function. With the above pahole patch [1],
migrate_{enable,disable} are not in vmlinux BTF and this will cause
later resolve_btfids failure.

Making migrate_{enable,disable} always inline in include/linux/sched.h
can fix the problem.

  [1] https://lore.kernel.org/dwarves/[email protected]/

Fixes: 378b770 ("sched: Make migrate_{en,dis}able() inline")
Cc: Menglong Dong <[email protected]>
Cc: Ihor Solodrai <[email protected]>
Signed-off-by: Yonghong Song <[email protected]>
Acked-by: Menglong Dong <[email protected]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 2cbb259
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1017413
version: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant