Add several lmbench network benchmark

This commit is contained in:
jiangjianfeng
2024-12-20 07:06:38 +00:00
committed by Tate, Hongliang Tian
parent 3e47ed10fd
commit 3dbdef4d6c
15 changed files with 210 additions and 10 deletions

View File

@ -59,16 +59,21 @@ jobs:
- fio/ext2_seq_read_bw
- fio/ext2_seq_write_bw_no_iommu
- fio/ext2_seq_read_bw_no_iommu
# Network-related benchmarks
# Loopback-related network benchmarks
- lmbench/tcp_loopback_bw_128
- lmbench/tcp_loopback_bw_4k
- lmbench/tcp_loopback_bw_64k
- lmbench/tcp_loopback_lat
- lmbench/tcp_loopback_connect_lat
- lmbench/tcp_loopback_select_lat
- lmbench/tcp_loopback_http_bw
- lmbench/tcp_virtio_bw_64k
- lmbench/tcp_virtio_lat
- lmbench/udp_loopback_lat
# VirtIO-net-related network benchmarks
- lmbench/tcp_virtio_bw_128
- lmbench/tcp_virtio_bw_64k
- lmbench/tcp_virtio_connect_lat
- lmbench/tcp_virtio_lat
- lmbench/udp_virtio_lat
- iperf3/tcp_virtio_bw
# Scheduler-related benchmarks
- hackbench/group8_smp1

View File

