On Mon, Mar 30, 2020 at 5:19 PM Liu Yiding liuyd.fnst@cn.fujitsu.com wrote:
On 3/30/20 2:09 PM, Andrii Nakryiko wrote:
On 3/29/20 5:48 PM, Liu Yiding wrote:
Add attachment.
Your BTF seems to be invalid. It has struct perf_ibs, which has a first field `struct pmu pmu` field with valid-looking size of 296 bytes, **but** the type that field points to is not a complete `struct pmu` definition, but rather just forward declaration. The way it is it shouldn't be even compilable, because forward declaration of a struct doesn't specify the size of a struct, so compiler should have rejected it. So it must be that either DWARF generated by compiler isn't correct, or there is DWARF -> BTF conversion bug somewhere. Are you using any special DWARF Kconfig settings? Maybe you can share your full .config and I might try to repro it on my machine.
Are you using any special DWARF Kconfig settings?
Sorry, i'm a newbie at this. I don't know which settings are related to DWARF.
Just search keywords.
liuyd@localhost:~$ cat config-5.6.0-rc5 | grep DWARF # CONFIG_DEBUG_INFO_DWARF4 is not set
I built attached config on a clear ubuntu machine. Error could be reproduced. So you are right, there is a conflict between kconfigs.
Maybe you can share your full .config and I might try to repro it on
my machine.
Thanks a lot. I attached the broken config.
Thanks a lot! I think it's due to DEBUG_INFO_REDUCED which produces not entirely correct DWARF. I'm asking Slava to disable this config when BTF is requested in [0].
[0] https://lore.kernel.org/bpf/CAEf4BzadnfAwfa1D0jZb=01Ou783GpK_U7PAYeEJca-L9kd...
But either way, that warning you get is a valid one, it should be illegal to have non-pointer forward-declared struct as a type for a struct member.
On 3/30/20 8:46 AM, Liu Yiding wrote:
Something wrong with my smtp and this email missed.
Send again.
On 3/27/20 11:09 AM, Liu Yiding wrote:
Hi, Andrii.
Thanks for your prompt reply!
Please check attatchment for my_btf.bin.
On 3/27/20 4:28 AM, Andrii Nakryiko wrote:
Would you be able to share BTF of vmlinux that is used to generate vmlinux.h? Please run in verbose mode: `make V=1` and search for `bpftool btf dump file` command. It should point either to /sys/kernel/btf/vmlinux or some other location, depending on how things are set up on your side.
If it's /sys/kernel/btf/vmlinux, you can just `cat /sys/kernel/btf/vmlinux > my_btf.bin`. If it's some other file, easiest would be to just share that file. If not, it's possible to extract .BTF ELF section, let me know if you need help with that.
-- Best Regards. Liu Yiding