Commit 4c90ccf4c593 ("Correctly apply --vcpu-affinity to the VCPU threads") moved vcpu_affinity_parser() from arm64 to builtin-run.c. There it returns 0 when cpulist_parse() fails, where it returned the error before. So lkvm now ignores a CPU list that it can't parse, such as "foo" or a CPU number of NR_CPUS or more, and runs the guest without the affinity. Return the error again, so that lkvm prints its usage and exits. Fixes: 4c90ccf4c593 ("Correctly apply --vcpu-affinity to the VCPU threads") Assisted-by: Claude:claude-fable-5-2 Signed-off-by: Mika Tammi --- Tested with nixpkgs' kvmtool package at kvmtool master (4b4aceb1dae7) on x86_64 and arm64 hosts. With "foo", "3-2", "2-" or a CPU number of NR_CPUS or more, master runs the guest with the VCPU threads on every CPU. With this patch, lkvm prints its usage and exits with status 129. A list that can be parsed, such as 2-3, sets the affinity as before. This doesn't depend on "Set the VCPU affinity with sched_setaffinity() (for musl compatibility)" [1]: it applies with or without that series. With both, a static musl lkvm gives the same results on x86_64, and still boots a guest with --vcpu-affinity 0 on QEMU rv32 and rv64 KVM hosts. [1] https://lore.kernel.org/kvm/20261130220543.70217-1-mikatammi@gmail.com/ builtin-run.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin-run.c b/builtin-run.c index f06231e..df54619 100644 --- a/builtin-run.c +++ b/builtin-run.c @@ -197,7 +197,7 @@ static int vcpu_affinity_parser(const struct option *opt, const char *arg, int u out_free: free(cpumask); - return 0; + return ret; } #ifndef OPT_ARCH_RUN -- 2.54.0 (Apple Git-157)