public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Eduard Zingerman <eddyz87@gmail.com>
Cc: Jiri Olsa <olsajiri@gmail.com>,
	dwarves@vger.kernel.org, arnaldo.melo@gmail.com,
	bpf@vger.kernel.org, kernel-team@fb.com, ast@kernel.org,
	daniel@iogearbox.net, andrii@kernel.org, yonghong.song@linux.dev,
	Alan Maguire <alan.maguire@oracle.com>, Daniel Xu <dxu@dxuuu.xyz>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Vadim Fedorenko <vadfed@meta.com>,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>
Subject: Re: [PATCH dwarves v2 1/1] btf_encoder: handle .BTF_ids section endianness
Date: Tue, 26 Nov 2024 16:02:26 -0300	[thread overview]
Message-ID: <Z0YbQr_QTNrfNqAE@x1> (raw)
In-Reply-To: <b2e5cb3b1478d6900f126d4de223500d6be4c97d.camel@gmail.com>

On Tue, Nov 26, 2024 at 09:32:28AM -0800, Eduard Zingerman wrote:
> On Tue, 2024-11-26 at 13:25 -0300, Arnaldo Carvalho de Melo wrote:
 
> [...]
 
> Hi Arnaldo,
 
> > I think I saw instructions in one of the messages in this thread to get
> > hold of a vmlinux for s390 and test it. Right?
 
> Yes, in cover letter. Full vmlinux is not needed, a vmlinux binary for
> s390 would be sufficient for testing. Repeating the recipe for convenience:
 
>   To reproduce the bug:
>   - follow the instructions in [0] to build an s390 vmlinux;
>   - generate BTF requesting declaration tags for kfuncs:
>     $ pahole --btf_features_strict=decl_tag_kfuncs,decl_tag \
>              --btf_encode_detached=test.btf vmlinux
>   - observe that no kfuncs are generated:
>     $ bpftool btf dump file test.btf format c | grep __ksym
 
> [0] https://docs.kernel.org/bpf/s390.html

Thanks.
 
> > One extra question: this solves the BTF encoder case, the loader already
> > supported loading BTF from a different endianness, right? Lemme
> > check.
 
> > cus__load_btf()
> >   cu->little_endian = btf__endianness(btf) == BTF_LITTLE_ENDIAN;

> > enum btf_endianness btf__endianness(const struct btf *btf)
> > {
> >         if (is_host_big_endian())
> >                 return btf->swapped_endian ? BTF_LITTLE_ENDIAN : BTF_BIG_ENDIAN;
> >         else
> >                 return btf->swapped_endian ? BTF_BIG_ENDIAN : BTF_LITTLE_ENDIAN;
> > }
 
> I can switch to is_host_big_endian() instead of `BYTE_ORDER` macro
> if you think that's better.

No need for that, I think, is_host_big_endian() is a static function
inlib/bpf/src/btf.c.

I was just looking at how endianness was being handled and noticed
libbpf does it, but, as you say below...
 
> > So we have parts of BTF byte swapping happening in libbpf and with this
> > patch, parts of it done in pahole, have you tought about doing this in
> > libbpf instead?
 
> BTF id lists handling is currently not a part of libbpf.

So we should do it in pahole, as you did, so all is clarified now, I'm
now testing it with the provided instructions.

Thanks,

- Arnaldo

  reply	other threads:[~2024-11-26 19:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-22 21:44 [PATCH dwarves v2 0/1] btf_encoder: handle .BTF_ids section endianness Eduard Zingerman
2024-11-22 21:44 ` [PATCH dwarves v2 1/1] " Eduard Zingerman
2024-11-23 13:24   ` Jiri Olsa
2024-11-26 16:25     ` Arnaldo Carvalho de Melo
2024-11-26 17:32       ` Eduard Zingerman
2024-11-26 19:02         ` Arnaldo Carvalho de Melo [this message]
2024-11-27  0:35           ` Eduard Zingerman

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=Z0YbQr_QTNrfNqAE@x1 \
    --to=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=arnaldo.melo@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dwarves@vger.kernel.org \
    --cc=dxu@dxuuu.xyz \
    --cc=eddyz87@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=memxor@gmail.com \
    --cc=olsajiri@gmail.com \
    --cc=vadfed@meta.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=yonghong.song@linux.dev \
    /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