Skip to content

Commit

Permalink
x86/core, x86/xen/smp: Use 'die_complete' completion when taking CPU …
Browse files Browse the repository at this point in the history
…down

Commit 2ed53c0 ("x86/smpboot: Speed up suspend/resume by
avoiding 100ms sleep for CPU offline during S3") introduced
completions to CPU offlining process. These completions are not
initialized on Xen kernels causing a panic in
play_dead_common().

Move handling of die_complete into common routines to make them
available to Xen guests.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Cc: tianyu.lan@intel.com
Cc: konrad.wilk@oracle.com
Cc: xen-devel@lists.xenproject.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1414770572-7950-1-git-send-email-boris.ostrovsky@oracle.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Boris Ostrovsky authored and Ingo Molnar committed Nov 10, 2014
1 parent e602336 commit 5427955
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions arch/x86/include/asm/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
}

void cpu_disable_common(void);
void cpu_die_common(unsigned int cpu);
void native_smp_prepare_boot_cpu(void);
void native_smp_prepare_cpus(unsigned int max_cpus);
void native_smp_cpus_done(unsigned int max_cpus);
Expand Down
15 changes: 11 additions & 4 deletions arch/x86/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1303,10 +1303,14 @@ static void __ref remove_cpu_from_maps(int cpu)
numa_remove_cpu(cpu);
}

static DEFINE_PER_CPU(struct completion, die_complete);

void cpu_disable_common(void)
{
int cpu = smp_processor_id();

init_completion(&per_cpu(die_complete, smp_processor_id()));

remove_siblinginfo(cpu);

/* It's now safe to remove this processor from the online map */
Expand All @@ -1316,8 +1320,6 @@ void cpu_disable_common(void)
fixup_irqs();
}

static DEFINE_PER_CPU(struct completion, die_complete);

int native_cpu_disable(void)
{
int ret;
Expand All @@ -1327,16 +1329,21 @@ int native_cpu_disable(void)
return ret;

clear_local_APIC();
init_completion(&per_cpu(die_complete, smp_processor_id()));
cpu_disable_common();

return 0;
}

void cpu_die_common(unsigned int cpu)
{
wait_for_completion_timeout(&per_cpu(die_complete, cpu), HZ);
}

void native_cpu_die(unsigned int cpu)
{
/* We don't do anything here: idle task is faking death itself. */
wait_for_completion_timeout(&per_cpu(die_complete, cpu), HZ);

cpu_die_common(cpu);

/* They ack this in play_dead() by setting CPU_DEAD */
if (per_cpu(cpu_state, cpu) == CPU_DEAD) {
Expand Down
3 changes: 3 additions & 0 deletions arch/x86/xen/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ static void xen_cpu_die(unsigned int cpu)
current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout(HZ/10);
}

cpu_die_common(cpu);

xen_smp_intr_free(cpu);
xen_uninit_lock_cpu(cpu);
xen_teardown_timer(cpu);
Expand Down

0 comments on commit 5427955

Please sign in to comment.