From: Dario Faggioli Date: Fri, 12 Jun 2015 10:06:24 +0000 (+0200) Subject: cpupool: fix shutdown with cpupools with different schedulers X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3100 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=98c51d0c7eb188745f564813443adcb5fd5db00b;p=xen.git cpupool: fix shutdown with cpupools with different schedulers trying to shutdown the host when a cpupool exists, has pCPUs, and has a scheduler different than the Xen's default one, produces this: root@Zhaman:~# xl cpupool-cpu-remove Pool-0 8 root@Zhaman:~# xl cpupool-create name=\"Pool-1\" sched=\"credit2\" Using config file "command line" cpupool name: Pool-1 scheduler: credit2 number of cpus: 0 root@Zhaman:~# xl cpupool-cpu-add Pool-1 8 root@Zhaman:~# shutdown -h now (XEN) ----[ Xen-4.6-unstable x86_64 debug=y Not tainted ]---- (XEN) CPU: 0 (XEN) RIP: e008:[] kill_timer+0x56/0x298 (XEN) RFLAGS: 0000000000010002 CONTEXT: hypervisor ... ... ... (XEN) Xen call trace: (XEN) [] kill_timer+0x56/0x298 (XEN) [] csched_free_pdata+0x9b/0xcf (XEN) [] cpu_schedule_callback+0x64/0x8b (XEN) [] notifier_call_chain+0x67/0x87 (XEN) [] cpu_down+0xd9/0x12c (XEN) [] disable_nonboot_cpus+0x93/0x138 (XEN) [] enter_state_helper+0xbd/0x365 (XEN) [] continue_hypercall_tasklet_handler+0x4a/0xb1 (XEN) [] do_tasklet_work+0x78/0xab (XEN) [] do_tasklet+0x5e/0x8a (XEN) [] idle_loop+0x56/0x6b ... ... ... (XEN) **************************************** (XEN) Panic on CPU 0: (XEN) FATAL PAGE FAULT (XEN) [error_code=0000] (XEN) Faulting linear address: 0000000000000041 (XEN) **************************************** The fix is, when tearing down a pCPU, call the free_pdata() hook from the scheduler of the cpupool the pCPU belongs to, not always the one from the default scheduler. Signed-off-by: Dario Faggioli Reviewed-by: Juergen Gross Acked-by: George Dunlap --- diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 6b02f9815a..3325ccdd27 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1303,9 +1303,10 @@ static int cpu_schedule_up(unsigned int cpu) static void cpu_schedule_down(unsigned int cpu) { struct schedule_data *sd = &per_cpu(schedule_data, cpu); + struct scheduler *sched = per_cpu(scheduler, cpu); if ( sd->sched_priv != NULL ) - SCHED_OP(&ops, free_pdata, sd->sched_priv, cpu); + SCHED_OP(sched, free_pdata, sd->sched_priv, cpu); kill_timer(&sd->s_timer); }