On 01.12.23 21:12, Andrew Cooper wrote:
On 01/12/2023 7:59 pm, René Winther Højgaard wrote:If I set smt=off and try to configure cpupools with credit(1) as if all cores are available, I get the following crash.The crash happens when I try to use xl cpupool-add-cpu on the disabled HT sibling cores. Hyper-threading is enabled in the firmware, and only disabled with smt=off.CC'ing some maintainers.
Attached patch should fix the crash. René, are you fine with the "Reported-by:" tag being added to the patch? I'll send a proper patch mail when having heard from you. Juergen
From 65c70cc53df3a71225b11cb95848f12f5a565d5d Mon Sep 17 00:00:00 2001 From: Juergen Gross <[email protected]> Date: Mon, 4 Dec 2023 08:00:21 +0100 Subject: [PATCH] xen/sched: fix adding offline cpu to cpupool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trying to add an offline cpu to a cpupool can crash the hypervisor, as the probably non-existing percpu area of the cpu is accessed before the availability of the cpu is being tested. Fix that by testing the cpu to be online. Fixes: cb563d7665f2 ("xen/sched: support core scheduling for moving cpus to/from cpupools") Reported-by: René Winther Højgaard <[email protected]> Signed-off-by: Juergen Gross <[email protected]> --- xen/common/sched/cpupool.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c index 2e094b0cfa..ad8f608462 100644 --- a/xen/common/sched/cpupool.c +++ b/xen/common/sched/cpupool.c @@ -892,6 +892,8 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op) if ( cpu >= nr_cpu_ids ) goto addcpu_out; ret = -ENODEV; + if ( !cpu_online(cpu) ) + goto addcpu_out; cpus = sched_get_opt_cpumask(c->gran, cpu); if ( !cpumask_subset(cpus, &cpupool_free_cpus) || cpumask_intersects(cpus, &cpupool_locked_cpus) ) -- 2.35.3
OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature
