diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-05-27 11:15:08 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-05-27 11:15:08 +0100 |
commit | c3da952a0261cb2fa381154a6f22b758a4bd843b (patch) | |
tree | 92496e6fa23a402388431550351e458deedf84ec /xen/common | |
parent | cf5e6f2d34413cac233939ab701191655a587ca7 (diff) | |
download | xen-c3da952a0261cb2fa381154a6f22b758a4bd843b.tar.gz xen-c3da952a0261cb2fa381154a6f22b758a4bd843b.tar.bz2 xen-c3da952a0261cb2fa381154a6f22b758a4bd843b.zip |
Pass cpumasks by reference always.
Rather than passing cpumasks by value in all cases (which is
problematic for large NR_CPUS configurations), pass them 'by
reference' (i.e. through a pointer to a const cpumask).
On x86 this changes send_IPI_mask() to always only send IPIs to remote
CPUs (meaning any caller needing to handle the current CPU as well has
to do so on its own).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common')
-rw-r--r-- | xen/common/Makefile | 1 | ||||
-rw-r--r-- | xen/common/cpu.c | 26 | ||||
-rw-r--r-- | xen/common/grant_table.c | 10 | ||||
-rw-r--r-- | xen/common/keyhandler.c | 2 | ||||
-rw-r--r-- | xen/common/page_alloc.c | 2 |
5 files changed, 34 insertions, 7 deletions
diff --git a/xen/common/Makefile b/xen/common/Makefile index 08b9e2b00e..27b13f3e34 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -1,4 +1,5 @@ obj-y += bitmap.o +obj-y += cpu.o obj-y += domctl.o obj-y += domain.o obj-y += event_channel.o diff --git a/xen/common/cpu.c b/xen/common/cpu.c new file mode 100644 index 0000000000..96cba72e9e --- /dev/null +++ b/xen/common/cpu.c @@ -0,0 +1,26 @@ +#include <xen/config.h> +#include <xen/cpumask.h> + +/* + * cpu_bit_bitmap[] is a special, "compressed" data structure that + * represents all NR_CPUS bits binary values of 1<<nr. + * + * It is used by cpumask_of() to get a constant address to a CPU + * mask value that has a single bit set only. + */ + +/* cpu_bit_bitmap[0] is empty - so we can back into it */ +#define MASK_DECLARE_1(x) [x+1][0] = 1UL << (x) +#define MASK_DECLARE_2(x) MASK_DECLARE_1(x), MASK_DECLARE_1(x+1) +#define MASK_DECLARE_4(x) MASK_DECLARE_2(x), MASK_DECLARE_2(x+2) +#define MASK_DECLARE_8(x) MASK_DECLARE_4(x), MASK_DECLARE_4(x+4) + +const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)] = { + + MASK_DECLARE_8(0), MASK_DECLARE_8(8), + MASK_DECLARE_8(16), MASK_DECLARE_8(24), +#if BITS_PER_LONG > 32 + MASK_DECLARE_8(32), MASK_DECLARE_8(40), + MASK_DECLARE_8(48), MASK_DECLARE_8(56), +#endif +}; diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 530635469d..7bbc05d896 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -715,7 +715,7 @@ gnttab_unmap_grant_ref( goto fault; } - flush_tlb_mask(current->domain->domain_dirty_cpumask); + flush_tlb_mask(¤t->domain->domain_dirty_cpumask); for ( i = 0; i < partial_done; i++ ) __gnttab_unmap_common_complete(&(common[i])); @@ -727,7 +727,7 @@ gnttab_unmap_grant_ref( return 0; fault: - flush_tlb_mask(current->domain->domain_dirty_cpumask); + flush_tlb_mask(¤t->domain->domain_dirty_cpumask); for ( i = 0; i < partial_done; i++ ) __gnttab_unmap_common_complete(&(common[i])); @@ -774,7 +774,7 @@ gnttab_unmap_and_replace( goto fault; } - flush_tlb_mask(current->domain->domain_dirty_cpumask); + flush_tlb_mask(¤t->domain->domain_dirty_cpumask); for ( i = 0; i < partial_done; i++ ) __gnttab_unmap_common_complete(&(common[i])); @@ -786,7 +786,7 @@ gnttab_unmap_and_replace( return 0; fault: - flush_tlb_mask(current->domain->domain_dirty_cpumask); + flush_tlb_mask(¤t->domain->domain_dirty_cpumask); for ( i = 0; i < partial_done; i++ ) __gnttab_unmap_common_complete(&(common[i])); @@ -1123,7 +1123,7 @@ gnttab_transfer( #ifndef __ia64__ /* IA64 implicitly replaces the old page in steal_page(). */ guest_physmap_remove_page(d, gop.mfn, mfn, 0); #endif - flush_tlb_mask(d->domain_dirty_cpumask); + flush_tlb_mask(&d->domain_dirty_cpumask); /* Find the target domain. */ if ( unlikely((e = rcu_lock_domain_by_id(gop.domid)) == NULL) ) diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index c481df0f3f..5407456290 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -119,7 +119,7 @@ static void dump_registers(unsigned char key, struct cpu_user_regs *regs) if ( cpu == smp_processor_id() ) continue; printk("\n*** Dumping CPU%d host state: ***\n", cpu); - on_selected_cpus(cpumask_of_cpu(cpu), __dump_execstate, NULL, 1, 1); + on_selected_cpus(cpumask_of(cpu), __dump_execstate, NULL, 1, 1); } printk("\n"); diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index bb143aedd6..bd514cfeed 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -431,7 +431,7 @@ static struct page_info *alloc_heap_pages( if ( unlikely(!cpus_empty(mask)) ) { perfc_incr(need_flush_tlb_flush); - flush_tlb_mask(mask); + flush_tlb_mask(&mask); } return pg; |