8000 Multicore support for echo server by Courtney3141 · Pull Request #255 · au-ts/sddf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Multicore support for echo server #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions benchmark/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void notified(microkit_channel ch)
{
if (ch == serial_config.tx.id) {
return;
} else if (ch == benchmark_config.start_ch) {
} else if (ch == benchmark_config.rx_start_ch) {
#if defined(MICROKIT_CONFIG_benchmark) && defined(CONFIG_ARCH_ARM)
sel4bench_reset_counters();
THREAD_MEMORY_RELEASE();
Expand All @@ -162,12 +162,15 @@ void notified(microkit_channel ch)
seL4_BenchmarkResetLog();
#endif
#endif
} else if (ch == benchmark_config.stop_ch) {
if (!benchmark_config.last_core) {
microkit_notify(benchmark_config.tx_start_ch);
}
} else if (ch == benchmark_config.rx_stop_ch) {
#if defined(MICROKIT_CONFIG_benchmark) && defined(CONFIG_ARCH_ARM)
sel4bench_get_counters(benchmark_bf, &counter_values[0]);
sel4bench_stop_counters(benchmark_bf);

sddf_printf("{\n");
sddf_printf("{CORE %u: \n", benchmark_config.core);
for (int i = 0; i < ARRAY_SIZE(benchmarking_events); i++) {
sddf_printf("%s: %lu\n", counter_names[i], counter_values[i]);
}
Expand All @@ -183,6 +186,9 @@ void notified(microkit_channel ch)
sddf_printf("KernelEntries: %lu\n", entries);
dump_log_summary(entries);
#endif
if (!benchmark_config.last_core) {
microkit_notify(benchmark_config.tx_stop_ch);
}
} else {
sddf_printf("BENCH|LOG: Bench thread notified on unexpected channel %u\n", ch);
}
Expand Down
3 changes: 2 additions & 1 deletion examples/echo_server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ BUILD_DIR ?= build
export SDDF=$(abspath ../..)
export BUILD_DIR:=$(abspath ${BUILD_DIR})
export override MICROKIT_SDK:=$(abspath ${MICROKIT_SDK})
override SMP_CONFIG:=$(abspath ${SMP_CONFIG})

IMAGE_FILE := $(BUILD_DIR)/loader.img
REPORT_FILE := $(BUILD_DIR)/report.txt
Expand All @@ -25,7 +26,7 @@ export ECHO_INCLUDE:=$(abspath .)/include
all: ${IMAGE_FILE}

qemu ${IMAGE_FILE} ${REPORT_FILE} clean clobber: ${BUILD_DIR}/Makefile FORCE
${MAKE} -C ${BUILD_DIR} MICROKIT_SDK=${MICROKIT_SDK} $(notdir $@)
${MAKE} -C ${BUILD_DIR} MICROKIT_SDK=${MICROKIT_SDK} SMP_CONFIG=${SMP_CONFIG} $(notdir $@)

${BUILD_DIR}/Makefile: echo.mk
mkdir -p ${BUILD_DIR}
Expand Down
12 changes: 12 additions & 0 deletions examples/echo_server/core_config/four_core.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"timer_driver": 0,
"serial_driver": 0,
"serial_virt_tx": 0,
"ethernet_driver": 1,
"net_virt_tx": 1,
"net_virt_rx": 0,
"client0": 2,
"client0_net_copier": 2,
"client1": 3,
"client1_net_copier": 3
}
12 changes: 12 additions & 0 deletions examples/echo_server/core_config/single_core.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"timer_driver": 0,
"serial_driver": 0,
"serial_virt_tx": 0,
"ethernet_driver": 0,
"net_virt_tx": 0,
"net_virt_rx": 0,
"client0": 0,
"client0_net_copier": 0,
"client1": 0,
"client1_net_copier": 0
}
12 changes: 12 additions & 0 deletions examples/echo_server/core_config/two_core.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"timer_driver": 0,
"serial_driver": 0,
"serial_virt_tx": 0,
"ethernet_driver": 1,
"net_virt_tx": 1,
"net_virt_rx": 0,
"client0": 0,
"client0_net_copier": 0,
"client1": 0,
"client1_net_copier": 0
}
2 changes: 1 addition & 1 deletion examples/echo_server/echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void init(void)
set_timeout();

setup_udp_socket();
setup_utilization_socket(benchmark_config.cycle_counters, benchmark_config.start_ch, benchmark_config.stop_ch);
setup_utilization_socket(&benchmark_config);
setup_tcp_socket();

sddf_lwip_maybe_notify();
Expand Down
2 changes: 1 addition & 1 deletion examples/echo_server/echo.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
#define TCP_ECHO_PORT 1237

int setup_udp_socket(void);
int setup_utilization_socket(void *cycle_counters, sddf_channel start_ch, sddf_channel stop_ch);
int setup_utilization_socket(void *benchmark_config);
int setup_tcp_socket(void);
33 changes: 19 additions & 14 deletions examples/echo_server/echo.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@ MICROKIT_CONFIG ?= debug
IMAGE_FILE = loader.img
REPORT_FILE = report.txt

