From 60ba732f2499ad9f452488f515743b577324cd33 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 11 Jun 2024 18:32:53 +0200 Subject: [PATCH] cpu-vm: relax cpu pinning check a bit It was discovered, that current check, while being correct in theory works really bad in practice. Because QEMU sometimes spawns additional temporary threads from an actual vCPU threads which leads to the situation when we have more threads with pinning applied than vCPU number. Let's relax our check a bit and check for "greater than" and not for the equality. Signed-off-by: Alexander Mikhalitsyn --- tests/cpu-vm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cpu-vm b/tests/cpu-vm index f19dc6d93..5ab262120 100755 --- a/tests/cpu-vm +++ b/tests/cpu-vm @@ -85,8 +85,8 @@ if journalctl --quiet --no-hostname --no-pager --boot=0 --unit=snap.lxd.daemon.s # pid 2898's current affinity list: 0-15 # pid 2899's current affinity list: 0-15 # 2894 and 2895 have affinity set, while others don't - PINNED_VCPU_NUM=$(taskset --cpu-list -a -p "${QEMU_PID}" | grep -cE ':\s+[0-9]+$') - [ "${PINNED_VCPU_NUM}" = "$(lxc config get v1 limits.cpu)" ] + PINNED_THREADS_NUM=$(taskset --cpu-list -a -p "${QEMU_PID}" | grep -cE ':\s+[0-9]+$') + [ "${PINNED_THREADS_NUM}" -ge "$(lxc config get v1 limits.cpu)" ] else # check that there is no pinning set ! taskset --cpu-list -a -p "${QEMU_PID}" | grep -E ':\s+[0-9]+$' || false