From b862a76ba15801220f42d75016b89261b8a6d437 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 2 Jun 2024 19:38:14 +0200 Subject: [PATCH] feat: CPU pinning for Rockchip Orange Pi 5 (#98) --- readme.md | 2 +- src/entry.sh | 6 +++++- src/proc.sh | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 4831f2d..2a2a08d 100644 --- a/readme.md +++ b/readme.md @@ -108,7 +108,7 @@ kubectl apply -f kubernetes.yml * ### How do I boot without SCSI drivers? - By default, the machine makes use of `virtio-scsi` drives for performance reasons, and even though most Linux kernels bundle the necessary driver for this device, that may not always be the case for some other operating systems. + By default, the machine makes use of `virtio-scsi` drives for performance reasons, and even though most Linux kernels bundle the necessary driver for this device, that may not always be the case for other operating systems. If your machine fails to detect the hard drive, you can modify your compose file to use `virtio-blk` instead: diff --git a/src/entry.sh b/src/entry.sh index a62b2f5..836c49a 100755 --- a/src/entry.sh +++ b/src/entry.sh @@ -19,4 +19,8 @@ trap - ERR info "Booting image${BOOT_DESC}..." -exec qemu-system-aarch64 ${ARGS:+ $ARGS} +if [ -z "$CPU_PIN" ]; then + exec qemu-system-aarch64 ${ARGS:+ $ARGS} +else + taskset -c "$CPU_TASK_SET" exec qemu-system-aarch64 ${ARGS:+ $ARGS} +fi diff --git a/src/proc.sh b/src/proc.sh index f870b9d..0b922fd 100644 --- a/src/proc.sh +++ b/src/proc.sh @@ -4,10 +4,16 @@ set -Eeuo pipefail # Docker environment variables : "${KVM:="Y"}" +: "${CPU_PIN:=""}" : "${CPU_FLAGS:=""}" : "${CPU_MODEL:=""}" : "${DEF_MODEL:="neoverse-n1"}" +if [[ "$CPU" == "Cortex A55" ]] || [[ "${SYS,,}" == *"-rk35xx" ]]; then + # Pin to big cores on Rockchip Orange Pi 5 + CPU_PIN="4,5,6,7" +fi + if [[ "${ARCH,,}" != "arm64" ]]; then KVM="N" warn "your CPU architecture is ${ARCH^^} and cannot provide KVM acceleration for ARM64 instructions, this will cause a major loss of performance."