BOARD_DIR := $(MICROKIT_SDK)/board/$(MICROKIT_BOARD)/$(MICROKIT_CONFIG)
ifneq ($(strip $(SMP_CONFIG)),)
ifneq ($(filter $(strip $(MICROKIT_BOARD)),imx8mp_evk imx8mq_evk odroidc2 qemu_virt_aarch64),)
$(error MICROKIT_BOARD does not support SMP)
endif
ifeq ($(wildcard $(SMP_CONFIG)),)
$(error Must specify a valid core configuration file)
endif
export MICROKIT_BOARD_SMP := $(addsuffix _4_cores,$(strip $(MICROKIT_BOARD)))
export SMP_ARG := --smp $(abspath $(SMP_CONFIG))
else
export MICROKIT_BOARD_SMP := $(strip $(MICROKIT_BOARD))
endif

BOARD_DIR := $(MICROKIT_SDK)/board/$(MICROKIT_BOARD_SMP)/$(MICROKIT_CONFIG)
ARCH := ${shell grep 'CONFIG_SEL4_ARCH ' $(BOARD_DIR)/include/kernel/gen_config.h | cut -d' ' -f4}
# Toolchain triples have inconsistent naming, below tries to automatically resolve that
ifeq ($(strip $(TOOLCHAIN)),)
Expand Down Expand Up @@ -105,9 +118,8 @@ DTB := $(MICROKIT_BOARD).dtb

vpath %.c ${SDDF} ${ECHO_SERVER}

IMAGES := eth_driver.elf echo0.elf echo1.elf benchmark.elf idle.elf network_virt_rx.elf\
network_virt_tx.elf network_copy.elf network_copy0.elf network_copy1.elf timer_driver.elf\
serial_driver.elf serial_virt_tx.elf
IMAGES := eth_driver.elf echo.elf benchmark.elf idle.elf network_virt_rx.elf\
network_virt_tx.elf network_copy.elf timer_driver.elf serial_driver.elf serial_virt_tx.elf

ifeq ($(ARCH),aarch64)
CFLAGS_ARCH := -mcpu=$(CPU) -mstrict-align
Expand Down Expand Up @@ -163,12 +175,9 @@ DEPS := $(ECHO_OBJS:.o=.d)

all: loader.img

echo0.elf echo1.elf: $(ECHO_OBJS) libsddf_util.a lib_sddf_lwip_echo.a
echo.elf: $(ECHO_OBJS) libsddf_util.a lib_sddf_lwip_echo.a
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@

network_copy0.elf network_copy1.elf: network_copy.elf
cp $< $@

# Need to build libsddf_util_debug.a because it's included in LIBS
# for the unimplemented libc dependencies
${IMAGES}: libsddf_util_debug.a ${CHECK_FLAGS_BOARD_MD5}
Expand All @@ -177,7 +186,7 @@ $(DTB): $(DTS)
dtc -q -I dts -O dtb $(DTS) > $(DTB)

$(SYSTEM_FILE): $(METAPROGRAM) $(IMAGES) $(DTB)
$(PYTHON) $(METAPROGRAM) --sddf $(SDDF) --board $(MICROKIT_BOARD) --dtb $(DTB) --output . --sdf $(SYSTEM_FILE)
$(PYTHON) $(METAPROGRAM) --sddf $(SDDF) --board $(MICROKIT_BOARD) --dtb $(DTB) --output . --sdf $(SYSTEM_FILE) --objcopy $(OBJCOPY) $(SMP_ARG)
$(OBJCOPY) --update-section .device_resources=serial_driver_device_resources.data serial_driver.elf
$(OBJCOPY) --update-section .serial_driver_config=serial_driver_config.data serial_driver.elf
$(OBJCOPY) --update-section .serial_virt_tx_config=serial_virt_tx.data serial_virt_tx.elf
Expand All @@ -194,15 +203,11 @@ $(SYSTEM_FILE): $(METAPROGRAM) $(IMAGES) $(DTB)
$(OBJCOPY) --update-section .timer_client_config=timer_client_client1.data echo1.elf
$(OBJCOPY) --update-section .net_client_config=net_client_client1.data echo1.elf
$(OBJCOPY) --update-section .serial_client_config=serial_client_client1.data echo1.elf
$(OBJCOPY) --update-section .serial_client_config=serial_client_bench.data benchmark.elf
$(OBJCOPY) --update-section .benchmark_config=benchmark_config.data benchmark.elf
$(OBJCOPY) --update-section .benchmark_client_config=benchmark_client_config.data echo0.elf
$(OBJCOPY) --update-section .benchmark_config=benchmark_idle_config.data idle.elf
$(OBJCOPY) --update-section .lib_sddf_lwip_config=lib_sddf_lwip_config_client0.data echo0.elf
$(OBJCOPY) --update-section .lib_sddf_lwip_config=lib_sddf_lwip_config_client1.data echo1.elf

${IMAGE_FILE} $(REPORT_FILE): $(IMAGES) $(SYSTEM_FILE)
$(MICROKIT_TOOL) $(SYSTEM_FILE) --search-path $(BUILD_DIR) --board $(MICROKIT_BOARD) --config $(MICROKIT_CONFIG) -o $(IMAGE_FILE) -r $(REPORT_FILE)
$(MICROKIT_TOOL) $(SYSTEM_FILE) --search-path $(BUILD_DIR) --board $(MICROKIT_BOARD_SMP) --config $(MICROKIT_CONFIG) -o $(IMAGE_FILE) -r $(REPORT_FILE)


include ${SDDF}/util/util.mk
Expand Down
Loading
Loading
0