diff mbox series

[ovs-dev] travis: Test build with afxdp.

Message ID 20191021181114.4123-1-i.maximets@ovn.org
State Accepted
Headers show
Series [ovs-dev] travis: Test build with afxdp. | expand

Commit Message

Ilya Maximets Oct. 21, 2019, 6:11 p.m. UTC
We can't easily update the kernel on TravisCI to run system tests
with AF_XDP, but we could run build tests with libbpf and headers
from newer kernels.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 .travis.yml            |  1 +
 .travis/linux-build.sh | 34 ++++++++++++++++++++++++++++------
 2 files changed, 29 insertions(+), 6 deletions(-)

Comments

Ben Pfaff Oct. 21, 2019, 4:41 p.m. UTC | #1
On Mon, Oct 21, 2019 at 08:11:14PM +0200, Ilya Maximets wrote:
> We can't easily update the kernel on TravisCI to run system tests
> with AF_XDP, but we could run build tests with libbpf and headers
> from newer kernels.
> 
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>

I read this and it seemed reasonable, but I didn't apply it or test it,
so take this ack with a grain of salt.

Acked-by: Ben Pfaff <blp@ovn.org>
Aaron Conole Oct. 21, 2019, 7:28 p.m. UTC | #2
Ilya Maximets <i.maximets@ovn.org> writes:

> We can't easily update the kernel on TravisCI to run system tests
> with AF_XDP, but we could run build tests with libbpf and headers
> from newer kernels.
>
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---

https://travis-ci.org/ovsrobot/ovs/jobs/600899950

Nice.  Looks like the afxdp related objects are getting compiled.

Acked-by: Aaron Conole <aconole@redhat.com>

>  .travis.yml            |  1 +
>  .travis/linux-build.sh | 34 ++++++++++++++++++++++++++++------
>  2 files changed, 29 insertions(+), 6 deletions(-)
>
> diff --git a/.travis.yml b/.travis.yml
> index eabbad92d..5676d9748 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -39,6 +39,7 @@ env:
>    - TESTSUITE=1 LIBS=-ljemalloc
>    - KERNEL_LIST="5.0  4.20 4.19 4.18 4.17 4.16"
>    - KERNEL_LIST="4.15 4.14 4.9  4.4  3.19 3.16"
> +  - AFXDP=1 KERNEL=5.3
>    - M32=1 OPTS="--disable-ssl"
>    - DPDK=1 OPTS="--enable-shared"
>    - DPDK_SHARED=1
> diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
> index 758c8235c..ff4b8fa39 100755
> --- a/.travis/linux-build.sh
> +++ b/.travis/linux-build.sh
> @@ -38,7 +38,7 @@ function install_kernel()
>      wget ${url} || wget ${url} || wget ${url/cdn/www}
>  
>      tar xvf linux-${version}.tar.xz > /dev/null
> -    cd linux-${version}
> +    pushd linux-${version}
>      make allmodconfig
>  
>      # Cannot use CONFIG_KCOV: -fsanitize-coverage=trace-pc is not supported by compiler
> @@ -60,9 +60,26 @@ function install_kernel()
>          make net/bridge/
>      fi
>  
> -    EXTRA_OPTS="${EXTRA_OPTS} --with-linux=$(pwd)"
> -    echo "Installed kernel source in $(pwd)"
> -    cd ..
> +    if [ "$AFXDP" ]; then
> +        sudo make headers_install INSTALL_HDR_PATH=/usr
> +        pushd tools/lib/bpf/
> +        # Bulding with gcc because there are some issues in make files
> +        # that breaks building libbpf with clang on Travis.
> +        CC=gcc sudo make install
> +        CC=gcc sudo make install_headers
> +        sudo ldconfig
> +        popd
> +        # The Linux kernel defines __always_inline in stddef.h (283d7573), and
> +        # sys/cdefs.h tries to re-define it.  Older libc-dev package in xenial
> +        # doesn't have a fix for this issue.  Applying it manually.
> +        sudo sed -i '/^# define __always_inline .*/i # undef __always_inline' \
> +                    /usr/include/x86_64-linux-gnu/sys/cdefs.h || true
> +        EXTRA_OPTS="${EXTRA_OPTS} --enable-afxdp"
> +    else
> +        EXTRA_OPTS="${EXTRA_OPTS} --with-linux=$(pwd)"
> +        echo "Installed kernel source in $(pwd)"
> +    fi
> +    popd
>  }
>  
>  function install_dpdk()
> @@ -127,8 +144,9 @@ function build_ovs()
>      configure_ovs $OPTS
>      make selinux-policy
>  
> -    # Only build datapath if we are testing kernel w/o running testsuite
> -    if [ "${KERNEL}" ]; then
> +    # Only build datapath if we are testing kernel w/o running testsuite and
> +    # AF_XDP support.
> +    if [ "${KERNEL}" ] && ! [ "$AFXDP" ]; then
>          pushd datapath
>          make -j4
>          popd
> @@ -161,6 +179,10 @@ elif [ "$M32" ]; then
>      export CC="$CC -m32"
>  else
>      OPTS="--enable-sparse"
> +    if [ "$AFXDP" ]; then
> +        # netdev-afxdp uses memset for 64M for umem initialization.
> +        SPARSE_FLAGS="${SPARSE_FLAGS} -Wno-memcpy-max-count"
> +    fi
>      CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${SPARSE_FLAGS}"
>  fi
Ilya Maximets Oct. 21, 2019, 8:53 p.m. UTC | #3
On 21.10.2019 21:28, Aaron Conole wrote:
> Ilya Maximets <i.maximets@ovn.org> writes:
> 
>> We can't easily update the kernel on TravisCI to run system tests
>> with AF_XDP, but we could run build tests with libbpf and headers
>> from newer kernels.
>>
>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
>> ---
> 
> https://travis-ci.org/ovsrobot/ovs/jobs/600899950
> 
> Nice.  Looks like the afxdp related objects are getting compiled.
> 
> Acked-by: Aaron Conole <aconole@redhat.com>

