BPF Archive mirror
 help / color / mirror / Atom feed
From: "Wang, Haiyue" <haiyue.wang@intel.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>,
	"Song Liu" <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	"John Fastabend" <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH bpf-next v1] bpf,arena: Rename the kfunc set variable
Date: Wed, 8 May 2024 00:49:50 +0000	[thread overview]
Message-ID: <CY8PR11MB77476783A1CB0C7F9534A5BAF7E52@CY8PR11MB7747.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CAEf4BzZaGcLTOBL=5nPWx22PKFOD7yg2a-qzV3dJ85S9hpCGjQ@mail.gmail.com>

> -----Original Message-----
> From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
> Sent: Wednesday, May 8, 2024 05:21
> To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> Cc: Wang, Haiyue <haiyue.wang@intel.com>; bpf <bpf@vger.kernel.org>; Alexei Starovoitov
> <ast@kernel.org>; Daniel Borkmann <daniel@iogearbox.net>; Andrii Nakryiko <andrii@kernel.org>; Martin
> KaFai Lau <martin.lau@linux.dev>; Eduard Zingerman <eddyz87@gmail.com>; Song Liu <song@kernel.org>;
> Yonghong Song <yonghong.song@linux.dev>; John Fastabend <john.fastabend@gmail.com>; KP Singh
> <kpsingh@kernel.org>; Stanislav Fomichev <sdf@google.com>; Hao Luo <haoluo@google.com>; Jiri Olsa
> <jolsa@kernel.org>; open list <linux-kernel@vger.kernel.org>
> Subject: Re: [PATCH bpf-next v1] bpf,arena: Rename the kfunc set variable
> 
> On Tue, May 7, 2024 at 1:42 PM Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
> >
> > On Tue, May 7, 2024 at 9:43 AM Andrii Nakryiko
> > <andrii.nakryiko@gmail.com> wrote:
> > >
> > > On Tue, May 7, 2024 at 7:36 AM Alexei Starovoitov
> > > <alexei.starovoitov@gmail.com> wrote:
> > > >
> > > > On Mon, May 6, 2024 at 7:46 PM Haiyue Wang <haiyue.wang@intel.com> wrote:
> > > > >
> > > > > Rename the kfunc set variable to specify the 'arena' function scope,
> > > > > although the 'UNSPEC' type BPF program is mapped to 'COMMON' hook.
> > > > >
> > > > > And there is 'common_kfunc_set' defined for real 'common' function in
> > > > > file 'kernel/bpf/helpers.c'.
> > > >
> > > > I think common_kfunc_set is a better name to describe that these
> > > > two kfuncs are in a common category.
> > > > BPF_PROG_TYPE_UNSPEC is a lot less obvious.
> > > >
> > > > There are two static common_kfunc_set in helpers.c and arena.c
> > > > and that's fine.
> > >
> > > it is actually confusing when reading/grepping code, though, so why
> >
> > What's the confusion? Same name static var in different files?
> 
> Not in general, but in this case it's arena-specific kfuncs for all
> program types, and it's initialized with &arena_kfuncs, so it would be

Yes, the original idea is to try match some kind of map style:
	common_kfunc_set.set = &common_btf_ids

> matching to have some "arena" mention in the name. But it's minor,
> let's keep it.
> 
> > There are tons of such cases in the kernel src tree.
> >
> > > not have arena_common_kfunc_set and whatever the meaningful
> > > "qualifier" name for the other one?
> >
> > arena_common_kfunc_set is certainly better than arena_kfunc_set,
> > but I don't like to make the precedent to start renaming static vars
> > because they have the same name.

From the category point of view, "arena" should be "common" function, and
make sense to name "common_kfunc_set". ;-)

> >
> > > >
> > > > pw-bot: cr

      reply	other threads:[~2024-05-08  0:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07  2:49 [PATCH bpf-next v1] bpf,arena: Rename the kfunc set variable Haiyue Wang
2024-05-07 14:36 ` Alexei Starovoitov
2024-05-07 16:43   ` Andrii Nakryiko
2024-05-07 20:41     ` Alexei Starovoitov
2024-05-07 21:20       ` Andrii Nakryiko
2024-05-08  0:49         ` Wang, Haiyue [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=CY8PR11MB77476783A1CB0C7F9534A5BAF7E52@CY8PR11MB7747.namprd11.prod.outlook.com \
    --to=haiyue.wang@intel.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --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=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).