Skip to content

Commit

Permalink
add iperf3 bench
Browse files Browse the repository at this point in the history
  • Loading branch information
thehajime committed Dec 4, 2024
1 parent 619ac43 commit 517af9d
Show file tree
Hide file tree
Showing 8 changed files with 378 additions and 49 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
FROM alpine:3.20.3

ARG MODE=
ADD vmlinux /root/.
ADD inittab /etc/inittab
RUN mkdir /etc/init.d
ADD rcS /etc/init.d/.
RUN sed "s/\'/\"/g" /etc/profile > /.profile

ADD bench.sh /
ADD iperf3.sh /root/
ADD iperf3.static /root/
ADD do_getpid /root/.
ADD clone /root/.
ADD futex /root/.
Expand All @@ -22,13 +25,13 @@ ADD lmbench2/ /lmbench2
ADD lmbench_run.sh /lmbench2/bin/x86_64-linux-gnulibc1/


RUN apk update && apk add utmps-libs libtirpc curl make
RUN mkdir -p setup && cd setup && curl -L -o output.zip \
RUN apk update && apk add utmps-libs libtirpc curl make iperf3

RUN if [[ ${MODE} == "um-nommu" ]]; then mkdir -p setup && cd setup && curl -L -o output.zip \
'https://gitlab.alpinelinux.org/thehajime/aports/-/jobs/1619053/artifacts/download?file_type=archive' \
&& unzip output.zip
RUN apk add --allow-untrusted \
&& unzip output.zip ; fi
RUN if [[ ${MODE} == "um-nommu" ]]; then apk add --allow-untrusted \
setup/packages/main/x86_64/busybox-nommu-1.36.1-r29.apk \
setup/packages/main/x86_64/musl-nommu-1.2.5-r0.apk
RUN rm -rf setup
setup/packages/main/x86_64/musl-nommu-1.2.5-r0.apk && rm -rf setup; fi

ENTRYPOINT ["/root/vmlinux", "eth0=tuntap,tap100,0e:fd:0:0:0:1,172.17.0.1", "root=/dev/root", "rootflags=/", "rootfstype=hostfs", "rw", "mem=1024m", "loglevel=8", "init=/sbin/init"]
ENTRYPOINT ["/root/vmlinux", "vec0:transport=tap,ifname=tap100,depth=128,gro=1", "root=/dev/root", "rootflags=/", "rootfstype=hostfs", "rw", "mem=1024m", "loglevel=8", "init=/sbin/init"]
96 changes: 66 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
default: true

jobs:
tests:
Expand All @@ -24,12 +24,14 @@ jobs:
runs_on: ubuntu-22.04
shell: bash
defconfig: defconfig
add_configs: CONFIG_UML_NET_VECTOR=y CFLAGS+="-DCONFIG_UML_NET_VECTOR"
testname: um-mmu
- displayTargetName: ubuntu-22.04 (nommu)
os: unix
runs_on: ubuntu-22.04
shell: bash
defconfig: x86_64_nommu_defconfig
add_configs: CONFIG_UML_NET_VECTOR=y CFLAGS+="-DCONFIG_UML_NET_VECTOR"
kunit_opts: --kconfig_add CONFIG_MMU=n
testname: um-nommu
timeout-minutes: 100
Expand All @@ -42,12 +44,16 @@ jobs:
shell: ${{ matrix.shell }}

steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
with:
detached: true
- name: Set env
shell: bash
run: |
echo "/usr/lib/ccache/bin:/usr/lib/ccache:${{ github.workspace }}/bin" >> $GITHUB_PATH
echo "export PATH=/usr/lib/ccache/bin:/usr/lib/ccache:${{ github.workspace }}/bin:$PATH" >> $HOME/.bashrc
- name: Checkout
uses: actions/checkout@v4
- uses: actions/cache@v4
Expand All @@ -58,7 +64,7 @@ jobs:
- name: Install packages
run: |
sudo apt update -y
sudo apt install -y ccache sparse
sudo apt install -y ccache iperf3
- name: Setup latest Alpine Linux
uses: jirutka/setup-alpine@v1
with:
Expand All @@ -79,18 +85,20 @@ jobs:
make -C .github/workflows/
shell: alpine.sh {0}
# --root {0}
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
with:
detached: true
- name: Setup faketty
uses: Yuri6037/Action-FakeTTY@v1.1
- name: setup tap interface
run: |
set -x
sudo ip tuntap add dev tap100 mode tap user ${USER}
sudo ip add add 192.168.122.1/24 dev tap100
sudo ip link set up dev tap100
iperf3 -s &
- name: build-0 (static)
run: |
make ARCH=um ${{ matrix.defconfig }} O=build
cat build/.config | sed "s/.*CONFIG_STATIC_LINK.*/CONFIG_STATIC_LINK=y/" > /tmp/a; mv /tmp/a build/.config
make -j8 ARCH=um O=build
make -j8 ARCH=um O=build ${{ matrix.add_configs }}
- name: prep for docker build
run: |
cp build/vmlinux .github/workflows/
Expand All @@ -99,29 +107,32 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .github/workflows
build-args: "MODE=${{ matrix.testname }}"
push: false
tags: |
ghcr.io/thehajime/alpine:3.20.3-${{ matrix.testname }}
- name: image for test
run: |
container_id=$(docker create ghcr.io/thehajime/alpine:3.20.3-${{ matrix.testname }})
docker start $container_id
docker wait $container_id
docker logs $container_id
docker export $container_id > alpine.tar
docker rm $container_id
docker create --name alpine-nommu ghcr.io/thehajime/alpine:3.20.3-${{ matrix.testname }}
docker start alpine-nommu
docker wait alpine-nommu
docker logs alpine-nommu
docker export alpine-nommu > alpine.tar
docker rm alpine-nommu
mnt=$(mktemp -d)
dd if=/dev/zero of=alpine.ext4 bs=1 count=0 seek=1G
sudo chmod og+wr "alpine.ext4"
yes 2>/dev/null | mkfs.ext4 "alpine.ext4" || true
sudo mount "alpine.ext4" $mnt
sudo tar -xf alpine.tar -C $mnt
sudo umount $mnt
mkdir -p rootfs
sudo tar -xf alpine.tar -C rootfs
sudo chown -R ${USER} rootfs
- name: test-0 (static)
run: |
sudo sh -c "echo 0 > /proc/sys/vm/mmap_min_addr"
sudo ip tuntap add dev tap100 mode tap user ${USER}
faketty ./build/vmlinux eth0=tuntap,tap100,0e:fd:0:0:0:1,172.17.0.1 ubd0=./alpine.ext4 rw mem=1024m loglevel=8 console=tty init=/sbin/init 2>&1 | tee /tmp/log.txt &
faketty ./build/vmlinux vec0:transport=tap,ifname=tap100,depth=128,gro=1 ubd0=./alpine.ext4 rw mem=1024m loglevel=8 console=tty init=/sbin/init 2>&1 | tee /tmp/log.txt &
sleep 10 && pkill vmlinux
echo "========="
cat /tmp/log.txt
Expand All @@ -134,30 +145,45 @@ jobs:
- name: build-1
run: |
make ARCH=um ${{ matrix.defconfig }}
make -j8 ARCH=um
make -j8 ARCH=um ${{ matrix.add_configs }}
- name: test-1
run: |
faketty ./vmlinux eth0=tuntap,tap100,0e:fd:0:0:0:1,172.17.0.1 ubd0=./alpine.ext4 rw mem=1024m loglevel=8 init=/sbin/init 2>&1 | tee /tmp/log.txt &
faketty ./vmlinux vec0:transport=tap,ifname=tap100,depth=128,gro=1 ubd0=./alpine.ext4 rw mem=1024m loglevel=8 init=/sbin/init 2>&1 | tee /tmp/log.txt &
sleep 10 && pkill vmlinux
echo "========="
cat /tmp/log.txt
- name: benchmark-0
if: matrix.testname == 'um-nommu'
run: |
mkdir -p output
faketty ./vmlinux eth0=tuntap,tap100,0e:fd:0:0:0:1,172.17.0.1 ubd0=./alpine.ext4 rw mem=1024m \
loglevel=8 console=tty zpoline=1 init=/bench.sh \
faketty ./vmlinux ubd0=./alpine.ext4 rw mem=1024m loglevel=8 console=tty zpoline=1 init=/bench.sh \
| tee output/${{ matrix.testname }}-zpoline.dat || true # XXX: until 6.12 pulled
faketty ./vmlinux eth0=tuntap,tap100,0e:fd:0:0:0:1,172.17.0.1 ubd0=./alpine.ext4 rw mem=1024m \
loglevel=8 console=tty zpoline=0 init=/bench.sh \
faketty ./vmlinux ubd0=./alpine.ext4 rw mem=1024m loglevel=8 console=tty zpoline=0 init=/bench.sh \
| tee output/${{ matrix.testname }}-seccomp.dat || true # XXX: until 6.12 pulled
- name: benchmark-1
if: matrix.testname == 'um-mmu'
run: |
mkdir -p output
faketty ./vmlinux eth0=tuntap,tap100,0e:fd:0:0:0:1,172.17.0.1 ubd0=./alpine.ext4 rw mem=1024m \
loglevel=0 console=tty init=/bench.sh \
faketty ./vmlinux ubd0=./alpine.ext4 rw mem=1024m loglevel=0 console=tty init=/bench.sh \
| tee output/${{ matrix.testname }}.dat
- name: benchmark-2-iperf3
run: |
mkdir -p output
if [ "${{ matrix.testname }}" == "um-nommu" ] ; then
faketty ./vmlinux vec0:transport=tap,ifname=tap100,depth=128,gro=1 mem=1024m \
root=/dev/root rootflags=`pwd`/rootfs rootfstype=hostfs rw \
loglevel=0 console=tty init=/root/iperf3.sh \
| tee output/${{ matrix.testname }}-seccomp-iperf3.dat
faketty ./vmlinux vec0:transport=tap,ifname=tap100,depth=128,gro=1 mem=1024m \
root=/dev/root rootflags=`pwd`/rootfs rootfstype=hostfs rw \
loglevel=0 console=tty zpoline=1 init=/root/iperf3.sh \
| tee output/${{ matrix.testname }}-zpoline-iperf3.dat
else
faketty ./vmlinux vec0:transport=tap,ifname=tap100,depth=128,gro=1 mem=1024m \
root=/dev/root rootflags=`pwd`/rootfs rootfstype=hostfs rw \
loglevel=0 console=tty init=/root/iperf3.sh \
| tee output/${{ matrix.testname }}-iperf3.dat
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
Expand All @@ -172,13 +198,14 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .github/workflows
build-args: "MODE=${{ matrix.testname }}"
push: true
tags: |
ghcr.io/thehajime/alpine:3.20.3-${{ matrix.testname }}
- uses: actions/upload-artifact@v4
with:
name: bench-result-${{ matrix.testname }}
path: output/${{ matrix.testname }}*.dat
path: output/${{ matrix.testname }}*

