All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	bpf@vger.kernel.org, dwarves@vger.kernel.org,
	linux-debuggers@vger.kernel.org,
	Alan Maguire <alan.maguire@oracle.com>
Subject: Re: [PATCH dwarves v3 0/5] Emit global variables in BTF
Date: Thu, 3 Oct 2024 22:59:01 +0200	[thread overview]
Message-ID: <Zv8FlbMTd24eJCyE@krava> (raw)
In-Reply-To: <20241002235253.487251-1-stephen.s.brennan@oracle.com>

On Wed, Oct 02, 2024 at 04:52:42PM -0700, Stephen Brennan wrote:
> Hello all,
> 
> This is v3 of the series to add global variables to pahole's generated BTF.
> Patches 1-3 of v2 were already merged. This series splits the last patch of v2
> and does some small updates. It should apply cleanly to the "next" branch.
> https://github.com/acmel/dwarves/commits/btf_global_vars/
> 
> Changes since v2:
> 1. Split things out into several smaller patches as can be seen in the log
>    below.

thanks for the split, so much better for review, lgtm

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka


> 2. Previously the global_var feature was defined with BTF_DEFAULT_FEATURE, but I
>    think we agreed in the discussion of v2 that it would be better as
>    BTF_NON_DEFAULT_FEATURE, so I changed it to align with our discussion.
> 3. Removed the "--encode_btf_global_vars" option.
> 3. I went through and straightened out my use of integer types for ELF section
>    index (size_t, as returned by libelf) as well as the variable addr and size.
>    To this end I did add a few checks to explicitly ensure we don't overflow the
>    uint32_t fields in the DATASEC.
> 
> To test this out on a Linux build, you'll want to make the following change:
> 
> ---------
> diff --git a/scripts/Makefile.btf b/scripts/Makefile.btf
> index b75f09f3f424..c88d9e526426 100644
> --- a/scripts/Makefile.btf
> +++ b/scripts/Makefile.btf
> @@ -19,7 +19,7 @@ pahole-flags-$(call test-ge, $(pahole-ver), 125)      += --skip_encoding_btf_inconsis
>  else
> 
>  # Switch to using --btf_features for v1.26 and later.
> -pahole-flags-$(call test-ge, $(pahole-ver), 126)  = -j --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs
> +pahole-flags-$(call test-ge, $(pahole-ver), 126)  = -j --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs,global_var
> 
>  ifneq ($(KBUILD_EXTMOD),)
>  module-pahole-flags-$(call test-ge, $(pahole-ver), 126) += --btf_features=distilled_base
> ---------
> 
> With a suitable kernel config that has BTF enabled, you could then build like
> so:
> 
>     PATH=path/to/pahole_build_dir make all
> 
> And you'll be able to examine the size of the results with readelf, or dump the
> results with bpftool.
> 
> v2: https://lore.kernel.org/dwarves/20240920081903.13473-1-stephen.s.brennan@oracle.com/T/
> v1: https://lore.kernel.org/dwarves/20240912190827.230176-1-stephen.s.brennan@oracle.com/
> 
> Stephen Brennan (5):
>   btf_encoder: use bitfield to control var encoding
>   btf_encoder: stop indexing symbols for VARs
>   btf_encoder: explicitly check addr/size for u32 overflow
>   btf_encoder: allow encoding VARs from many sections
>   pahole: add global_var BTF feature
> 
>  btf_encoder.c      | 348 +++++++++++++++++++++------------------------
>  btf_encoder.h      |   7 +
>  dwarves.h          |   1 +
>  man-pages/pahole.1 |   7 +-
>  pahole.c           |   3 +-
>  5 files changed, 178 insertions(+), 188 deletions(-)
> 
> -- 
> 2.43.5
> 
> 

      parent reply	other threads:[~2024-10-03 20:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 23:52 [PATCH dwarves v3 0/5] Emit global variables in BTF Stephen Brennan
2024-10-02 23:52 ` [PATCH dwarves v3 1/5] btf_encoder: use bitfield to control var encoding Stephen Brennan
2024-10-03 13:41   ` Alan Maguire
2024-10-03 14:41     ` Arnaldo Carvalho de Melo
2024-10-02 23:52 ` [PATCH dwarves v3 2/5] btf_encoder: stop indexing symbols for VARs Stephen Brennan
2024-10-03 13:59   ` Alan Maguire
2024-10-03 17:26     ` Stephen Brennan
2024-10-02 23:52 ` [PATCH dwarves v3 3/5] btf_encoder: explicitly check addr/size for u32 overflow Stephen Brennan
2024-10-03 14:19   ` Alan Maguire
2024-10-02 23:52 ` [PATCH dwarves v3 4/5] btf_encoder: allow encoding VARs from many sections Stephen Brennan
2024-10-03 14:52   ` Alan Maguire
2024-10-03 17:29     ` Stephen Brennan
2024-10-02 23:52 ` [PATCH dwarves v3 5/5] pahole: add global_var BTF feature Stephen Brennan
2024-10-03 14:40   ` Alan Maguire
2024-10-03 14:53     ` Arnaldo Carvalho de Melo
2024-10-03 15:21       ` Alan Maguire
2024-10-03 17:18         ` Arnaldo Carvalho de Melo
2024-10-03 17:48           ` Stephen Brennan
2024-10-03 18:33             ` Arnaldo Carvalho de Melo
2024-10-03 20:59 ` Jiri Olsa [this message]

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=Zv8FlbMTd24eJCyE@krava \
    --to=olsajiri@gmail.com \
    --cc=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=linux-debuggers@vger.kernel.org \
    --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 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.