lkml.org 
[lkml]   [2021]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH bpf-next] samples/bpf: Add hello world sample for newbies
On Thu, Feb 4, 2021 at 11:27 AM Song Liu <song@kernel.org> wrote:
>
> On Thu, Feb 4, 2021 at 3:42 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
> >
> > The program is made in a way that everytime an execve syscall
> > is executed it prints Hello, BPF World!
> >
> > This is inspired and based on the code example for the book
> > Linux Observability with BPF [1], load_bpf_file() has been
> > removed after commit ceb5dea56543 ("samples: bpf: Remove
> > bpf_load loader completely"), so the old version can not
> > work in the latest mainline kernel.
> >
> > Since it is very simple and useful for newbies, I think it is
> > necessary to be upstreamed.
>
> I wonder how much value we will get from this sample. If the user is
> able to compile and try the hello world, they are sure able to compile
> other code in samples/bpf. Also, this code doesn't use BPF skeleton,
> which is the recommended way to write BPF programs. Maybe an
> minimal example with BPF skeleton will add more value here?
>

I agree with Song. Plus, we already have similar simple examples that
are set up outside of kernel build infrastructure, which is simpler
for newbies to pick up. Please check [0]:

[0] https://github.com/libbpf/libbpf-bootstrap/tree/master/src


> Thanks,
> Song
>
>
>
> >
> > [1] https://github.com/bpftools/linux-observability-with-bpf/tree/master/code/chapter-2/hello_world
> >
> > Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> > ---
> > samples/bpf/Makefile | 3 +++
> > samples/bpf/hello_kern.c | 14 ++++++++++++++
> > samples/bpf/hello_user.c | 42 ++++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 59 insertions(+)
> > create mode 100644 samples/bpf/hello_kern.c
> > create mode 100644 samples/bpf/hello_user.c
> >

[...]

\
 
 \ /
  Last update: 2021-02-05 00:48    [W:0.075 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site