checkpatch:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -257,7 +284,7 @@ jobs:
- name: Install packages
run: |
sudo apt update -y
sudo apt install -y gnuplot lmbench
sudo apt install -y gnuplot lmbench iperf3
- name: benchmark-host
run: |
mkdir -p output
Expand All @@ -267,6 +294,9 @@ jobs:
sh .github/workflows/lmbench_run.sh |& tee output/native.dat
gcc -o do_getpid .github/workflows/do_getpid.c
./do_getpid -c 100 | tee -a output/native.dat
iperf3 -s &
iperf3 -c localhost -fm | tee output/native-iperf3.dat
iperf3 -c localhost -fm -R | tee -a output/native-iperf3.dat
- name: bench data parse/out
run: |
export TMP_OUTPUT=$(bash .github/workflows/um-nommu-plot.sh output)
Expand All @@ -280,13 +310,19 @@ jobs:
path: output/out/lmbench.*
- name: publish to imgur
uses: devicons/public-upload-to-imgur@v2.2.2
id: publish-to-imgur
id: lmbench-imgur
with:
path: "output/out/lmbench.png"
client_id: ${{secrets.IMGUR_CLIENT_ID}}
- name: publish to imgur-iperf
uses: devicons/public-upload-to-imgur@v2.2.2
id: iperf3-imgur
with:
path: "output/out/*.png"
path: "output/out/iperf3.png"
client_id: ${{secrets.IMGUR_CLIENT_ID}}
- name: bench data parse/out
run: |
export SCRIPT_OUTPUT="${{ join(fromJSON(steps.publish-to-imgur.outputs.markdown_urls)) }}"
export SCRIPT_OUTPUT="${{ join(fromJSON(steps.lmbench-imgur.outputs.markdown_urls)) }} ${{ join(fromJSON(steps.iperf3-imgur.outputs.markdown_urls)) }}"
echo "SCRIPT_OUTPUT<<EOF" >> $GITHUB_ENV
echo "$TMP_OUTPUT" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
Expand Down
Loading

0 comments on commit 517af9d

Please sign in to comment.