Package: pahole
Version: 1.29-2
Severity: important
Control: affects -1 + src:nvidia-open-gpu-kernel-modules

Building kernel modules from nvidia-open-kernel-dkms hangs on this
command:

LLVM_OBJCOPY="x86_64-linux-gnu-objcopy" pahole -J -j 
--btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs
 -j --lang_exclude=rust --btf_features=distilled_base --btf_base vmlinux 
/var/lib/dkms/nvidia-current-open/545.23.06/build/nvidia-modeset.ko

I can fix that by removing -j (2x) from the command (or appending -j1).


For easier reproduction I'll add a compressed version of the problematic
module (backed up before the pahole call which modifies it).
It was built from nvidia-open-kernel-dkms (545.23.06-3).
Furthermore you'll need linux-headers-6.12.17-amd64 (6.12.17-1).

This simplified (sequential) command succeeds:

cp nvidia-modeset.base.ko nvidia-modeset.ko
LLVM_OBJCOPY="x86_64-linux-gnu-objcopy" pahole -J 
--btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs
 --btf_features=distilled_base --btf_base 
/usr/src/linux-headers-6.12.17-amd64/vmlinux nvidia-modeset.ko -j1
echo $?

producing this output:
===== 8< =====
dwarf_expr: unhandled 0x12 DW_OP_ operation
Unsupported DW_TAG_reference_type(0x10): type: 0x28172
Error while encoding BTF.
0
===== >8 =====

While this (parallel) command hangs:

cp nvidia-modeset.base.ko nvidia-modeset.ko
LLVM_OBJCOPY="x86_64-linux-gnu-objcopy" pahole -J 
--btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs
 --btf_features=distilled_base --btf_base 
/usr/src/linux-headers-6.12.17-amd64/vmlinux nvidia-modeset.ko -j2
echo $?

producing this output:
===== 8< =====
dwarf_expr: unhandled 0x12 DW_OP_ operation
dwarf_expr: unhandled 0x12 DW_OP_ operation
dwarf_expr: unhandled 0x12 DW_OP_ operation
dwarf_expr: unhandled 0x12 DW_OP_ operation
Unsupported DW_TAG_reference_type(0x10): type: 0x28172
Error while encoding BTF.
Terminated
143
===== >8 =====
(hanging process terminated with 'pkill pahole')
(and with more parallelism (or just plain -j), the
'unhandled 0x12 DW_OP_' message gets repeated more often)

Looking with gdb at pahole while it is hanging:

(gdb) info threads
  Id   Target Id                                   Frame
* 1    Thread 0x7fa3fbd00740 (LWP 385570) "pahole" __syscall_cancel_arch () at 
../sysdeps/unix/sysv/linux/x86_64/syscall_cancel.S:56
  2    Thread 0x7fa3f95fe6c0 (LWP 385604) "pahole" __syscall_cancel_arch () at 
../sysdeps/unix/sysv/linux/x86_64/syscall_cancel.S:56

(gdb) bt
#0  __syscall_cancel_arch () at 
../sysdeps/unix/sysv/linux/x86_64/syscall_cancel.S:56
#1  0x00007fa3fbea25a8 in __internal_syscall_cancel (a1=<optimized out>, 
a2=<optimized out>, a3=<optimized out>, a4=<optimized out>, a5=a5@entry=0, 
a6=a6@entry=4294967295, nr=202) at ./nptl/cancellation.c:49
#2  0x00007fa3fbea2bdc in __futex_abstimed_wait_common64 (private=128, 
futex_word=0x7fa3f95fe990, expected=<optimized out>, op=<optimized out>, 
abstime=0x0, cancel=true) at ./nptl/futex-internal.c:57
#3  __futex_abstimed_wait_common (futex_word=futex_word@entry=0x7fa3f95fe990, 
expected=<optimized out>, clockid=clockid@entry=0, abstime=abstime@entry=0x0, 
private=private@entry=128, cancel=cancel@entry=true) at 
./nptl/futex-internal.c:87
#4  0x00007fa3fbea2c3b in __GI___futex_abstimed_wait_cancelable64 
(futex_word=futex_word@entry=0x7fa3f95fe990, expected=<optimized out>, 
clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=128) 
at ./nptl/futex-internal.c:139
#5  0x00007fa3fbea76c4 in __pthread_clockjoin_ex (threadid=140342240208576, 
thread_return=thread_return@entry=0x7ffce73f7e20, clockid=clockid@entry=0, 
abstime=abstime@entry=0x0, block=block@entry=true) at 
./nptl/pthread_join_common.c:108
#6  0x00007fa3fbea753f in ___pthread_join (threadid=<optimized out>, 
thread_return=thread_return@entry=0x7ffce73f7e20) at ./nptl/pthread_join.c:24
#7  0x0000561444ddea6b in dwarf_cus__process_cus (dcus=0x7ffce73f7e70) at 
./dwarf_loader.c:3761
#8  cus__load_module (cus=<optimized out>, conf=<optimized out>, mod=<optimized 
out>, dw=<optimized out>, elf=<optimized out>, filename=<optimized out>) at 
./dwarf_loader.c:3920
#9  cus__process_dwflmod (dwflmod=<optimized out>, userdata=<optimized out>, 
name=<optimized out>, base=<optimized out>, arg=<optimized out>) at 
./dwarf_loader.c:3964
#10 0x00007fa3fc116b01 in dwfl_getmodules () from 
/lib/x86_64-linux-gnu/libdw.so.1
#11 0x0000561444dd8d62 in cus__process_file (cus=0x561470ec8480, 
conf=0x561444df2280 <conf_load>, fd=3, filename=0x7ffce73fa617 
"nvidia-modeset.ko") at ./dwarf_loader.c:4030
#12 dwarf__load_file (cus=0x561470ec8480, conf=0x561444df2280 <conf_load>, 
filename=0x7ffce73fa617 "nvidia-modeset.ko") at ./dwarf_loader.c:4067
#13 0x0000561444dca74f in cus__load_file (cus=cus@entry=0x561470ec8480, 
conf=conf@entry=0x561444df2280 <conf_load>, filename=0x7ffce73fa617 
"nvidia-modeset.ko") at ./dwarves.c:2273
#14 0x0000561444dcae4d in cus__load_files (cus=0x561470ec8480, 
conf=conf@entry=0x561444df2280 <conf_load>, 
filenames=filenames@entry=0x7ffce73f8360) at ./dwarves.c:2954
#15 0x0000561444dc0003 in main (argc=8, argv=0x7ffce73f8328) at ./pahole.c:3602

