diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2007-05-15 04:41:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-15 11:54:00 -0400 |
commit | 297d9c035edd04327fedc0d1da27c2b112b66fcc (patch) | |
tree | c5a2f1258def2f54790b57afc0bea9dc49563773 /arch/i386/kernel/smp.c | |
parent | 838c41184fee5e151c09972f2ba90c16493af614 (diff) |
i386: move common parts of smp into their own file
Several parts of kernel/smp.c and smpboot.c are generally useful for other
subarchitectures and paravirt_ops implementations, so make them available for
reuse.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Acked-by: Chris Wright <chrisw@sous-sol.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/i386/kernel/smp.c')
-rw-r--r-- | arch/i386/kernel/smp.c | 65 |
1 files changed, 6 insertions, 59 deletions
diff --git a/arch/i386/kernel/smp.c b/arch/i386/kernel/smp.c index 706bda72dc60..c9a7c9835aba 100644 --- a/arch/i386/kernel/smp.c +++ b/arch/i386/kernel/smp.c | |||
@@ -467,7 +467,7 @@ void flush_tlb_all(void) | |||
467 | * it goes straight through and wastes no time serializing | 467 | * it goes straight through and wastes no time serializing |
468 | * anything. Worst case is that we lose a reschedule ... | 468 | * anything. Worst case is that we lose a reschedule ... |
469 | */ | 469 | */ |
470 | void native_smp_send_reschedule(int cpu) | 470 | static void native_smp_send_reschedule(int cpu) |
471 | { | 471 | { |
472 | WARN_ON(cpu_is_offline(cpu)); | 472 | WARN_ON(cpu_is_offline(cpu)); |
473 | send_IPI_mask(cpumask_of_cpu(cpu), RESCHEDULE_VECTOR); | 473 | send_IPI_mask(cpumask_of_cpu(cpu), RESCHEDULE_VECTOR); |
@@ -546,9 +546,10 @@ static void __smp_call_function(void (*func) (void *info), void *info, | |||
546 | * You must not call this function with disabled interrupts or from a | 546 | * You must not call this function with disabled interrupts or from a |
547 | * hardware interrupt handler or from a bottom half handler. | 547 | * hardware interrupt handler or from a bottom half handler. |
548 | */ | 548 | */ |
549 | int native_smp_call_function_mask(cpumask_t mask, | 549 | static int |
550 | void (*func)(void *), void *info, | 550 | native_smp_call_function_mask(cpumask_t mask, |
551 | int wait) | 551 | void (*func)(void *), void *info, |
552 | int wait) | ||
552 | { | 553 | { |
553 | struct call_data_struct data; | 554 | struct call_data_struct data; |
554 | cpumask_t allbutself; | 555 | cpumask_t allbutself; |
@@ -599,60 +600,6 @@ int native_smp_call_function_mask(cpumask_t mask, | |||
599 | return 0; | 600 | return 0; |
600 | } | 601 | } |
601 | 602 | ||
602 | /** | ||
603 | * smp_call_function(): Run a function on all other CPUs. | ||
604 | * @func: The function to run. This must be fast and non-blocking. | ||
605 | * @info: An arbitrary pointer to pass to the function. | ||
606 | * @nonatomic: Unused. | ||
607 | * @wait: If true, wait (atomically) until function has completed on other CPUs. | ||
608 | * | ||
609 | * Returns 0 on success, else a negative status code. | ||
610 | * | ||
611 | * If @wait is true, then returns once @func has returned; otherwise | ||
612 | * it returns just before the target cpu calls @func. | ||
613 | * | ||
614 | * You must not call this function with disabled interrupts or from a | ||
615 | * hardware interrupt handler or from a bottom half handler. | ||
616 | */ | ||
617 | int smp_call_function(void (*func) (void *info), void *info, int nonatomic, | ||
618 | int wait) | ||
619 | { | ||
620 | return smp_call_function_mask(cpu_online_map, func, info, wait); | ||
621 | } | ||
622 | EXPORT_SYMBOL(smp_call_function); | ||
623 | |||
624 | /** | ||
625 | * smp_call_function_single - Run a function on another CPU | ||
626 | * @cpu: The target CPU. Cannot be the calling CPU. | ||
627 | * @func: The function to run. This must be fast and non-blocking. | ||
628 | * @info: An arbitrary pointer to pass to the function. | ||
629 | * @nonatomic: Unused. | ||
630 | * @wait: If true, wait until function has completed on other CPUs. | ||
631 | * | ||
632 | * Returns 0 on success, else a negative status code. | ||
633 | * | ||
634 | * If @wait is true, then returns once @func has returned; otherwise | ||
635 | * it returns just before the target cpu calls @func. | ||
636 | */ | ||
637 | int smp_call_function_single(int cpu, void (*func) (void *info), void *info, | ||
638 | int nonatomic, int wait) | ||
639 | { | ||
640 | /* prevent preemption and reschedule on another processor */ | ||
641 | int ret; | ||
642 | int me = get_cpu(); | ||
643 | if (cpu == me) { | ||
644 | WARN_ON(1); | ||
645 | put_cpu(); | ||
646 | return -EBUSY; | ||
647 | } | ||
648 | |||
649 | ret = smp_call_function_mask(cpumask_of_cpu(cpu), func, info, wait); | ||
650 | |||
651 | put_cpu(); | ||
652 | return ret; | ||
653 | } | ||
654 | EXPORT_SYMBOL(smp_call_function_single); | ||
655 | |||
656 | static void stop_this_cpu (void * dummy) | 603 | static void stop_this_cpu (void * dummy) |
657 | { | 604 | { |
658 | local_irq_disable(); | 605 | local_irq_disable(); |
@@ -670,7 +617,7 @@ static void stop_this_cpu (void * dummy) | |||
670 | * this function calls the 'stop' function on all other CPUs in the system. | 617 | * this function calls the 'stop' function on all other CPUs in the system. |
671 | */ | 618 | */ |
672 | 619 | ||
673 | void native_smp_send_stop(void) | 620 | static void native_smp_send_stop(void) |
674 | { | 621 | { |
675 | /* Don't deadlock on the call lock in panic */ | 622 | /* Don't deadlock on the call lock in panic */ |
676 | int nolock = !spin_trylock(&call_lock); | 623 | int nolock = !spin_trylock(&call_lock); |