Skip to content

Commit c54b071

Browse files
committed
xen/cpuhotplug: Fix initial CPU offlining for PV(H) guests
Commit a926f81 ("xen/cpuhotplug: Replace cpu_up/down() with device_online/offline()") replaced cpu_down() with device_offline() call which requires that the CPU has been registered before. This registration, however, happens later from topology_init() which is called as subsys_initcall(). setup_vcpu_hotplug_event(), on the other hand, is invoked earlier, during arch_initcall(). As result, booting a PV(H) guest with vcpus < maxvcpus causes a crash. Move setup_vcpu_hotplug_event() (and therefore setup_cpu_watcher()) to late_initcall(). In addition, instead of performing all offlining steps in setup_cpu_watcher() simply call disable_hotplug_cpu(). Fixes: a926f81 (xen/cpuhotplug: Replace cpu_up/down() with device_online/offline()" Signed-off-by: Boris Ostrovsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent c17db64 commit c54b071

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/xen/cpu_hotplug.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ static int setup_cpu_watcher(struct notifier_block *notifier,
9393
(void)register_xenbus_watch(&cpu_watch);
9494

9595
for_each_possible_cpu(cpu) {
96-
if (vcpu_online(cpu) == 0) {
97-
device_offline(get_cpu_device(cpu));
98-
set_cpu_present(cpu, false);
99-
}
96+
if (vcpu_online(cpu) == 0)
97+
disable_hotplug_cpu(cpu);
10098
}
10199

102100
return NOTIFY_DONE;
@@ -119,5 +117,5 @@ static int __init setup_vcpu_hotplug_event(void)
119117
return 0;
120118
}
121119

122-
arch_initcall(setup_vcpu_hotplug_event);
120+
late_initcall(setup_vcpu_hotplug_event);
123121

0 commit comments

Comments
 (0)