Re: [PATCH bpf-next] samples/bpf: Add hello world sample for newbies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 4, 2021 at 11:27 AM Song Liu <song@xxxxxxxxxx> wrote:
>
> On Thu, Feb 4, 2021 at 3:42 AM Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> 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@xxxxxxxxxxx>
> > ---
> >  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
> >

[...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux