From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>,
bpf@vger.kernel.org, dwarves@vger.kernel.org,
linux-debuggers@vger.kernel.org
Subject: Re: [PATCH dwarves v3 1/5] btf_encoder: use bitfield to control var encoding
Date: Thu, 3 Oct 2024 11:41:29 -0300 [thread overview]
Message-ID: <Zv6tGQr_UKPPoshR@x1> (raw)
In-Reply-To: <d25392a8-fa5c-4188-8e8b-fc822d9862f2@oracle.com>
On Thu, Oct 03, 2024 at 02:41:17PM +0100, Alan Maguire wrote:
> On 03/10/2024 00:52, Stephen Brennan wrote:
> > We will need more granularity in the future, in order to add support for
> > encoding global variables as well. So replace the skip_encoding_vars
> > boolean with a flag variable named "encode_vars". There is currently
> > only one bit specified, and it is set when percpu variables should be
> > emitted.
> >
> > Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
>
> Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Thanks, applying this first one.
- Arnaldo
> > ---
> > btf_encoder.c | 10 ++++++----
> > btf_encoder.h | 6 ++++++
> > 2 files changed, 12 insertions(+), 4 deletions(-)
> >
> > diff --git a/btf_encoder.c b/btf_encoder.c
> > index 51cd7bf..652a945 100644
> > --- a/btf_encoder.c
> > +++ b/btf_encoder.c
> > @@ -119,7 +119,6 @@ struct btf_encoder {
> > uint32_t type_id_off;
> > bool has_index_type,
> > need_index_type,
> > - skip_encoding_vars,
> > raw_output,
> > verbose,
> > force,
> > @@ -137,6 +136,7 @@ struct btf_encoder {
> > int allocated;
> > uint32_t shndx;
> > } percpu;
> > + int encode_vars;
> > struct {
> > struct elf_function *entries;
> > int allocated;
> > @@ -2369,7 +2369,6 @@ struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filenam
> >
> > encoder->force = conf_load->btf_encode_force;
> > encoder->gen_floats = conf_load->btf_gen_floats;
> > - encoder->skip_encoding_vars = conf_load->skip_encoding_btf_vars;
> > encoder->skip_encoding_decl_tag = conf_load->skip_encoding_btf_decl_tag;
> > encoder->tag_kfuncs = conf_load->btf_decl_tag_kfuncs;
> > encoder->gen_distilled_base = conf_load->btf_gen_distilled_base;
> > @@ -2377,6 +2376,9 @@ struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filenam
> > encoder->has_index_type = false;
> > encoder->need_index_type = false;
> > encoder->array_index_id = 0;
> > + encoder->encode_vars = 0;
> > + if (!conf_load->skip_encoding_btf_vars)
> > + encoder->encode_vars |= BTF_VAR_PERCPU;
> >
> > GElf_Ehdr ehdr;
> >
> > @@ -2436,7 +2438,7 @@ struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filenam
> > if (!encoder->percpu.shndx && encoder->verbose)
> > printf("%s: '%s' doesn't have '%s' section\n", __func__, cu->filename, PERCPU_SECTION);
> >
> > - if (btf_encoder__collect_symbols(encoder, !encoder->skip_encoding_vars))
> > + if (btf_encoder__collect_symbols(encoder, encoder->encode_vars & BTF_VAR_PERCPU))
> > goto out_delete;
> >
> > if (encoder->verbose)
> > @@ -2633,7 +2635,7 @@ int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu, struct co
> > goto out;
> > }
> >
> > - if (!encoder->skip_encoding_vars)
> > + if (encoder->encode_vars)
> > err = btf_encoder__encode_cu_variables(encoder);
> >
> > if (!err)
> > diff --git a/btf_encoder.h b/btf_encoder.h
> > index f54c95a..91e7947 100644
> > --- a/btf_encoder.h
> > +++ b/btf_encoder.h
> > @@ -16,6 +16,12 @@ struct btf;
> > struct cu;
> > struct list_head;
> >
> > +/* Bit flags specifying which kinds of variables are emitted */
> > +enum btf_var_option {
> > + BTF_VAR_NONE = 0,
> > + BTF_VAR_PERCPU = 1,
> > +};
> > +
> > struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filename, struct btf *base_btf, bool verbose, struct conf_load *conf_load);
> > void btf_encoder__delete(struct btf_encoder *encoder);
> >
next prev parent reply other threads:[~2024-10-03 14:41 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 [this message]
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 ` [PATCH dwarves v3 0/5] Emit global variables in BTF 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=Zv6tGQr_UKPPoshR@x1 \
--to=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.