[SPARC64]: smp_call_function() fixups...
1) Take doc-book function comment from i386 implementation. 2) cacheline align call_lock, taken from powerpc 3) Need memory barrier after setting call_data 4) Remove timeout Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -745,12 +745,21 @@ struct call_data_struct {
|
|||||||
int wait;
|
int wait;
|
||||||
};
|
};
|
||||||
|
|
||||||
static DEFINE_SPINLOCK(call_lock);
|
static __cacheline_aligned_in_smp DEFINE_SPINLOCK(call_lock);
|
||||||
static struct call_data_struct *call_data;
|
static struct call_data_struct *call_data;
|
||||||
|
|
||||||
extern unsigned long xcall_call_function;
|
extern unsigned long xcall_call_function;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|
* smp_call_function(): Run a function on all other CPUs.
|
||||||
|
* @func: The function to run. This must be fast and non-blocking.
|
||||||
|
* @info: An arbitrary pointer to pass to the function.
|
||||||
|
* @nonatomic: currently unused.
|
||||||
|
* @wait: If true, wait (atomically) until function has completed on other CPUs.
|
||||||
|
*
|
||||||
|
* Returns 0 on success, else a negative status code. Does not return until
|
||||||
|
* remote CPUs are nearly ready to execute <<func>> or are or have executed.
|
||||||
|
*
|
||||||
* You must not call this function with disabled interrupts or from a
|
* You must not call this function with disabled interrupts or from a
|
||||||
* hardware interrupt handler or from a bottom half handler.
|
* hardware interrupt handler or from a bottom half handler.
|
||||||
*/
|
*/
|
||||||
@@ -759,7 +768,6 @@ static int smp_call_function_mask(void (*func)(void *info), void *info,
|
|||||||
{
|
{
|
||||||
struct call_data_struct data;
|
struct call_data_struct data;
|
||||||
int cpus;
|
int cpus;
|
||||||
long timeout;
|
|
||||||
|
|
||||||
/* Can deadlock when called with interrupts disabled */
|
/* Can deadlock when called with interrupts disabled */
|
||||||
WARN_ON(irqs_disabled());
|
WARN_ON(irqs_disabled());
|
||||||
@@ -777,31 +785,18 @@ static int smp_call_function_mask(void (*func)(void *info), void *info,
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
call_data = &data;
|
call_data = &data;
|
||||||
|
mb();
|
||||||
|
|
||||||
smp_cross_call_masked(&xcall_call_function, 0, 0, 0, mask);
|
smp_cross_call_masked(&xcall_call_function, 0, 0, 0, mask);
|
||||||
|
|
||||||
/*
|
/* Wait for response */
|
||||||
* Wait for other cpus to complete function or at
|
while (atomic_read(&data.finished) != cpus)
|
||||||
* least snap the call data.
|
cpu_relax();
|
||||||
*/
|
|
||||||
timeout = 1000000;
|
|
||||||
while (atomic_read(&data.finished) != cpus) {
|
|
||||||
if (--timeout <= 0)
|
|
||||||
goto out_timeout;
|
|
||||||
barrier();
|
|
||||||
udelay(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
spin_unlock(&call_lock);
|
spin_unlock(&call_lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_timeout:
|
|
||||||
spin_unlock(&call_lock);
|
|
||||||
printk("XCALL: Remote cpus not responding, ncpus=%d finished=%d\n",
|
|
||||||
cpus, atomic_read(&data.finished));
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int smp_call_function(void (*func)(void *info), void *info,
|
int smp_call_function(void (*func)(void *info), void *info,
|
||||||
|
Reference in New Issue
Block a user