BPF List
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Matthew Maurer <mmaurer@google.com>
Cc: "Tamir Duberstein" <tamird@gmail.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Neal Gompa" <neal@gompa.dev>,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	"Matthias Maennich" <maennich@google.com>,
	bpf <bpf@vger.kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Eric Curtin" <ecurtin@redhat.com>,
	"Martin Reboredo" <yakoyoku@gmail.com>,
	"Alessandro Decina" <alessandro.d@gmail.com>,
	"Michal Rostecki" <vadorovsky@protonmail.com>,
	"Dave Tucker" <dave@dtucker.co.uk>
Subject: Re: [PATCH] rust: Disallow BTF generation with Rust + LTO
Date: Fri, 10 Jan 2025 11:54:37 -0300	[thread overview]
Message-ID: <Z4E0rZmHFU01umqx@x1> (raw)
In-Reply-To: <CAGSQo039Kgxk4FfDn_wfD=Ha=UR2xxhSM0MrjzXNR9YeiuCTZg@mail.gmail.com>

On Thu, Jan 09, 2025 at 02:41:50PM -0800, Matthew Maurer wrote:
> Doing a little more digging, I've also found that the latest version
> of `pahole` doesn't seem to conflict with LTO in my test builds - it
> seems to successfully filter out the Rust types. Version 1.25 was
> causing the errors that got reported to me and I was able to
> reproduce.

Right, I recall now that this multi-lang mixup of DWARF tags theory came
up in the past and IIRC were fixed by:

commit b98565e7b17ec24daeb0b17f8f403c263dfcbd36
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Tue Oct 1 14:57:25 2024 -0300

    dwarf_loader: Honour --lang_exclude when merging LTO built CUs
    
    When building kernels with clang, thin-LTO, the Rust DWARF tags were
    being added, which causes confusion as there has not been a concerted
    effort to check if what is being generated is useful/valid.
    
    At least the Rust DWARF tags, when converted to BTF, were not causing
    crashes, which is a good signal.
    
    Fix it by passing a 'struct cu' with all fields zeroed except for the
    CU name and its language code. This is enough for the existing filter,
    in pahole (cu__filter) and will also allow us to, in verbose mode, show
    the CU names being filtered.
    
    Reported-by: Tom Stellard <tstellar@redhat.com>
    Cc: Alan Maguire <alan.maguire@oracle.com>
    Cc: Don Zickus <dzickus@redhat.com>
    Cc: Josh Stone <jistone@redhat.com>
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

So there was a mixup, but not in the DWARF data, but in the way pahole
processes LTO built CUs, combining then into one to resolve inter CU tag
references, by not filtering the Rust CUs.

But as the message there mentions, it would be good to process tags that
are valid as BTF while "voiding", i.e. filtering the ones that are not,
I'll try to continue experimenting with it as reported in this thread,
this way we could stop using lang_exclude and have some degree of Rust
BTF support that could maybe be useful to some use cases, who knows.

- Arnaldo

  reply	other threads:[~2025-01-10 14:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250108-rust-btf-lto-incompat-v1-1-60243ff6d820@google.com>
2025-01-09 13:17 ` [PATCH] rust: Disallow BTF generation with Rust + LTO Miguel Ojeda
2025-01-09 14:10   ` Neal Gompa
2025-01-09 14:15     ` Alice Ryhl
2025-01-09 14:55       ` Tamir Duberstein
2025-01-09 15:47         ` Arnaldo Carvalho de Melo
2025-01-09 15:49           ` Tamir Duberstein
2025-01-09 16:29             ` Arnaldo Carvalho de Melo
2025-01-09 16:37               ` Arnaldo Carvalho de Melo
2025-01-09 22:39               ` Arnaldo Carvalho de Melo
2025-01-09 22:41                 ` Matthew Maurer
2025-01-10 14:54                   ` Arnaldo Carvalho de Melo [this message]
2025-01-10 16:22                 ` Dave Tucker
2025-01-10 16:41                   ` vadorovsky

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=Z4E0rZmHFU01umqx@x1 \
    --to=acme@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=alessandro.d@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dave@dtucker.co.uk \
    --cc=ecurtin@redhat.com \
    --cc=gary@garyguo.net \
    --cc=john.fastabend@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maennich@google.com \
    --cc=martin.lau@linux.dev \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=mmaurer@google.com \
    --cc=neal@gompa.dev \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@gmail.com \
    --cc=tmgross@umich.edu \
    --cc=vadorovsky@protonmail.com \
    --cc=yakoyoku@gmail.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