Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 63498
b: refs/heads/master
c: b4b2917
h: refs/heads/master
v: v3
  • Loading branch information
Peter Watkins authored and Ralf Baechle committed Jul 31, 2007
1 parent dd6a6d2 commit 9cd2c94
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 185bcd17a5fb4155fba125332efa498be126aa4e
refs/heads/master: b4b2917cc8babe8eaf4bc133bca31b11ed7dac13
55 changes: 55 additions & 0 deletions trunk/arch/mips/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,61 @@ void smp_call_function_interrupt(void)
}
}

int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
int retry, int wait)
{
struct call_data_struct data;
int me;

/*
* Can die spectacularly if this CPU isn't yet marked online
*/
if (!cpu_online(cpu))
return 0;

me = get_cpu();
BUG_ON(!cpu_online(me));

if (cpu == me) {
local_irq_disable();
func(info);
local_irq_enable();
put_cpu();
return 0;
}

/* Can deadlock when called with interrupts disabled */
WARN_ON(irqs_disabled());

data.func = func;
data.info = info;
atomic_set(&data.started, 0);
data.wait = wait;
if (wait)
atomic_set(&data.finished, 0);

spin_lock(&smp_call_lock);
call_data = &data;
smp_mb();

/* Send a message to the other CPU */
core_send_ipi(cpu, SMP_CALL_FUNCTION);

/* Wait for response */
/* FIXME: lock-up detection, backtrace on lock-up */
while (atomic_read(&data.started) != 1)
barrier();

if (wait)
while (atomic_read(&data.finished) != 1)
barrier();
call_data = NULL;
spin_unlock(&smp_call_lock);

put_cpu();
return 0;
}

static void stop_this_cpu(void *dummy)
{
/*
Expand Down

0 comments on commit 9cd2c94

Please sign in to comment.