Skip to content

Commit aa1c84e

Browse files
vittyvkjgross1
authored andcommitted
x86/xen: split xen_cpu_die()
Split xen_cpu_die() into xen_pv_cpu_die() and xen_hvm_cpu_die() to support further splitting of smp.c. Signed-off-by: Vitaly Kuznetsov <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent a2d1078 commit aa1c84e

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

arch/x86/xen/smp.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,10 @@ static int xen_cpu_disable(void)
514514
return 0;
515515
}
516516

517-
static void xen_cpu_die(unsigned int cpu)
517+
static void xen_pv_cpu_die(unsigned int cpu)
518518
{
519-
while (xen_pv_domain() && HYPERVISOR_vcpu_op(VCPUOP_is_up,
520-
xen_vcpu_nr(cpu), NULL)) {
519+
while (HYPERVISOR_vcpu_op(VCPUOP_is_up,
520+
xen_vcpu_nr(cpu), NULL)) {
521521
__set_current_state(TASK_UNINTERRUPTIBLE);
522522
schedule_timeout(HZ/10);
523523
}
@@ -530,6 +530,15 @@ static void xen_cpu_die(unsigned int cpu)
530530
}
531531
}
532532

533+
static void xen_hvm_cpu_die(unsigned int cpu)
534+
{
535+
if (common_cpu_die(cpu) == 0) {
536+
xen_smp_intr_free(cpu);
537+
xen_uninit_lock_cpu(cpu);
538+
xen_teardown_timer(cpu);
539+
}
540+
}
541+
533542
static void xen_play_dead(void) /* used only with HOTPLUG_CPU */
534543
{
535544
play_dead_common();
@@ -552,7 +561,12 @@ static int xen_cpu_disable(void)
552561
return -ENOSYS;
553562
}
554563

555-
static void xen_cpu_die(unsigned int cpu)
564+
static void xen_pv_cpu_die(unsigned int cpu)
565+
{
566+
BUG();
567+
}
568+
569+
static void xen_hvm_cpu_die(unsigned int cpu)
556570
{
557571
BUG();
558572
}
@@ -733,7 +747,7 @@ static const struct smp_ops xen_smp_ops __initconst = {
733747
.smp_cpus_done = xen_smp_cpus_done,
734748

735749
.cpu_up = xen_cpu_up,
736-
.cpu_die = xen_cpu_die,
750+
.cpu_die = xen_pv_cpu_die,
737751
.cpu_disable = xen_cpu_disable,
738752
.play_dead = xen_play_dead,
739753

@@ -762,7 +776,7 @@ void __init xen_hvm_smp_init(void)
762776
{
763777
smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
764778
smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
765-
smp_ops.cpu_die = xen_cpu_die;
779+
smp_ops.cpu_die = xen_hvm_cpu_die;
766780
smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi;
767781
smp_ops.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi;
768782
smp_ops.smp_prepare_boot_cpu = xen_hvm_smp_prepare_boot_cpu;

0 commit comments

Comments
 (0)