Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 218479
b: refs/heads/master
c: 76fac07
h: refs/heads/master
i:
  218477: 3fe0e57
  218475: f11c27a
  218471: ca668a2
  218463: d499e6d
v: v3
  • Loading branch information
Alok Kataria authored and H. Peter Anvin committed Oct 21, 2010
1 parent 3e99566 commit ffb5933
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 03f1a17cd5c69deccd3cfe1b954b9426d7a686e3
refs/heads/master: 76fac077db6b34e2c6383a7b4f3f4f7b7d06d8ce
9 changes: 7 additions & 2 deletions trunk/arch/x86/include/asm/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct smp_ops {
void (*smp_prepare_cpus)(unsigned max_cpus);
void (*smp_cpus_done)(unsigned max_cpus);

void (*smp_send_stop)(void);
void (*stop_other_cpus)(int wait);
void (*smp_send_reschedule)(int cpu);

int (*cpu_up)(unsigned cpu);
Expand All @@ -73,7 +73,12 @@ extern struct smp_ops smp_ops;

static inline void smp_send_stop(void)
{
smp_ops.smp_send_stop();
smp_ops.stop_other_cpus(0);
}

static inline void stop_other_cpus(void)
{
smp_ops.stop_other_cpus(1);
}

static inline void smp_prepare_boot_cpu(void)
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/kernel/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ void native_machine_shutdown(void)
/* O.K Now that I'm on the appropriate processor,
* stop all of the others.
*/
smp_send_stop();
stop_other_cpus();
#endif

lapic_shutdown();
Expand Down
15 changes: 9 additions & 6 deletions trunk/arch/x86/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ asmlinkage void smp_reboot_interrupt(void)
irq_exit();
}

static void native_smp_send_stop(void)
static void native_stop_other_cpus(int wait)
{
unsigned long flags;
unsigned long wait;
unsigned long timeout;

if (reboot_force)
return;
Expand All @@ -179,9 +179,12 @@ static void native_smp_send_stop(void)
if (num_online_cpus() > 1) {
apic->send_IPI_allbutself(REBOOT_VECTOR);

/* Don't wait longer than a second */
wait = USEC_PER_SEC;
while (num_online_cpus() > 1 && wait--)
/*
* Don't wait longer than a second if the caller
* didn't ask us to wait.
*/
timeout = USEC_PER_SEC;
while (num_online_cpus() > 1 && (wait || timeout--))
udelay(1);
}

Expand Down Expand Up @@ -227,7 +230,7 @@ struct smp_ops smp_ops = {
.smp_prepare_cpus = native_smp_prepare_cpus,
.smp_cpus_done = native_smp_cpus_done,

.smp_send_stop = native_smp_send_stop,
.stop_other_cpus = native_stop_other_cpus,
.smp_send_reschedule = native_smp_send_reschedule,

.cpu_up = native_cpu_up,
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/xen/enlighten.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ static void xen_reboot(int reason)
struct sched_shutdown r = { .reason = reason };

#ifdef CONFIG_SMP
smp_send_stop();
stop_other_cpus();
#endif

if (HYPERVISOR_sched_op(SCHEDOP_shutdown, &r))
Expand Down
6 changes: 3 additions & 3 deletions trunk/arch/x86/xen/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ static void stop_self(void *v)
BUG();
}

static void xen_smp_send_stop(void)
static void xen_stop_other_cpus(int wait)
{
smp_call_function(stop_self, NULL, 0);
smp_call_function(stop_self, NULL, wait);
}

static void xen_smp_send_reschedule(int cpu)
Expand Down Expand Up @@ -470,7 +470,7 @@ static const struct smp_ops xen_smp_ops __initdata = {
.cpu_disable = xen_cpu_disable,
.play_dead = xen_play_dead,

.smp_send_stop = xen_smp_send_stop,
.stop_other_cpus = xen_stop_other_cpus,
.smp_send_reschedule = xen_smp_send_reschedule,

.send_call_func_ipi = xen_smp_send_call_function_ipi,
Expand Down

0 comments on commit ffb5933

Please sign in to comment.