From: Jiri Olsa <olsajiri@gmail.com>
To: Jiri Olsa <olsajiri@gmail.com>,
Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Laura Nao <laura.nao@collabora.com>,
alan.maguire@oracle.com, bpf@vger.kernel.org,
chrome-platform@lists.linux.dev, kernel@collabora.com,
linux-kernel@vger.kernel.org, regressions@lists.linux.dev
Subject: Re: [REGRESSION] module BTF validation failure (Error -22) on
Date: Thu, 12 Dec 2024 10:22:30 +0100 [thread overview]
Message-ID: <Z1qrVu2Pv6qXI9tD@krava> (raw)
In-Reply-To: <Z1n_wGj0CGjh_gLP@krava>
On Wed, Dec 11, 2024 at 10:10:24PM +0100, Jiri Olsa wrote:
> On Tue, Dec 10, 2024 at 02:55:01PM +0100, Laura Nao wrote:
> > Hi Jiri,
> >
> > Thanks for the feedback!
> >
> > On 12/6/24 13:35, Jiri Olsa wrote:
> > > On Fri, Nov 15, 2024 at 06:17:12PM +0100, Laura Nao wrote:
> > >> On 11/13/24 10:37, Laura Nao wrote:
> > >>>
> > >>> Currently, KernelCI only retains the bzImage, not the vmlinux
> > >>> binary. The
> > >>> bzImage can be downloaded from the same link mentioned above by
> > >>> selecting
> > >>> 'kernel' from the dropdown menu (modules can also be downloaded the
> > >>> same
> > >>> way). I’ll try to replicate the build on my end and share the
> > >>> vmlinux
> > >>> with DWARF data stripped for convenience.
> > >>>
> > >>
> > >> I managed to reproduce the issue locally and I've uploaded the
> > >> vmlinux[1]
> > >> (stripped of DWARF data) and vmlinux.raw[2] files, as well as one of
> > >> the
> > >> modules[3] and its btf data[4] extracted with:
> > >>
> > >> bpftool -B vmlinux btf dump file cros_kbd_led_backlight.ko >
> > >> cros_kbd_led_backlight.ko.raw
> > >>
> > >> Looking again at the logs[5], I've noticed the following is reported:
> > >>
> > >> [ 0.415885] BPF: type_id=115803 offset=177920 size=1152
> > >> [ 0.416029] BPF:
> > >> [ 0.416083] BPF: Invalid offset
> > >> [ 0.416165] BPF:
> > >>
> > >> There are two different definitions of rcu_data in '.data..percpu',
> > >> one
> > >> is a struct and the other is an integer:
> > >>
> > >> type_id=115801 offset=177920 size=1152 (VAR 'rcu_data')
> > >> type_id=115803 offset=177920 size=1152 (VAR 'rcu_data')
> > >>
> > >> [115801] VAR 'rcu_data' type_id=115572, linkage=static
> > >> [115803] VAR 'rcu_data' type_id=1, linkage=static
> > >>
> > >> [115572] STRUCT 'rcu_data' size=1152 vlen=69
> > >> [1] INT 'long unsigned int' size=8 bits_offset=0 nr_bits=64
> > >> encoding=(none)
> > >>
> > >> I assume that's not expected, correct?
> > >
> > > yes, that seems wrong.. but I can't reproduce with your config
> > > together with pahole 1.24 .. could you try with latest one?
> >
> > I just tested next-20241210 with the latest pahole version (1.28 from
> > the master branch[1]), and the issue does not occur with this version
> > (I can see only one instance of rcu_data in the BTF data, as expected).
> >
> > I can confirm that the same kernel revision still exhibits the issue
> > with pahole 1.24.
> >
> > If helpful, I can also test versions between 1.24 and 1.28 to identify
> > which ones work.
>
> I managed to reproduce finally with gcc-12, but had to use pahole 1.25,
> 1.24 failed with unknown attribute
>
> [95096] VAR 'rcu_data' type_id=94868, linkage=static
> [95098] VAR 'rcu_data' type_id=4, linkage=static
> type_id=95096 offset=177088 size=1152 (VAR 'rcu_data')
> type_id=95098 offset=177088 size=1152 (VAR 'rcu_data')
so for me the difference seems to be using gcc-12 and this commit in linux tree:
dabddd687c9e percpu: cast percpu pointer in PERCPU_PTR() via unsigned long
which adds extra __pcpu_ptr variable into dwarf, and it has the same
address as the per cpu variable and that confuses pahole
it ends up with adding per cpu variable twice.. one with real type
(type_id=94868) and the other with unsigned long type (type_id=4)
however this got fixed in pahole 1.28 commit:
47dcb534e253 btf_encoder: Stop indexing symbols for VARs
which filters out __pcpu_ptr variable completely, adding Stephen to the loop
with gcc-14 the __pcpu_ptr variable has VSCOPE_OPTIMIZED scope, so it won't
get into btf even without above pahole fix
I suggest gcc/pahole upgrade ;-)
thanks,
jirka
next prev parent reply other threads:[~2024-12-12 9:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 16:08 [REGRESSION] module BTF validation failure (Error -22) on next Laura Nao
2024-11-07 15:05 ` Alan Maguire
2024-11-13 9:37 ` Laura Nao
2024-11-15 17:17 ` Laura Nao
2024-12-04 15:53 ` Laura Nao
2024-12-05 7:36 ` Uros Bizjak
2024-12-14 4:41 ` Cong Wang
2024-12-14 12:15 ` Alan Maguire
2024-12-16 15:19 ` Alan Maguire
2024-12-16 21:28 ` Stephen Brennan
2024-12-17 8:02 ` Jiri Olsa
2025-01-15 17:38 ` Cong Wang
2025-01-16 9:51 ` Alan Maguire
2024-12-05 10:33 ` Jiri Olsa
2024-12-05 10:35 ` Uros Bizjak
2024-12-06 12:35 ` Jiri Olsa
2024-12-10 13:55 ` [REGRESSION] module BTF validation failure (Error -22) on Laura Nao
2024-12-11 21:10 ` Jiri Olsa
2024-12-12 9:22 ` Jiri Olsa [this message]
2024-12-12 21:49 ` Stephen Brennan
2024-12-13 9:26 ` Laura Nao
2024-12-10 20:42 ` [REGRESSION] module BTF validation failure (Error -22) on next Kumar Kartikeya Dwivedi
2024-12-05 10:01 ` Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z1qrVu2Pv6qXI9tD@krava \
--to=olsajiri@gmail.com \
--cc=alan.maguire@oracle.com \
--cc=bpf@vger.kernel.org \
--cc=chrome-platform@lists.linux.dev \
--cc=kernel@collabora.com \
--cc=laura.nao@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=regressions@lists.linux.dev \
--cc=stephen.s.brennan@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox