From 3fcb8dff985012666a56891683f5b615a89e63f4 Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Wed, 7 Oct 2026 13:24:50 -0600 Subject: [PATCH] fix: enforce Pimox KVM big-core pinning --- lib/jeannie/pipeline.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/jeannie/pipeline.sh b/lib/jeannie/pipeline.sh index 32f1566..427d1a9 100644 --- a/lib/jeannie/pipeline.sh +++ b/lib/jeannie/pipeline.sh @@ -2227,9 +2227,24 @@ rm -f '${remote_tmp}'" for entry in ${cpu_map}; do vmid="${entry%%=*}" + cpuset="${entry#*=}" pimox_ssh "${host}" "${user}" "${key_path}" "set -eu if sudo '${qm_bin}' status '${vmid}' >/dev/null 2>&1; then sudo '${qm_bin}' set '${vmid}' --hookscript '${script_ref}' + if sudo '${qm_bin}' status '${vmid}' | grep -q 'status: running'; then + if ! command -v taskset >/dev/null 2>&1; then + echo 'taskset is required to enforce Pimox KVM CPU pinning for running VM ${vmid}' >&2 + exit 1 + fi + pid_file='/var/run/qemu-server/${vmid}.pid' + if ! sudo test -r \"\$pid_file\"; then + echo 'Pimox VM ${vmid} is running but its QEMU pid file is missing; cannot enforce CPU pinning.' >&2 + exit 1 + fi + pid=\"\$(sudo cat \"\$pid_file\")\" + echo 'Applying Pimox KVM CPU affinity ${cpuset} to running VM ${vmid} pid' \"\$pid\" + sudo taskset -a -cp '${cpuset}' \"\$pid\" >/dev/null + fi fi" done } @@ -3493,6 +3508,7 @@ run_pimox_pipeline() { fi if [[ -n "${pin_cpu_map// /}" ]]; then pin_hookscript_ref="${pin_hookscript_storage}:snippets/${pin_hookscript_name}" + echo "Pimox K8s VM CPU pin map: ${pin_cpu_map}" fi fi if ! [[ "${timeout_seconds}" =~ ^[0-9]+$ && "${timeout_seconds}" -gt 0 ]]; then