[PATCH 2/2] xen/sched: fix schedule_dump() handling of free cpus

Juergen Gross <[email protected]> Wed, 29 Jul 2026 14:06:43 +0200
Newsgroups gmane.comp.emulators.xen.devel
Message-ID <[email protected]>
With the introduction of core scheduling cpus not used by any cpupool
have been switched to use the very simple idle scheduler instead of the
default scheduler.

Trying to obtain diagnostic scheduling data via the "r" debug key is
scanning through all cpupools using the per-cpupool scheduler to print
the related data. Unfortunately the switch to use the idle scheduler
for free cpus wasn't reflected in schedule_dump(), causing the default
scheduler's dump_cpu_state callback to be used for free cpus.

This causes NULL dereferences in case the default scheduler is one of
credit or null.

Fix that by using the idle scheduler instead of the default scheduler
for free cpus. Note that it is fine for a scheduler to have no
dump_cpu_state callback.

Fixes: f855dd962523 ("sched: add minimalistic idle scheduler for free cpus")
Reported-by: Dietmar Hahn <[email protected]>
Tested-by:  Dietmar Hahn <[email protected]>
Signed-off-by: Juergen Gross <[email protected]>
---
 xen/common/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 55b71301cf..9ccf5811bf 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -3452,7 +3452,7 @@ void schedule_dump(struct cpupool *c)
     }
     else
     {
-        sched = &operations;
+        sched = &sched_idle_ops;
         cpus = &cpupool_free_cpus;
     }
 
-- 
2.55.0