From: Hao Luo <haoluo@google.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>,
Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Daniel Borkmann <daniel@iogearbox.net>,
dwarves@vger.kernel.org, Yonghong Song <yhs@fb.com>
Subject: Re: [PATCH 1/2] btf_encoder: Make encoding vars into BTF optional.
Date: Fri, 18 Sep 2020 14:26:14 -0700 [thread overview]
Message-ID: <CA+khW7icd3ndet5x845S+dBL4YiQPbWWSJa=EVYH464gKwzp-A@mail.gmail.com> (raw)
In-Reply-To: <20200918212402.GE1996959@kernel.org>
How about '--btf_encode_vars'? It is actually encoding BTF_KIND_VAR.
Hao
On Fri, Sep 18, 2020 at 2:24 PM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Fri, Sep 18, 2020 at 01:40:57PM -0700, Hao Luo escreveu:
> > Introduce an option --btf_encode_symbols to pahole so that pahole
> > will only encode global symbols upon request. On the kernel side,
> > we can add a Kconfig to turn on this feature. This would make the
> > rollout of pahole v1.18 safe against potential bugs in the feature
> > introduced in commit f3d9054ba8ff ("btf_encoder: Teach pahole to
> > store percpu variables in vmlinux BTF.").
>
> 'encode_symbols' is too generic, please rename it to
> encode_global_symbols or something like that.
>
> - Arnaldo
>
> > Signed-off-by: Hao Luo <haoluo@google.com>
> > ---
> > btf_encoder.c | 5 ++++-
> > btf_encoder.h | 2 +-
> > pahole.c | 11 ++++++++++-
> > 3 files changed, 15 insertions(+), 3 deletions(-)
> >
> > diff --git a/btf_encoder.c b/btf_encoder.c
> > index 982f59d..54ffdd1 100644
> > --- a/btf_encoder.c
> > +++ b/btf_encoder.c
> > @@ -237,7 +237,7 @@ static struct variable *hashaddr__find_variable(const struct hlist_head hashtabl
> > return NULL;
> > }
> >
> > -int cu__encode_btf(struct cu *cu, int verbose, bool force)
> > +int cu__encode_btf(struct cu *cu, int verbose, bool force, bool encode_symbols)
> > {
> > bool add_index_type = false;
> > uint32_t type_id_off;
> > @@ -314,6 +314,9 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force)
> > }
> > }
> >
> > + /* if there is no request to encode symbols, just finish. */
> > + if (!encode_symbols)
> > + goto out;
> >
> > if (btfe->percpu_shndx == 0 || !btfe->symtab)
> > goto out;
> > diff --git a/btf_encoder.h b/btf_encoder.h
> > index bca2348..f2e95fe 100644
> > --- a/btf_encoder.h
> > +++ b/btf_encoder.h
> > @@ -13,6 +13,6 @@ struct cu;
> >
> > int btf_encoder__encode();
> >
> > -int cu__encode_btf(struct cu *cu, int verbose, bool force);
> > +int cu__encode_btf(struct cu *cu, int verbose, bool force, bool encode_symbols);
> >
> > #endif /* _BTF_ENCODER_H_ */
> > diff --git a/pahole.c b/pahole.c
> > index e1cde61..079d951 100644
> > --- a/pahole.c
> > +++ b/pahole.c
> > @@ -26,6 +26,7 @@
> > static bool btf_encode;
> > static bool ctf_encode;
> > static bool first_obj_only;
> > +static bool btf_encode_symbols;
> >
> > static uint8_t class__include_anonymous;
> > static uint8_t class__include_nested_anonymous;
> > @@ -809,6 +810,7 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = dwarves_print_version;
> > #define ARGP_header_type 314
> > #define ARGP_size_bytes 315
> > #define ARGP_range 316
> > +#define ARGP_btf_encode_symbols 317
> >
> > static const struct argp_option pahole__options[] = {
> > {
> > @@ -1087,6 +1089,11 @@ static const struct argp_option pahole__options[] = {
> > .key = 'J',
> > .doc = "Encode as BTF",
> > },
> > + {
> > + .name = "btf_encode_symbols",
> > + .key = ARGP_btf_encode_symbols,
> > + .doc = "Encode global symbols in BTF. Off by default."
> > + },
> > {
> > .name = "force",
> > .key = 'j',
> > @@ -1207,6 +1214,8 @@ static error_t pahole__options_parser(int key, char *arg,
> > conf.range = arg; break;
> > case ARGP_header_type:
> > conf.header_type = arg; break;
> > + case ARGP_btf_encode_symbols:
> > + btf_encode_symbols = true; break;
> > default:
> > return ARGP_ERR_UNKNOWN;
> > }
> > @@ -2352,7 +2361,7 @@ static enum load_steal_kind pahole_stealer(struct cu *cu,
> > goto filter_it;
> >
> > if (btf_encode) {
> > - cu__encode_btf(cu, global_verbose, force);
> > + cu__encode_btf(cu, global_verbose, force, btf_encode_symbols);
> > return LSK__KEEPIT;
> > }
> >
> > --
> > 2.28.0.681.g6f77f65b4e-goog
> >
>
> --
>
> - Arnaldo
next prev parent reply other threads:[~2020-09-18 21:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-18 20:40 [PATCH 0/2] pahole: Make encoding percpu vars into BTF optional Hao Luo
2020-09-18 20:40 ` [PATCH 1/2] btf_encoder: Make encoding " Hao Luo
2020-09-18 21:24 ` Arnaldo Carvalho de Melo
2020-09-18 21:26 ` Hao Luo [this message]
2020-09-18 21:40 ` Arnaldo Carvalho de Melo
2020-09-18 20:40 ` [PATCH 2/2] btf_encoder: Introduce option '--btf_encode_force' Hao Luo
2020-09-19 0:57 ` [PATCH 0/2] pahole: Make encoding percpu vars into BTF optional Alexei Starovoitov
2020-09-19 4:00 ` Hao Luo
2020-09-21 12:27 ` 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='CA+khW7icd3ndet5x845S+dBL4YiQPbWWSJa=EVYH464gKwzp-A@mail.gmail.com' \
--to=haoluo@google.com \
--cc=acme@kernel.org \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=arnaldo.melo@gmail.com \
--cc=daniel@iogearbox.net \
--cc=dwarves@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).