qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH v4 4/7] ebpf: Added eBPF RSS loader.


From: Daniel P . Berrangé
Subject: Re: [RFC PATCH v4 4/7] ebpf: Added eBPF RSS loader.
Date: Mon, 8 Feb 2021 09:49:33 +0000
User-agent: Mutt/1.14.6 (2020-07-11)

On Thu, Feb 04, 2021 at 07:09:48PM +0200, Andrew Melnychenko wrote:
> From: Andrew <andrew@daynix.com>
> 
> Added function that loads RSS eBPF program.
> Added stub functions for RSS eBPF loader.
> Added meson and configuration options.
> 
> By default, eBPF feature enabled if libbpf is present in the build system.
> libbpf checked in configuration shell script and meson script.
> 
> Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
> ---
>  configure               |  30 +++
>  ebpf/ebpf_rss-stub.c    |  40 ++++
>  ebpf/ebpf_rss.c         | 165 +++++++++++++++++
>  ebpf/ebpf_rss.h         |  44 +++++
>  ebpf/meson.build        |   1 +
>  ebpf/rss.bpf.skeleton.h | 397 ++++++++++++++++++++++++++++++++++++++++
>  ebpf/trace-events       |   4 +
>  ebpf/trace.h            |   2 +
>  meson.build             |  13 ++
>  9 files changed, 696 insertions(+)
>  create mode 100644 ebpf/ebpf_rss-stub.c
>  create mode 100644 ebpf/ebpf_rss.c
>  create mode 100644 ebpf/ebpf_rss.h
>  create mode 100644 ebpf/meson.build
>  create mode 100644 ebpf/rss.bpf.skeleton.h
>  create mode 100644 ebpf/trace-events
>  create mode 100644 ebpf/trace.h

When adding a new build dependancy we need to update the dockerfiles
in tests/docker/dockerfiles to add the required development package
on all the distros that have it available currently. It is in Fedora
at least, but have not checked other distros.

> 
> diff --git a/configure b/configure
> index e85d6baf8f..38797e0116 100755
> --- a/configure
> +++ b/configure

> +##########################################
> +# check for usable bpf system call
> +if test "$bpf" = ""; then
> +    have_bpf=no
> +    if test "$linux" = "yes" -a "$bigendian" != "yes"; then
> +        cat > $TMPC << EOF
> +    #include <stdlib.h>
> +    #include <bpf/libbpf.h>
> +    int main(void) {
> +        struct bpf_object *obj = NULL;
> +        bpf_object__load(obj);
> +        exit(0);
> +    }
> +EOF
> +        if compile_prog "" "-lbpf" ; then
> +            have_bpf=yes
> +            bpf=yes
> +        fi
> +    fi
> +fi

libbpf provides a pkg-config file, so it should be probed using
pkg-config in meson.build. CC'ing Paolo to confirm.


> diff --git a/meson.build b/meson.build
> index 2d8b433ff0..9a24020bc3 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -995,6 +995,13 @@ if not get_option('fuse_lseek').disabled()
>    endif
>  endif
>  
> +# libbpf
> +libbpf = not_found
> +if 'CONFIG_EBPF' in config_host
> +  libbpf = cc.find_library('bpf', required: true)
> +
> +endif

This is where you need todo the pkg-config search using 'dependency()'
instead of 'find_library'.

> +
>  if get_option('cfi')
>    cfi_flags=[]
>    # Check for dependency on LTO
> @@ -1748,6 +1755,7 @@ if have_system
>      'backends',
>      'backends/tpm',
>      'chardev',
> +    'ebpf',
>      'hw/9pfs',
>      'hw/acpi',
>      'hw/adc',
> @@ -1914,6 +1922,9 @@ subdir('accel')
>  subdir('plugins')
>  subdir('bsd-user')
>  subdir('linux-user')
> +subdir('ebpf')
> +
> +common_ss.add(libbpf)
>  
>  bsd_user_ss.add(files('gdbstub.c'))
>  specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
> @@ -2592,6 +2603,7 @@ summary_info += {'RDMA support':      
> config_host.has_key('CONFIG_RDMA')}
>  summary_info += {'PVRDMA support':    config_host.has_key('CONFIG_PVRDMA')}
>  summary_info += {'fdt support':       fdt_opt == 'disabled' ? false : 
> fdt_opt}
>  summary_info += {'libcap-ng support': libcap_ng.found()}
> +summary_info += {'bpf support': config_host.has_key('CONFIG_EBPF')}
>  # TODO: add back protocol and server version
>  summary_info += {'spice support':     config_host.has_key('CONFIG_SPICE')}
>  summary_info += {'rbd support':       rbd.found()}
> @@ -2653,3 +2665,4 @@ if not supported_oses.contains(targetos)
>    message('if you care about QEMU on this platform you should contact')
>    message('us upstream at qemu-devel@nongnu.org.')
>  endif
> +
> -- 
> 2.30.0
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]