debuggers.hg
changeset 3032:1f505eb80787
bitkeeper revision 1.1159.1.421 (419a49d5OpcJouN71xtnac-y_agMGA)
Make multicall queues per cpu.
Make multicall queues per cpu.
author | cl349@freefall.cl.cam.ac.uk |
---|---|
date | Tue Nov 16 18:41:25 2004 +0000 (2004-11-16) |
parents | 0a6a455dfbd3 |
children | b3bd8fd6c418 |
files | linux-2.6.9-xen-sparse/arch/xen/i386/kernel/setup.c linux-2.6.9-xen-sparse/include/asm-xen/multicall.h |
line diff
1.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/setup.c Tue Nov 16 18:40:59 2004 +0000 1.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/setup.c Tue Nov 16 18:41:25 2004 +0000 1.3 @@ -39,6 +39,7 @@ 1.4 #include <linux/efi.h> 1.5 #include <linux/init.h> 1.6 #include <linux/edd.h> 1.7 +#include <linux/percpu.h> 1.8 #include <video/edid.h> 1.9 #include <asm/e820.h> 1.10 #include <asm/mpspec.h> 1.11 @@ -344,8 +345,8 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info); 1.12 unsigned long *phys_to_machine_mapping, *pfn_to_mfn_frame_list; 1.13 EXPORT_SYMBOL(phys_to_machine_mapping); 1.14 1.15 -multicall_entry_t multicall_list[8]; 1.16 -int nr_multicall_ents = 0; 1.17 +DEFINE_PER_CPU(multicall_entry_t, multicall_list[8]); 1.18 +DEFINE_PER_CPU(int, nr_multicall_ents); 1.19 1.20 /* Raw start-of-day parameters from the hypervisor. */ 1.21 union xen_start_info_union xen_start_info_union;
2.1 --- a/linux-2.6.9-xen-sparse/include/asm-xen/multicall.h Tue Nov 16 18:40:59 2004 +0000 2.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/multicall.h Tue Nov 16 18:41:25 2004 +0000 2.3 @@ -30,78 +30,86 @@ 2.4 2.5 #include <asm-xen/hypervisor.h> 2.6 2.7 -extern multicall_entry_t multicall_list[]; 2.8 -extern int nr_multicall_ents; 2.9 +DECLARE_PER_CPU(multicall_entry_t, multicall_list[]); 2.10 +DECLARE_PER_CPU(int, nr_multicall_ents); 2.11 2.12 static inline void queue_multicall0(unsigned long op) 2.13 { 2.14 - int i = nr_multicall_ents; 2.15 - multicall_list[i].op = op; 2.16 - nr_multicall_ents = i+1; 2.17 + int cpu = smp_processor_id(); 2.18 + int i = per_cpu(nr_multicall_ents, cpu); 2.19 + per_cpu(multicall_list[i], cpu).op = op; 2.20 + per_cpu(nr_multicall_ents, cpu) = i+1; 2.21 } 2.22 2.23 static inline void queue_multicall1(unsigned long op, unsigned long arg1) 2.24 { 2.25 - int i = nr_multicall_ents; 2.26 - multicall_list[i].op = op; 2.27 - multicall_list[i].args[0] = arg1; 2.28 - nr_multicall_ents = i+1; 2.29 + int cpu = smp_processor_id(); 2.30 + int i = per_cpu(nr_multicall_ents, cpu); 2.31 + per_cpu(multicall_list[i], cpu).op = op; 2.32 + per_cpu(multicall_list[i], cpu).args[0] = arg1; 2.33 + per_cpu(nr_multicall_ents, cpu) = i+1; 2.34 } 2.35 2.36 static inline void queue_multicall2( 2.37 unsigned long op, unsigned long arg1, unsigned long arg2) 2.38 { 2.39 - int i = nr_multicall_ents; 2.40 - multicall_list[i].op = op; 2.41 - multicall_list[i].args[0] = arg1; 2.42 - multicall_list[i].args[1] = arg2; 2.43 - nr_multicall_ents = i+1; 2.44 + int cpu = smp_processor_id(); 2.45 + int i = per_cpu(nr_multicall_ents, cpu); 2.46 + per_cpu(multicall_list[i], cpu).op = op; 2.47 + per_cpu(multicall_list[i], cpu).args[0] = arg1; 2.48 + per_cpu(multicall_list[i], cpu).args[1] = arg2; 2.49 + per_cpu(nr_multicall_ents, cpu) = i+1; 2.50 } 2.51 2.52 static inline void queue_multicall3( 2.53 unsigned long op, unsigned long arg1, unsigned long arg2, 2.54 unsigned long arg3) 2.55 { 2.56 - int i = nr_multicall_ents; 2.57 - multicall_list[i].op = op; 2.58 - multicall_list[i].args[0] = arg1; 2.59 - multicall_list[i].args[1] = arg2; 2.60 - multicall_list[i].args[2] = arg3; 2.61 - nr_multicall_ents = i+1; 2.62 + int cpu = smp_processor_id(); 2.63 + int i = per_cpu(nr_multicall_ents, cpu); 2.64 + per_cpu(multicall_list[i], cpu).op = op; 2.65 + per_cpu(multicall_list[i], cpu).args[0] = arg1; 2.66 + per_cpu(multicall_list[i], cpu).args[1] = arg2; 2.67 + per_cpu(multicall_list[i], cpu).args[2] = arg3; 2.68 + per_cpu(nr_multicall_ents, cpu) = i+1; 2.69 } 2.70 2.71 static inline void queue_multicall4( 2.72 unsigned long op, unsigned long arg1, unsigned long arg2, 2.73 unsigned long arg3, unsigned long arg4) 2.74 { 2.75 - int i = nr_multicall_ents; 2.76 - multicall_list[i].op = op; 2.77 - multicall_list[i].args[0] = arg1; 2.78 - multicall_list[i].args[1] = arg2; 2.79 - multicall_list[i].args[2] = arg3; 2.80 - multicall_list[i].args[3] = arg4; 2.81 - nr_multicall_ents = i+1; 2.82 + int cpu = smp_processor_id(); 2.83 + int i = per_cpu(nr_multicall_ents, cpu); 2.84 + per_cpu(multicall_list[i], cpu).op = op; 2.85 + per_cpu(multicall_list[i], cpu).args[0] = arg1; 2.86 + per_cpu(multicall_list[i], cpu).args[1] = arg2; 2.87 + per_cpu(multicall_list[i], cpu).args[2] = arg3; 2.88 + per_cpu(multicall_list[i], cpu).args[3] = arg4; 2.89 + per_cpu(nr_multicall_ents, cpu) = i+1; 2.90 } 2.91 2.92 static inline void queue_multicall5( 2.93 unsigned long op, unsigned long arg1, unsigned long arg2, 2.94 unsigned long arg3, unsigned long arg4, unsigned long arg5) 2.95 { 2.96 - int i = nr_multicall_ents; 2.97 - multicall_list[i].op = op; 2.98 - multicall_list[i].args[0] = arg1; 2.99 - multicall_list[i].args[1] = arg2; 2.100 - multicall_list[i].args[2] = arg3; 2.101 - multicall_list[i].args[3] = arg4; 2.102 - multicall_list[i].args[4] = arg5; 2.103 - nr_multicall_ents = i+1; 2.104 + int cpu = smp_processor_id(); 2.105 + int i = per_cpu(nr_multicall_ents, cpu); 2.106 + per_cpu(multicall_list[i], cpu).op = op; 2.107 + per_cpu(multicall_list[i], cpu).args[0] = arg1; 2.108 + per_cpu(multicall_list[i], cpu).args[1] = arg2; 2.109 + per_cpu(multicall_list[i], cpu).args[2] = arg3; 2.110 + per_cpu(multicall_list[i], cpu).args[3] = arg4; 2.111 + per_cpu(multicall_list[i], cpu).args[4] = arg5; 2.112 + per_cpu(nr_multicall_ents, cpu) = i+1; 2.113 } 2.114 2.115 static inline void execute_multicall_list(void) 2.116 { 2.117 - if ( unlikely(nr_multicall_ents == 0) ) return; 2.118 - (void)HYPERVISOR_multicall(multicall_list, nr_multicall_ents); 2.119 - nr_multicall_ents = 0; 2.120 + int cpu = smp_processor_id(); 2.121 + if ( unlikely(per_cpu(nr_multicall_ents, cpu) == 0) ) return; 2.122 + (void)HYPERVISOR_multicall(&per_cpu(multicall_list[0], cpu), 2.123 + per_cpu(nr_multicall_ents, cpu)); 2.124 + per_cpu(nr_multicall_ents, cpu) = 0; 2.125 } 2.126 2.127 #endif /* __MULTICALL_H__ */