diff options
author | Mike Travis <travis@sgi.com> | 2008-12-16 20:33:52 -0500 |
---|---|---|
committer | Mike Travis <travis@sgi.com> | 2008-12-16 20:40:56 -0500 |
commit | e7986739a76cde5079da08809d8bbc6878387ae0 (patch) | |
tree | dd99ed6af66d459fe164f75ded7f95262dc0fb0d /arch/x86/xen | |
parent | 36f5101a60de8f79c0d1ca06e50660bf5129e02c (diff) |
x86 smp: modify send_IPI_mask interface to accept cpumask_t pointers
Impact: cleanup, change parameter passing
* Change genapic interfaces to accept cpumask_t pointers where possible.
* Modify external callers to use cpumask_t pointers in function calls.
* Create new send_IPI_mask_allbutself which is the same as the
send_IPI_mask functions but removes smp_processor_id() from list.
This removes another common need for a temporary cpumask_t variable.
* Functions that used a temp cpumask_t variable for:
cpumask_t allbutme = cpu_online_map;
cpu_clear(smp_processor_id(), allbutme);
if (!cpus_empty(allbutme))
...
become:
if (!cpus_equal(cpu_online_map, cpumask_of_cpu(cpu)))
...
* Other minor code optimizations (like using cpus_clear instead of
CPU_MASK_NONE, etc.)
Applies to linux-2.6.tip/master.
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/xen')
-rw-r--r-- | arch/x86/xen/smp.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index acd9b6705e02..2cce362c9874 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
@@ -158,7 +158,7 @@ static void __init xen_fill_possible_map(void) | |||
158 | { | 158 | { |
159 | int i, rc; | 159 | int i, rc; |
160 | 160 | ||
161 | for (i = 0; i < NR_CPUS; i++) { | 161 | for (i = 0; i < nr_cpu_ids; i++) { |
162 | rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); | 162 | rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); |
163 | if (rc >= 0) { | 163 | if (rc >= 0) { |
164 | num_processors++; | 164 | num_processors++; |
@@ -196,7 +196,7 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus) | |||
196 | 196 | ||
197 | /* Restrict the possible_map according to max_cpus. */ | 197 | /* Restrict the possible_map according to max_cpus. */ |
198 | while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) { | 198 | while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) { |
199 | for (cpu = NR_CPUS - 1; !cpu_possible(cpu); cpu--) | 199 | for (cpu = nr_cpu_ids - 1; !cpu_possible(cpu); cpu--) |
200 | continue; | 200 | continue; |
201 | cpu_clear(cpu, cpu_possible_map); | 201 | cpu_clear(cpu, cpu_possible_map); |
202 | } | 202 | } |
@@ -408,24 +408,22 @@ static void xen_smp_send_reschedule(int cpu) | |||
408 | xen_send_IPI_one(cpu, XEN_RESCHEDULE_VECTOR); | 408 | xen_send_IPI_one(cpu, XEN_RESCHEDULE_VECTOR); |
409 | } | 409 | } |
410 | 410 | ||
411 | static void xen_send_IPI_mask(cpumask_t mask, enum ipi_vector vector) | 411 | static void xen_send_IPI_mask(const cpumask_t *mask, enum ipi_vector vector) |
412 | { | 412 | { |
413 | unsigned cpu; | 413 | unsigned cpu; |
414 | 414 | ||
415 | cpus_and(mask, mask, cpu_online_map); | 415 | for_each_cpu_and(cpu, mask, &cpu_online_map) |
416 | |||
417 | for_each_cpu_mask_nr(cpu, mask) | ||
418 | xen_send_IPI_one(cpu, vector); | 416 | xen_send_IPI_one(cpu, vector); |
419 | } | 417 | } |
420 | 418 | ||
421 | static void xen_smp_send_call_function_ipi(cpumask_t mask) | 419 | static void xen_smp_send_call_function_ipi(const cpumask_t *mask) |
422 | { | 420 | { |
423 | int cpu; | 421 | int cpu; |
424 | 422 | ||
425 | xen_send_IPI_mask(mask, XEN_CALL_FUNCTION_VECTOR); | 423 | xen_send_IPI_mask(mask, XEN_CALL_FUNCTION_VECTOR); |
426 | 424 | ||
427 | /* Make sure other vcpus get a chance to run if they need to. */ | 425 | /* Make sure other vcpus get a chance to run if they need to. */ |
428 | for_each_cpu_mask_nr(cpu, mask) { | 426 | for_each_cpu_mask_nr(cpu, *mask) { |
429 | if (xen_vcpu_stolen(cpu)) { | 427 | if (xen_vcpu_stolen(cpu)) { |
430 | HYPERVISOR_sched_op(SCHEDOP_yield, 0); | 428 | HYPERVISOR_sched_op(SCHEDOP_yield, 0); |
431 | break; | 429 | break; |
@@ -435,7 +433,8 @@ static void xen_smp_send_call_function_ipi(cpumask_t mask) | |||
435 | 433 | ||
436 | static void xen_smp_send_call_function_single_ipi(int cpu) | 434 | static void xen_smp_send_call_function_single_ipi(int cpu) |
437 | { | 435 | { |
438 | xen_send_IPI_mask(cpumask_of_cpu(cpu), XEN_CALL_FUNCTION_SINGLE_VECTOR); | 436 | xen_send_IPI_mask(&cpumask_of_cpu(cpu), |
437 | XEN_CALL_FUNCTION_SINGLE_VECTOR); | ||
439 | } | 438 | } |
440 | 439 | ||
441 | static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id) | 440 | static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id) |