public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Cc: Jiri Olsa <olsajiri@gmail.com>,
	Alan Maguire <alan.maguire@oracle.com>,
	ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net,
	eddyz87@gmail.com, haoluo@google.com, john.fastabend@gmail.com,
	kpsingh@chromium.org, sinquersw@gmail.com, martin.lau@kernel.org,
	songliubraving@fb.com, sdf@google.com, timo@incline.eu,
	yhs@fb.com, bpf@vger.kernel.org
Subject: Re: [PATCH v3 dwarves 5/8] btf_encoder: Represent "."-suffixed functions (".isra.0") in BTF
Date: Wed, 8 Feb 2023 21:51:47 +0100	[thread overview]
Message-ID: <Y+QLY1cZGAxq6sbW@krava> (raw)
In-Reply-To: <Y+O1Bvur0VnHJX6C@kernel.org>

On Wed, Feb 08, 2023 at 11:43:18AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Feb 08, 2023 at 02:19:20PM +0100, Jiri Olsa escreveu:
> > On Tue, Feb 07, 2023 at 05:14:59PM +0000, Alan Maguire wrote:
> > 
> > SNIP
> > 
> > > +
> > >  /*
> > >   * This corresponds to the same macro defined in
> > >   * include/linux/kallsyms.h
> > > @@ -818,6 +901,11 @@ static int functions_cmp(const void *_a, const void *_b)
> > >  	const struct elf_function *a = _a;
> > >  	const struct elf_function *b = _b;
> > >  
> > > +	/* if search key allows prefix match, verify target has matching
> > > +	 * prefix len and prefix matches.
> > > +	 */
> > > +	if (a->prefixlen && a->prefixlen == b->prefixlen)
> > > +		return strncmp(a->name, b->name, b->prefixlen);
> > >  	return strcmp(a->name, b->name);
> > >  }
> > >  
> > > @@ -850,14 +938,22 @@ static int btf_encoder__collect_function(struct btf_encoder *encoder, GElf_Sym *
> > >  	}
> > >  
> > >  	encoder->functions.entries[encoder->functions.cnt].name = name;
> > > +	if (strchr(name, '.')) {
> > > +		const char *suffix = strchr(name, '.');
> > > +
> > > +		encoder->functions.suffix_cnt++;
> > > +		encoder->functions.entries[encoder->functions.cnt].prefixlen = suffix - name;
> > > +	}
> > >  	encoder->functions.entries[encoder->functions.cnt].generated = false;
> > > +	encoder->functions.entries[encoder->functions.cnt].function = NULL;
> > 
> > should we zero functions.state in here? next patch adds other stuff
> > like got_parameter_names and parameter_names in it, so looks like it
> > could actually matter
> 
> Probably, but that can come as a followup patch, right?

sure, if Alan is ok with that

jirka

> 
> I've applied the patches, combining the patches documenting the two new
> command line options with the patches where those options are
> introduced.
> 
> Testing everything now.
> 
> Thanks,
> 
> - Arnaldo
>  
> > jirka
> > 
> > >  	encoder->functions.cnt++;
> > >  	return 0;
> > >  }
> > >  
> > > -static struct elf_function *btf_encoder__find_function(const struct btf_encoder *encoder, const char *name)
> > > +static struct elf_function *btf_encoder__find_function(const struct btf_encoder *encoder,
> > > +						       const char *name, size_t prefixlen)
> > >  {
> > > -	struct elf_function key = { .name = name };
> > > +	struct elf_function key = { .name = name, .prefixlen = prefixlen };
> > >  
> > 
> > SNIP
> 
> -- 
> 
> - Arnaldo

  reply	other threads:[~2023-02-08 20:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 17:14 [PATCH v3 dwarves 0/8] dwarves: support encoding of optimized-out parameters, removal of inconsistent static functions Alan Maguire
2023-02-07 17:14 ` [PATCH v3 dwarves 1/8] dwarf_loader: Help spotting functions with optimized-out parameters Alan Maguire
2023-02-07 17:14 ` [PATCH v3 dwarves 2/8] btf_encoder: store type_id_off, unspecified type in encoder Alan Maguire
2023-02-07 17:14 ` [PATCH v3 dwarves 3/8] btf_encoder: Refactor function addition into dedicated btf_encoder__add_func Alan Maguire
2023-02-07 17:14 ` [PATCH v3 dwarves 4/8] btf_encoder: Rework btf_encoders__*() API to allow traversal of encoders Alan Maguire
2023-02-07 17:14 ` [PATCH v3 dwarves 5/8] btf_encoder: Represent "."-suffixed functions (".isra.0") in BTF Alan Maguire
2023-02-08 13:19   ` Jiri Olsa
2023-02-08 14:43     ` Arnaldo Carvalho de Melo
2023-02-08 20:51       ` Jiri Olsa [this message]
2023-02-08 22:57         ` Alan Maguire
2023-02-07 17:15 ` [PATCH v3 dwarves 6/8] btf_encoder: support delaying function addition to check for function prototype inconsistencies Alan Maguire
2023-02-07 17:15 ` [PATCH v3 dwarves 7/8] dwarves: document --btf_gen_optimized option Alan Maguire
2023-02-07 17:15 ` [PATCH v3 dwarves 8/8] dwarves: document --skip_encoding_btf_inconsistent_proto option Alan Maguire
2023-02-08 13:20 ` [PATCH v3 dwarves 0/8] dwarves: support encoding of optimized-out parameters, removal of inconsistent static functions Jiri Olsa
2023-02-08 15:25   ` Alan Maguire
2023-02-08 16:20 ` Arnaldo Carvalho de Melo
2023-02-08 16:50   ` Arnaldo Carvalho de Melo
2023-02-09  9:36     ` Jiri Olsa
2023-02-09 12:22       ` Arnaldo Carvalho de Melo
     [not found]     ` <3c021d56-8818-2464-f7e0-889e769c0311@oracle.com>
2023-02-09 13:09       ` [PATCH bpf-next] bpf: add --skip_encoding_btf_inconsistent_proto, --btf_gen_optimized to pahole flags for v1.25 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=Y+QLY1cZGAxq6sbW@krava \
    --to=olsajiri@gmail.com \
    --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=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kpsingh@chromium.org \
    --cc=martin.lau@kernel.org \
    --cc=sdf@google.com \
    --cc=sinquersw@gmail.com \
    --cc=songliubraving@fb.com \
    --cc=timo@incline.eu \
    --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