[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CY8PR11MB77476783A1CB0C7F9534A5BAF7E52@CY8PR11MB7747.namprd11.prod.outlook.com>
Date: Wed, 8 May 2024 00:49:50 +0000
From: "Wang, Haiyue" <haiyue.wang@...el.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>, Alexei Starovoitov
<alexei.starovoitov@...il.com>
CC: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>, "Daniel
Borkmann" <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
"Martin KaFai Lau" <martin.lau@...ux.dev>, Eduard Zingerman
<eddyz87@...il.com>, "Song Liu" <song@...nel.org>, Yonghong Song
<yonghong.song@...ux.dev>, "John Fastabend" <john.fastabend@...il.com>, KP
Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...gle.com>, Hao Luo
<haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>, open list
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH bpf-next v1] bpf,arena: Rename the kfunc set variable
> -----Original Message-----
> From: Andrii Nakryiko <andrii.nakryiko@...il.com>
> Sent: Wednesday, May 8, 2024 05:21
> To: Alexei Starovoitov <alexei.starovoitov@...il.com>
> Cc: Wang, Haiyue <haiyue.wang@...el.com>; bpf <bpf@...r.kernel.org>; Alexei Starovoitov
> <ast@...nel.org>; Daniel Borkmann <daniel@...earbox.net>; Andrii Nakryiko <andrii@...nel.org>; Martin
> KaFai Lau <martin.lau@...ux.dev>; Eduard Zingerman <eddyz87@...il.com>; Song Liu <song@...nel.org>;
> Yonghong Song <yonghong.song@...ux.dev>; John Fastabend <john.fastabend@...il.com>; KP Singh
> <kpsingh@...nel.org>; Stanislav Fomichev <sdf@...gle.com>; Hao Luo <haoluo@...gle.com>; Jiri Olsa
> <jolsa@...nel.org>; open list <linux-kernel@...r.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@...il.com> wrote:
> >
> > On Tue, May 7, 2024 at 9:43 AM Andrii Nakryiko
> > <andrii.nakryiko@...il.com> wrote:
> > >
> > > On Tue, May 7, 2024 at 7:36 AM Alexei Starovoitov
> > > <alexei.starovoitov@...il.com> wrote:
> > > >
> > > > On Mon, May 6, 2024 at 7:46 PM Haiyue Wang <haiyue.wang@...el.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
Powered by blists - more mailing lists