profilingqemuperf

Unknown symbols in perf report output


I have one virtual machine running on QEMU/KVM and I'm trying to profile QEMU to investigate performance related issues. I have it compiled on a Linux system with debug symbols -

mkdir build
cd build
../configure --target-list=x86_64-softmmu --enable-debug-info
make -j`nproc`

Running perf on the QEMU process does list most of the symbols, but some are showing up as unknown -

perf record -g --quiet -p $qemu_pid -o perf.out -F 99 -- sleep 10 &

perf report -

+   74.83%     0.00%  worker           [kernel.kallsyms]        [k] entry_SYSCALL_64_after_hwframe                                                                                   ◆
+   74.83%     0.00%  worker           [kernel.kallsyms]        [k] do_syscall_64                                                                                                    ▒
-   72.37%     0.00%  worker           [unknown]                [k] 0000000000000000                                                                                                 ▒
   - 0                                                                                                                                                                               ▒
      - 32.87% 0x6a00000002                                                                                                                                                          ▒
         + __libc_pwrite                                                                                                                                                             ▒
      - 21.18% 0xb00000001                                                                                                                                                           ▒
           __libc_pread                                                                                                                                                              ▒
           entry_SYSCALL_64_after_hwframe                                                                                                                                            ▒
         + do_syscall_64                                                                                                                                                             ▒
      + 13.43% pwritev64                                                                                                                                                             ▒
      + 4.50% fdatasync                                                                                                                                                              ▒
+   44.75%     0.00%  worker           [kernel.kallsyms]        [k] ext4_file_write_iter                                                                                             ▒
+   44.71%     0.00%  worker           [kernel.kallsyms]        [k] ext4_buffered_write_iter                                                                                         ▒
+   33.36%     0.00%  worker           [kernel.kallsyms]        [k] vfs_write                                                                                                        ▒
+   32.87%     0.00%  worker           [unknown]                [k] 0x0000006a00000002                                                                                               ▒
+   32.87%     0.00%  worker           libc.so.6                [.] __libc_pwrite                                                                                                    ▒
+   32.74%     0.00%  worker           [kernel.kallsyms]        [k] __x64_sys_pwrite64                                                                                               ▒
+   31.48%     0.00%  worker           [kernel.kallsyms]        [k] new_sync_write                                                                                                   ▒
+   31.17%     0.00%  worker           [kernel.kallsyms]        [k] generic_perform_write                                                                                            ▒
+   21.27%     0.00%  worker           libc.so.6                [.] __libc_pread                                                                                                     ▒
+   21.22%     0.00%  worker           [kernel.kallsyms]        [k] ext4_file_read_iter                                                                                              ▒
+   21.22%     0.00%  worker           [kernel.kallsyms]        [k] generic_file_read_iter                                                                                           ▒
+   21.22%     0.37%  worker           [kernel.kallsyms]        [k] filemap_read                                                                                                     ▒
+   21.18%     0.00%  worker           [unknown]                [k] 0x0000000b00000001

...etc

Is there a way to fix the unknown symbols to generate a complete perf report? Or any way to know which library these symbols may belong to, so that it can be compiled with debug symbols?

QEMU version -

user@host:~$ /usr/bin/qemu-system-x86_64 --version
QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.16)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers

Solution

  • QEMU documentation does not mention the flags to enable for building a non-stripped binary. Running ./configure -h will list all the available options and after some investigation, I was able to build the binary with debug symbols.

    ./configure --enable-debug-tcg --enable-debug-info --enable-debug --disable-strip --target-list=x86_64-softmmu --enable-kvm --extra-cflags="-g3" --extra-ldflags="-g3"