On 7/4/23 12:59, Ales Musil wrote: > On Tue, Jul 4, 2023 at 12:53 PM Eelco Chaudron <[email protected]> wrote: > >> >> >> On 4 Jul 2023, at 11:00, Ales Musil wrote: >> >>> On Mon, Jun 19, 2023 at 11:32 AM Eelco Chaudron <[email protected]> >> wrote: >>> >>>> This patch includes changes made earlier by David in the >>>> ovs branch to cache the dpdk builds. >>>> >>>> Co-authored-by: David Marchand <[email protected]> >>>> Signed-off-by: David Marchand <[email protected]> >>>> Signed-off-by: Eelco Chaudron <[email protected]> >>>> --- >>>> >>>> v2: Replaced 'sleep 1' with '' after consulting with Dumitru. >>>> v3: No changes >>>> >>>> Note that I ran the full GitHub ci 20x on the v1 patchset. >>>> For v2, I did 10 runs of only the changed/fixed test. For v3, >>>> I only did 1 run. >>>> >>> >>> Hi Eelco, >>> >>> I have one comment down below. >>> >>> >>>> >>>> .ci/ci.sh | 12 ++++++- >>>> .ci/dpdk-build.sh | 54 ++++++++++++++++++++++++++++++ >>>> .ci/dpdk-prepare.sh | 11 ++++++ >>>> .ci/linux-build.sh | 49 ++++++++++++++++++++++++++- >>>> .github/workflows/test.yml | 80 >>>> ++++++++++++++++++++++++++++++++++++++++++++ >>>> Makefile.am | 2 + >>>> tests/system-ovn.at | 2 + >>>> 7 files changed, 207 insertions(+), 3 deletions(-) >>>> create mode 100755 .ci/dpdk-build.sh >>>> create mode 100755 .ci/dpdk-prepare.sh >>>> >>>> diff --git a/.ci/ci.sh b/.ci/ci.sh >>>> index 90942bab6..10f11939c 100755 >>>> --- a/.ci/ci.sh >>>> +++ b/.ci/ci.sh >>>> @@ -16,6 +16,7 @@ >>>> >>>> OVN_PATH=${OVN_PATH:-$PWD} >>>> OVS_PATH=${OVS_PATH:-$OVN_PATH/ovs} >>>> +DPDK_PATH=${DPDK_PATH:-$OVN_PATH/dpdk-dir} >>>> CONTAINER_CMD=${CONTAINER_CMD:-podman} >>>> CONTAINER_WORKSPACE="/workspace" >>>> CONTAINER_WORKDIR="/workspace/ovn-tmp" >>>> @@ -80,6 +81,10 @@ function copy_sources_to_workdir() { >>>> && \ >>>> cp -a $CONTAINER_WORKSPACE/ovs/. $CONTAINER_WORKDIR/ovs \ >>>> && \ >>>> + rm -rf $CONTAINER_WORKDIR/dpdk-dir \ >>>> + && \ >>>> + cp -a $CONTAINER_WORKSPACE/dpdk-dir/. >> $CONTAINER_WORKDIR/dpdk-dir >>>> \ >>>> + && \ >>>> git config --global --add safe.directory $CONTAINER_WORKDIR >>>> " >>>> } >>>> @@ -95,7 +100,7 @@ function run_tests() { >>>> cd $CONTAINER_WORKDIR \ >>>> && \ >>>> ARCH=$ARCH CC=$CC LIBS=$LIBS OPTS=$OPTS TESTSUITE=$TESTSUITE \ >>>> - TEST_RANGE=$TEST_RANGE SANITIZERS=$SANITIZERS \ >>>> + TEST_RANGE=$TEST_RANGE SANITIZERS=$SANITIZERS DPDK=$DPDK \ >>>> ./.ci/linux-build.sh >>>> " >>>> } >>>> @@ -148,12 +153,17 @@ if [ "$ARCH" = "aarch64" ]; then >>>> ASAN_OPTIONS="detect_leaks=0" >>>> fi >>>> >>>> +if [ -z "$DPDK" ]; then >>>> + mkdir -p "$DPDK_PATH" >>>> +fi >>>> + >>>> CONTAINER_ID="$($CONTAINER_CMD run --privileged -d \ >>>> --pids-limit=-1 \ >>>> --env ASAN_OPTIONS=$ASAN_OPTIONS \ >>>> -v /lib/modules/$(uname -r):/lib/modules/$(uname -r):ro \ >>>> -v $OVN_PATH:$CONTAINER_WORKSPACE/ovn:Z \ >>>> -v $OVS_PATH:$CONTAINER_WORKSPACE/ovs:Z \ >>>> + -v $DPDK_PATH:$CONTAINER_WORKSPACE/dpdk-dir:Z \ >>>> $IMAGE_NAME)" >>>> trap remove_container EXIT >>>> >>>> diff --git a/.ci/dpdk-build.sh b/.ci/dpdk-build.sh >>>> new file mode 100755 >>>> index 000000000..f44ac15b0 >>>> --- /dev/null >>>> +++ b/.ci/dpdk-build.sh >>>> @@ -0,0 +1,54 @@ >>>> +#!/bin/bash >>>> + >>>> +set -o errexit >>>> +set -x >>>> + >>>> +function build_dpdk() >>>> +{ >>>> + local VERSION_FILE="dpdk-dir/cached-version" >>>> + local DPDK_VER=$1 >>>> + local DPDK_OPTS="" >>>> + >>>> + rm -rf dpdk-dir >>>> + >>>> + if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then >>>> + git clone --single-branch $DPDK_GIT dpdk-dir -b >>>> "${DPDK_VER##refs/*/}" >>>> + pushd dpdk-dir >>>> + git log -1 --oneline >>>> + else >>>> + wget https://fast.dpdk.org/rel/dpdk-$1.tar.xz >>>> + tar xvf dpdk-$1.tar.xz > /dev/null >>>> + DIR_NAME=$(tar -tf dpdk-$1.tar.xz | head -1 | cut -f1 -d"/") >>>> + mv ${DIR_NAME} dpdk-dir >>>> + pushd dpdk-dir >>>> + fi >>>> + >>>> + # Switching to 'default' machine to make dpdk-dir cache usable on >>>> + # different CPUs. We can't be sure that all CI machines are exactly >>>> same. >>>> + DPDK_OPTS="$DPDK_OPTS -Dmachine=default" >>>> + >>>> + # Disable building DPDK unit tests. Not needed for OVS build or >> tests. >>>> + DPDK_OPTS="$DPDK_OPTS -Dtests=false" >>>> + >>>> + # Disable DPDK developer mode, this results in less build checks >> and >>>> less >>>> + # meson verbose outputs. >>>> + DPDK_OPTS="$DPDK_OPTS -Ddeveloper_mode=disabled" >>>> + >>>> + # OVS compilation and the "ovn-system-dpdk" unit tests (run in the >> CI) >>>> + # only depend on virtio/tap drivers. >>>> + # We can disable all remaining drivers to save compilation time. >>>> + DPDK_OPTS="$DPDK_OPTS -Denable_drivers=net/null,net/tap,net/virtio" >>>> + >>>> + # Install DPDK using prefix. >>>> + DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build" >>>> + >>>> + meson $DPDK_OPTS build >>>> + ninja -C build >>>> + ninja -C build install >>>> + >>>> + echo "Installed DPDK in $(pwd)" >>>> + popd >>>> + echo "${DPDK_VER}" > ${VERSION_FILE} >>>> +} >>>> + >>>> +build_dpdk $DPDK_VER >>>> diff --git a/.ci/dpdk-prepare.sh b/.ci/dpdk-prepare.sh >>>> new file mode 100755 >>>> index 000000000..f7e6215dd >>>> --- /dev/null >>>> +++ b/.ci/dpdk-prepare.sh >>>> @@ -0,0 +1,11 @@ >>>> +#!/bin/bash >>>> + >>>> +set -ev >>>> + >>>> +# Installing wheel separately because it may be needed to build some >>>> +# of the packages during dependency backtracking and pip >= 22.0 will >>>> +# abort backtracking on build failures: >>>> +# https://github.com/pypa/pip/issues/10655 >>>> +pip3 install --disable-pip-version-check --user wheel >>>> +pip3 install --disable-pip-version-check --user pyelftools >>>> +pip3 install --user 'meson==0.53.2' >>>> >>> >>> Do we need this whole dpdk-prepare.sh? We have moved all python >>> dependencies to >>> py-requirements.txt [0]. pyelftools are already there so the only missing >>> package would be meson. >> >> The dpdk cash is built outside of the containers, so we need this. >> > > Hmm that's not very nice, but I don't have a better idea. > > Acked-by: Ales Musil <[email protected]> >
Thanks, Eelco and Ales! I applied this to main. _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
