All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <olsajiri@gmail.com>
Cc: Yonghong Song <yhs@fb.com>,
	Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>,
	dwarves@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org, Daniel Borkmann <daniel@iogearbox.net>,
	kernel-team@fb.com
Subject: Re: [PATCH dwarves v2 0/2] btf: support BTF_KIND_ENUM64
Date: Wed, 29 Jun 2022 13:30:10 -0300	[thread overview]
Message-ID: <Yrx+Ehpc71/6WHVT@kernel.org> (raw)
In-Reply-To: <YrrPOFzYAGHm0oht@krava>

Em Tue, Jun 28, 2022 at 11:51:52AM +0200, Jiri Olsa escreveu:
> On Wed, Jun 15, 2022 at 04:03:06PM -0700, Yonghong Song wrote:
> > Add support for enum64. For 64-bit enumerator value,
> > previously, the value is truncated into 32bit, e.g.,
> > for the following enum in linux uapi bpf.h,
> >   enum {
> >         BPF_F_INDEX_MASK                = 0xffffffffULL,
> >         BPF_F_CURRENT_CPU               = BPF_F_INDEX_MASK,
> >   /* BPF_FUNC_perf_event_output for sk_buff input context. */
> >         BPF_F_CTXLEN_MASK               = (0xfffffULL << 32),
> >   };
> > 
> > BPF_F_CTXLEN_MASK will be encoded with 0 with BTF_KIND_ENUM
> > after pahole dwarf-to-btf conversion.
> > With this patch, the BPF_F_CTXLEN_MASK will be encoded properly
> > with BTF_KIND_ENUM64.
> 
> yep, tried this on latest vmlinux and got:
> 
> [705813] ENUM64 (anon) size=8
>         BPF_F_INDEX_MASK val=4294967295
>         BPF_F_CURRENT_CPU val=4294967295
>         BPF_F_CTXLEN_MASK val=4503595332403200
> 
> which is correct
> 
> Tested-by: Jiri Olsa <jolsa@kernel.org>

I'm testing with v3:

⬢[acme@toolbox pahole]$ pahole -JV vmlinux-v5.18-rc7+ | grep -B10 -A5 BPF_F_CTXLEN_MASK
	BPF_FUNC_xdp_get_buff_len val=188
	BPF_FUNC_xdp_load_bytes val=189
	BPF_FUNC_xdp_store_bytes val=190
	BPF_FUNC_copy_from_user_task val=191
	BPF_FUNC_skb_set_tstamp val=192
	BPF_FUNC_ima_file_hash val=193
	__BPF_FUNC_MAX_ID val=194
[672880] ENUM64 (anon) size=8
	BPF_F_INDEX_MASK val=4294967295
	BPF_F_CURRENT_CPU val=4294967295
	BPF_F_CTXLEN_MASK val=4503595332403200
[672881] ENUM (anon) size=4
	BPF_F_GET_BRANCH_RECORDS_SIZE val=1
[672882] ARRAY (anon) type_id=672304 index_type_id=18 nr_elems=4
[672883] STRUCT (anon) size=16
	tp_name type_id=672266 bits_offset=0

But:

⬢[acme@toolbox pahole]$ pdwtags -F btf vmlinux-v5.18-rc7+ | grep -B10 -A5 BPF_F_CTXLEN_MASK
BTF: idx: 4173, Unknown kind 19
BTF: idx: 4975, Unknown kind 19
BTF: idx: 6673, Unknown kind 19
BTF: idx: 27413, Unknown kind 19
BTF: idx: 30626, Unknown kind 19
BTF: idx: 30829, Unknown kind 19
BTF: idx: 38040, Unknown kind 19
BTF: idx: 56969, Unknown kind 19
BTF: idx: 83004, Unknown kind 19
⬢[acme@toolbox pahole]$

Ok, I need to update pahole's BTF loader to support:

lib/bpf/src/btf.h:#define BTF_KIND_ENUM64		19	/* Enum for up-to 64bit values */


Working on it now.

Jiri, can I keep your Tested-by for v3?

- Arnaldo

> jirka
> 
> > 
> > This patch is on top of tmp.master since tmp.master has not
> > been sync'ed with master branch yet.
> > 
> > Changelogs:
> >   v1 -> v2:
> >     - Add flag --skip_encoding_btf_enum64 to disable newly-added functionality.
> > 
> > Yonghong Song (2):
> >   libbpf: Sync with latest libbpf repo
> >   btf: Support BTF_KIND_ENUM64
> > 
> >  btf_encoder.c     | 65 +++++++++++++++++++++++++++++++++++------------
> >  btf_encoder.h     |  2 +-
> >  dwarf_loader.c    | 12 +++++++++
> >  dwarves.h         |  4 ++-
> >  dwarves_fprintf.c |  6 ++++-
> >  lib/bpf           |  2 +-
> >  pahole.c          | 10 +++++++-
> >  7 files changed, 80 insertions(+), 21 deletions(-)
> > 
> > -- 
> > 2.30.2
> > 

-- 

- Arnaldo

  reply	other threads:[~2022-06-29 16:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15 23:03 [PATCH dwarves v2 0/2] btf: support BTF_KIND_ENUM64 Yonghong Song
2022-06-15 23:03 ` [PATCH dwarves v2 1/2] libbpf: Sync with latest libbpf repo Yonghong Song
2022-06-15 23:03 ` [PATCH dwarves v2 2/2] btf: Support BTF_KIND_ENUM64 Yonghong Song
2022-06-27 22:30   ` Andrii Nakryiko
2022-06-28  6:19     ` Yonghong Song
2022-06-28  9:51 ` [PATCH dwarves v2 0/2] btf: support BTF_KIND_ENUM64 Jiri Olsa
2022-06-29 16:30   ` Arnaldo Carvalho de Melo [this message]
2022-06-29 16:56     ` [PATCH] btf_loader: support BTF_KIND_ENUM64 was " Arnaldo Carvalho de Melo
2022-07-06  4:28       ` Andrii Nakryiko
2022-07-06 15:51         ` Arnaldo Carvalho de Melo

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=Yrx+Ehpc71/6WHVT@kernel.org \
    --to=acme@kernel.org \
    --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=kernel-team@fb.com \
    --cc=olsajiri@gmail.com \
    --cc=yhs@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.