From 4f3e36d7ad7cd23f8df44e39fb14313a8a809e3d Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 21 Oct 2011 09:21:09 +0200 Subject: eliminate direct assignments of CPU masks Use cpumask_copy() instead of direct variable assignments for copying CPU masks. While direct assignments are not a problem when both sides are variables actually defined as cpumask_t (except for possibly copying *much* more than would actually need to be copied), they must not happen when the original variable is of type cpumask_var_t (which may have lass space allocated to it than a full cpumask_t). Eliminate as many of such assignments as possible (in several cases it's even possible to collapse two operations [copy then clear one bit] into one [cpumask_andnot()]), and thus set the way for reducing the allocation size in alloc_cpumask_var(). Signed-off-by: Jan Beulich Acked-by: Keir Fraser --- xen/arch/x86/irq.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'xen/arch/x86/irq.c') diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 4a93f29d76..40326f2bfe 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -1040,7 +1040,7 @@ static void irq_guest_eoi_timer_fn(void *data) desc->handler->end(desc, 0); break; case ACKTYPE_EOI: - cpu_eoi_map = action->cpu_eoi_map; + cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map); spin_unlock_irq(&desc->lock); on_selected_cpus(&cpu_eoi_map, set_eoi_ready, desc, 0); spin_lock_irq(&desc->lock); @@ -1366,9 +1366,9 @@ void desc_guest_eoi(struct irq_desc *desc, struct pirq *pirq) ASSERT(action->ack_type == ACKTYPE_EOI); - cpu_eoi_map = action->cpu_eoi_map; + cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map); - if ( cpu_test_and_clear(smp_processor_id(), cpu_eoi_map) ) + if ( cpumask_test_and_clear_cpu(smp_processor_id(), &cpu_eoi_map) ) { __set_eoi_ready(desc); spin_unlock(&desc->lock); @@ -1380,7 +1380,7 @@ void desc_guest_eoi(struct irq_desc *desc, struct pirq *pirq) spin_unlock_irq(&desc->lock); } - if ( !cpus_empty(cpu_eoi_map) ) + if ( !cpumask_empty(&cpu_eoi_map) ) on_selected_cpus(&cpu_eoi_map, set_eoi_ready, desc, 0); } @@ -1619,7 +1619,7 @@ static irq_guest_action_t *__pirq_guest_unbind( (--action->in_flight == 0) && (action->nr_guests != 0) ) { - cpu_eoi_map = action->cpu_eoi_map; + cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map); spin_unlock_irq(&desc->lock); on_selected_cpus(&cpu_eoi_map, set_eoi_ready, desc, 0); spin_lock_irq(&desc->lock); @@ -1649,8 +1649,8 @@ static irq_guest_action_t *__pirq_guest_unbind( * would need to flush all ready EOIs before returning as otherwise the * desc->handler could change and we would call the wrong 'end' hook. */ - cpu_eoi_map = action->cpu_eoi_map; - if ( !cpus_empty(cpu_eoi_map) ) + cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map); + if ( !cpumask_empty(&cpu_eoi_map) ) { BUG_ON(action->ack_type != ACKTYPE_EOI); spin_unlock_irq(&desc->lock); -- cgit v1.2.3