(gdb) thread 2
[Switching to thread 2 (Thread 0x7fa3f95fe6c0 (LWP 385604))]
#0  __syscall_cancel_arch () at 
../sysdeps/unix/sysv/linux/x86_64/syscall_cancel.S:56
56      in ../sysdeps/unix/sysv/linux/x86_64/syscall_cancel.S
(gdb) bt
#0  __syscall_cancel_arch () at 
../sysdeps/unix/sysv/linux/x86_64/syscall_cancel.S:56
#1  0x00007fa3fbea25a8 in __internal_syscall_cancel (a1=<optimized out>, 
a2=<optimized out>, a3=<optimized out>, a4=<optimized out>, a5=a5@entry=0, 
a6=a6@entry=4294967295, nr=202) at ./nptl/cancellation.c:49
#2  0x00007fa3fbea2bdc in __futex_abstimed_wait_common64 (private=0, 
futex_word=0x561444df6928 <cus_processing_queue+72>, expected=<optimized out>, 
op=<optimized out>, abstime=0x0, cancel=true) at ./nptl/futex-internal.c:57
#3  __futex_abstimed_wait_common (futex_word=futex_word@entry=0x561444df6928 
<cus_processing_queue+72>, expected=<optimized out>, clockid=clockid@entry=0, 
abstime=abstime@entry=0x0, private=private@entry=0, cancel=cancel@entry=true)
    at ./nptl/futex-internal.c:87
#4  0x00007fa3fbea2c3b in __GI___futex_abstimed_wait_cancelable64 
(futex_word=futex_word@entry=0x561444df6928 <cus_processing_queue+72>, 
expected=<optimized out>, clockid=clockid@entry=0, abstime=abstime@entry=0x0, 
private=private@entry=0)
    at ./nptl/futex-internal.c:139
#5  0x00007fa3fbea5098 in __pthread_cond_wait_common (cond=0x561444df6908 
<cus_processing_queue+40>, mutex=0x561444df68e0 <cus_processing_queue>, 
clockid=0, abstime=0x0) at ./nptl/pthread_cond_wait.c:426
#6  ___pthread_cond_wait (cond=cond@entry=0x561444df6908 
<cus_processing_queue+40>, mutex=mutex@entry=0x561444df68e0 
<cus_processing_queue>) at ./nptl/pthread_cond_wait.c:458
#7  0x0000561444ddeddb in cus_queue__enqdeq_job (job=<optimized out>) at 
./dwarf_loader.c:3542
#8  dwarf_loader__worker_thread (arg=0x7ffce73f7e70) at ./dwarf_loader.c:3655
#9  0x00007fa3fbea5abd in start_thread (arg=<optimized out>) at 
./nptl/pthread_create.c:448
#10 0x00007fa3fbf237b8 in __GI___clone3 () at 
../sysdeps/unix/sysv/linux/x86_64/clone3.S:78


Second problem:

    dwarf_expr: unhandled 0x12 DW_OP_ operation
    Unsupported DW_TAG_reference_type(0x10): type: 0x28172
    Error while encoding BTF.

pahole reports an error, but nevertheless exits with 0.
Is the resulting .ko file still OK?

What is causing these "unsupported" messages?
Is it possible to avoid them by adding some appropriate options?
I found https://github.com/NVIDIA/open-gpu-kernel-modules/issues/756
which attempts to add --lang_exclude=c++ to the command line, but that
didn't make any difference for me.


Andreas

Reply via email to