Thanks, Aaron and Ben!  Applied to master.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/.travis.yml b/.travis.yml
index eabbad92d..5676d9748 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -39,6 +39,7 @@  env:
   - TESTSUITE=1 LIBS=-ljemalloc
   - KERNEL_LIST="5.0  4.20 4.19 4.18 4.17 4.16"
   - KERNEL_LIST="4.15 4.14 4.9  4.4  3.19 3.16"
+  - AFXDP=1 KERNEL=5.3
   - M32=1 OPTS="--disable-ssl"
   - DPDK=1 OPTS="--enable-shared"
   - DPDK_SHARED=1
diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
index 758c8235c..ff4b8fa39 100755
--- a/.travis/linux-build.sh
+++ b/.travis/linux-build.sh
@@ -38,7 +38,7 @@  function install_kernel()
     wget ${url} || wget ${url} || wget ${url/cdn/www}
 
     tar xvf linux-${version}.tar.xz > /dev/null
-    cd linux-${version}
+    pushd linux-${version}
     make allmodconfig
 
     # Cannot use CONFIG_KCOV: -fsanitize-coverage=trace-pc is not supported by compiler
@@ -60,9 +60,26 @@  function install_kernel()
         make net/bridge/
     fi
 
-    EXTRA_OPTS="${EXTRA_OPTS} --with-linux=$(pwd)"
-    echo "Installed kernel source in $(pwd)"
-    cd ..
+    if [ "$AFXDP" ]; then
+        sudo make headers_install INSTALL_HDR_PATH=/usr
+        pushd tools/lib/bpf/
+        # Bulding with gcc because there are some issues in make files
+        # that breaks building libbpf with clang on Travis.
+        CC=gcc sudo make install
+        CC=gcc sudo make install_headers
+        sudo ldconfig
+        popd
+        # The Linux kernel defines __always_inline in stddef.h (283d7573), and
+        # sys/cdefs.h tries to re-define it.  Older libc-dev package in xenial
+        # doesn't have a fix for this issue.  Applying it manually.
+        sudo sed -i '/^# define __always_inline .*/i # undef __always_inline' \
+                    /usr/include/x86_64-linux-gnu/sys/cdefs.h || true
+        EXTRA_OPTS="${EXTRA_OPTS} --enable-afxdp"
+    else
+        EXTRA_OPTS="${EXTRA_OPTS} --with-linux=$(pwd)"
+        echo "Installed kernel source in $(pwd)"
+    fi
+    popd
 }
 
 function install_dpdk()
@@ -127,8 +144,9 @@  function build_ovs()
     configure_ovs $OPTS
     make selinux-policy
 
-    # Only build datapath if we are testing kernel w/o running testsuite
-    if [ "${KERNEL}" ]; then
+    # Only build datapath if we are testing kernel w/o running testsuite and
+    # AF_XDP support.
+    if [ "${KERNEL}" ] && ! [ "$AFXDP" ]; then
         pushd datapath
         make -j4
         popd
@@ -161,6 +179,10 @@  elif [ "$M32" ]; then
     export CC="$CC -m32"
 else
     OPTS="--enable-sparse"
+    if [ "$AFXDP" ]; then
+        # netdev-afxdp uses memset for 64M for umem initialization.
+        SPARSE_FLAGS="${SPARSE_FLAGS} -Wno-memcpy-max-count"
+    fi
     CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${SPARSE_FLAGS}"
 fi