BPF List
 help / color / mirror / Atom feed
From: Delyan Kratunov <delyank@fb.com>
To: "andrii.nakryiko@gmail.com" <andrii.nakryiko@gmail.com>
Cc: "daniel@iogearbox.net" <daniel@iogearbox.net>,
	"ast@kernel.org" <ast@kernel.org>,
	"andrii@kernel.org" <andrii@kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2 4/5] bpftool: add support for subskeletons
Date: Tue, 15 Mar 2022 17:28:29 +0000	[thread overview]
Message-ID: <534afc41cb3066ed049f0ab15ef65d32d30a33d3.camel@fb.com> (raw)
In-Reply-To: <e3e84d87c2a0c13ae9f20e44493c1578e06b6618.camel@fb.com>

On Mon, 2022-03-14 at 16:13 -0700, Delyan Kratunov wrote:
> Thanks, Andrii! The nits/refactors are straightforward but have some questions
> below:
> 
> On Fri, 2022-03-11 at 15:27 -0800, Andrii Nakryiko wrote:
> > > +
> > > +                       /* sanitize variable name, e.g., for static vars inside
> > > +                        * a function, it's name is '<function name>.<variable name>',
> > > +                        * which we'll turn into a '<function name>_<variable name>'.
> > > +                        */
> > > +                       sanitize_identifier(var_ident + 1);
> > 
> > btw, I think we don't need sanitization anymore. We needed it for
> > static variables (they would be of the form <func_name>.<var_name> for
> > static variables inside the functions), but now it's just unnecessary
> > complication
> 
> How would we handle static variables inside functions in libraries then?

Ah, just realized 31332ccb7562 (bpftool: Stop emitting static variables in BPF
skeleton) stopped that. I'll remove the sanitization then.

[...]


> > we don't know the name of the final object, why would we allow to set
> > any object name at all?
> 
> We don't really care about the final object name but we do need an object name
> for the subskeleton. The subskeleton type name, header guard etc all use it.
> We can say that it's always taken from the file name, but giving the user the
> option to override it feels right, given the parallel with skeletons (and what
> would we do if the file name is a pipe from a subshell invocation?).

In particular, with the current test setup, if we don't use the name param, we'd
end up inferring names like test_subskeleton_lib_linked3 from the filename. The
tests case is a bit contrived and we can work around it but there may be other
similar situations out there.


-- Delyan

  reply	other threads:[~2022-03-15 17:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11  0:11 [PATCH bpf-next v2 0/5] Subskeleton support for BPF libraries Delyan Kratunov
2022-03-11  0:11 ` [PATCH bpf-next v2 1/5] libbpf: add new strict flag for .text subprograms Delyan Kratunov
2022-03-11 22:30   ` Andrii Nakryiko
2022-03-11  0:11 ` [PATCH bpf-next v2 2/5] libbpf: init btf_{key,value}_type_id on internal map open Delyan Kratunov
2022-03-11 22:42   ` Andrii Nakryiko
2022-03-11  0:11 ` [PATCH bpf-next v2 3/5] libbpf: add subskeleton scaffolding Delyan Kratunov
2022-03-11 22:52   ` Andrii Nakryiko
2022-03-11 23:08     ` Andrii Nakryiko
2022-03-11 23:28       ` Delyan Kratunov
2022-03-11 23:41         ` Andrii Nakryiko
2022-03-11  0:11 ` [PATCH bpf-next v2 4/5] bpftool: add support for subskeletons Delyan Kratunov
2022-03-11 23:27   ` Andrii Nakryiko
2022-03-14 23:18     ` Delyan Kratunov
2022-03-15 17:28       ` Delyan Kratunov [this message]
2022-03-15 18:07         ` Andrii Nakryiko
2022-03-15 18:07       ` Andrii Nakryiko
2022-03-11  0:12 ` [PATCH bpf-next v2 5/5] selftests/bpf: test subskeleton functionality Delyan Kratunov
2022-03-11 23:40   ` Andrii Nakryiko
2022-03-14 23:50     ` Delyan Kratunov
2022-03-15 18:31       ` Andrii Nakryiko
2022-03-11  5:10 ` [PATCH bpf-next v2 0/5] Subskeleton support for BPF libraries Yonghong Song
2022-03-11 18:18   ` Delyan Kratunov
2022-03-12  0:39     ` Yonghong Song

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=534afc41cb3066ed049f0ab15ef65d32d30a33d3.camel@fb.com \
    --to=delyank@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    /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