@ -129,7 +129,6 @@ pub(crate) unsafe fn init_on_ap() {
pub(crate) fn interrupts_ack(irq_number: usize) {
if !cpu::CpuException::is_cpu_exception(irq_number as u16) {
kernel::pic::ack();
kernel::apic::with_borrow(|apic| {
apic.eoi();
});

View File

@ -11,7 +11,10 @@ use core::fmt::Write;
use log::debug;
use spin::Once;
use super::{device::serial::SerialPort, kernel::IO_APIC};
use super::{
device::serial::SerialPort,
kernel::{self, IO_APIC},
};
use crate::{
sync::SpinLock,
trap::{IrqLine, TrapFrame},
@ -63,15 +66,21 @@ pub(crate) fn init() {
}
pub(crate) fn callback_init() {
let mut irq = if !IO_APIC.is_completed() {
crate::arch::x86::kernel::pic::allocate_irq(4).unwrap()
let irq = if !IO_APIC.is_completed() {
let mut irq = crate::arch::x86::kernel::pic::allocate_irq(4).unwrap();
irq.on_active(|trapframe: &TrapFrame| {
handle_serial_input(trapframe);
kernel::pic::ack();
});
irq
} else {
let irq = IrqLine::alloc().unwrap();
let mut irq = IrqLine::alloc().unwrap();
let mut io_apic = IO_APIC.get().unwrap().first().unwrap().lock();
io_apic.enable(4, irq.clone()).unwrap();
irq.on_active(handle_serial_input);
irq
};
irq.on_active(handle_serial_input);
CONSOLE_IRQ_CALLBACK.call_once(|| SpinLock::new(irq));
}

View File

@ -28,13 +28,18 @@
"ramfs_create_delete_files_0k_ops",
"ramfs_create_delete_files_10k_ops",
"ext2_copy_files_bw",
"tcp_loopback_bw_128",
"tcp_loopback_bw_4k",
"tcp_loopback_bw_64k",
"tcp_loopback_lat",
"tcp_loopback_connect_lat",
"tcp_loopback_select_lat",
"tcp_loopback_http_bw",
"udp_loopback_lat",
"tcp_virtio_bw_128",
"tcp_virtio_bw_64k",
"udp_loopback_lat"
"tcp_virtio_connect_lat",
"tcp_virtio_lat",
"udp_virtio_lat"
]
}

View File

@ -0,0 +1,16 @@
{
"alert": {
"threshold": "125%",
"bigger_is_better": true
},
"result_extraction": {
"search_pattern": "0.000128 +[0-9.]+",
"result_index": 2
},
"chart": {
"title": "[TCP sockets] The bandwidth (localhost, 128B message)",
"description": "bw_tcp -l",
"unit": "MB/s",
"legend": "Average TCP bandwidth on {system}"
}
}

View File

@ -0,0 +1,11 @@
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
set -e
echo "*** Running lmbench TCP bandwidth test ***"
/benchmark/bin/lmbench/bw_tcp -s 127.0.0.1 -b 1
/benchmark/bin/lmbench/bw_tcp -m 128 -P 1 127.0.0.1
/benchmark/bin/lmbench/bw_tcp -S 127.0.0.1

View File

@ -0,0 +1,16 @@
{
"alert": {
"threshold": "125%",
"bigger_is_better": true
},
"result_extraction": {
"search_pattern": "0.000128 +[0-9.]+ +MB",
"result_index": 2
},
"chart": {
"title": "[TCP sockets] The bandwidth (virtio-net, 128B message)",
"description": "bw_tcp -l",
"unit": "MB/sec",
"legend": "Average TCP bandwidth on {system}"
}
}

View File

@ -0,0 +1,22 @@
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
set -e
# Function to stop the guest VM
stop_guest() {
echo "Stopping guest VM..."
# `-r` means if there's no qemu, the kill won't be executed
pgrep qemu | xargs -r kill
}
# Trap EXIT signal to ensure guest VM is stopped on script exit
trap stop_guest EXIT
# Run lmbench tcp client
echo "Running lmbench tcp client connected to $GUEST_SERVER_IP_ADDRESS"
# The -W parameter of bw_tcp refers to the number of bytes transferred during the warm-up phase.
/usr/local/benchmark/lmbench/bw_tcp -m 128 -P 1 -W 50000000 -N 100 $GUEST_SERVER_IP_ADDRESS
# The trap will automatically stop the guest VM when the script exits

View File

@ -0,0 +1,13 @@
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
set -e
echo "Running lmbench TCP latency over virtio-net..."
# Start the server
/benchmark/bin/lmbench/bw_tcp -s 10.0.2.15 -b 1
# Sleep for a long time to ensure VM won't exit
sleep 200

View File

@ -0,0 +1,16 @@
{
"alert": {
"threshold": "125%",
"bigger_is_better": false
},
"result_extraction": {
"search_pattern": "TCP\\/IP connection cost to [0-9.]+: +[0-9.]+",
"result_index": 6
},
"chart": {
"title": "[TCP sockets] The latency of connect",
"description": "lat_connect",
"unit": "\u00b5s",
"legend": "Average TCP connection latency on {system}"
}
}

View File

@ -0,0 +1,21 @@
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
set -e
# Function to stop the guest VM
stop_guest() {
echo "Stopping guest VM..."
# `-r` means if there's no qemu, the kill won't be executed
pgrep qemu | xargs -r kill
}
# Trap EXIT signal to ensure guest VM is stopped on script exit
trap stop_guest EXIT
# Run lmbench tcp client
echo "Running lmbench tcp client connected to $GUEST_SERVER_IP_ADDRESS"
/usr/local/benchmark/lmbench/lat_connect $GUEST_SERVER_IP_ADDRESS
# The trap will automatically stop the guest VM when the script exits

View File

@ -0,0 +1,13 @@
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
set -e
echo "Running lmbench TCP latency over virtio-net..."
# Start the server
benchmark/bin/lmbench/lat_connect -s 10.0.2.15 -b 1000
# Sleep for a long time to ensure VM won't exit
sleep 200

View File

@ -0,0 +1,16 @@
{
"alert": {
"threshold": "125%",
"bigger_is_better": false
},
"result_extraction": {
"search_pattern": "UDP latency using [0-9.]+: +[0-9.]+",
"result_index": 5
},
"chart": {
"title": "[UDP sockets] The latency of write+read (virtio-net)",
"description": "lat_udp",
"unit": "\u00b5s",
"legend": "Average UDP latency over virtio-net on {system}"
}
}

View File

@ -0,0 +1,25 @@
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
set -e
# Function to stop the guest VM
stop_guest() {
echo "Stopping guest VM..."
# `-r` means if there's no qemu, the kill won't be executed
pgrep qemu | xargs -r kill
}
# Trap EXIT signal to ensure guest VM is stopped on script exit
trap stop_guest EXIT
# Warm up: We intentionally run another test for warmup here.
# Note that we can't use -W option for warmup here because it will fail due to receiving timeout.
echo "Warm up......"
/usr/local/benchmark/lmbench/lat_udp -P 1 -N 10 $GUEST_SERVER_IP_ADDRESS >/dev/null 2>&1
# Run lmbench udp client
echo "Running lmbench udp client connected to $GUEST_SERVER_IP_ADDRESS"
/usr/local/benchmark/lmbench/lat_udp -P 1 -N 10 $GUEST_SERVER_IP_ADDRESS
# The trap will automatically stop the guest VM when the script exits

View File

@ -0,0 +1,13 @@
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
set -e
echo "Running lmbench UDP latency over virtio-net..."
# Start the server
/benchmark/bin/lmbench/lat_udp -s 10.0.2.15
# Sleep for a long time to ensure VM won't exit
sleep 200