Blame view
include/linux/smp.h
4.69 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 |
#ifndef __LINUX_SMP_H #define __LINUX_SMP_H /* * Generic SMP support * Alan Cox. <alan@redhat.com> */ |
79974a0e4 Let smp_call_func... |
8 |
#include <linux/errno.h> |
54514a70a softirq: Add supp... |
9 |
#include <linux/types.h> |
3d4422332 Add generic helpe... |
10 |
#include <linux/list.h> |
3d4422332 Add generic helpe... |
11 |
#include <linux/cpumask.h> |
1da177e4c Linux-2.6.12-rc2 |
12 13 |
extern void cpu_idle(void); |
3d4422332 Add generic helpe... |
14 15 16 17 |
struct call_single_data { struct list_head list; void (*func) (void *info); void *info; |
54514a70a softirq: Add supp... |
18 19 |
u16 flags; u16 priv; |
3d4422332 Add generic helpe... |
20 |
}; |
e057d7aea cpumask: add sysf... |
21 22 |
/* total number of cpus in this system (may exceed NR_CPUS) */ extern unsigned int total_cpus; |
53ce3d956 smp_call_function... |
23 24 |
int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, int wait); |
1da177e4c Linux-2.6.12-rc2 |
25 26 27 28 29 30 31 |
#ifdef CONFIG_SMP #include <linux/preempt.h> #include <linux/kernel.h> #include <linux/compiler.h> #include <linux/thread_info.h> #include <asm/smp.h> |
1da177e4c Linux-2.6.12-rc2 |
32 33 34 35 |
/* * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc. * (defined in asm header): |
d1dedb52a panic, smp: provi... |
36 |
*/ |
1da177e4c Linux-2.6.12-rc2 |
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
/* * stops all CPUs but the current one: */ extern void smp_send_stop(void); /* * sends a 'reschedule' event to another CPU: */ extern void smp_send_reschedule(int cpu); /* * Prepare machine for booting other CPUs. */ extern void smp_prepare_cpus(unsigned int max_cpus); /* * Bring a CPU up */ extern int __cpu_up(unsigned int cpunum); /* * Final polishing of CPUs */ extern void smp_cpus_done(unsigned int max_cpus); /* * Call a function on all other processors */ |
8691e5a8f smp_call_function... |
67 |
int smp_call_function(void(*func)(void *info), void *info, int wait); |
54b11e6d5 cpumask: smp_call... |
68 69 |
void smp_call_function_many(const struct cpumask *mask, void (*func)(void *info), void *info, bool wait); |
2d3854a37 cpumask: introduc... |
70 |
|
6e2756376 generic-ipi: remo... |
71 72 |
void __smp_call_function_single(int cpuid, struct call_single_data *data, int wait); |
3d4422332 Add generic helpe... |
73 |
|
2ea6dec4a generic-ipi: Add ... |
74 75 |
int smp_call_function_any(const struct cpumask *mask, void (*func)(void *info), void *info, int wait); |
3d4422332 Add generic helpe... |
76 77 78 79 80 81 |
/* * Generic and arch helpers */ #ifdef CONFIG_USE_GENERIC_SMP_HELPERS void generic_smp_call_function_single_interrupt(void); void generic_smp_call_function_interrupt(void); |
3d4422332 Add generic helpe... |
82 83 84 85 |
void ipi_call_lock(void); void ipi_call_unlock(void); void ipi_call_lock_irq(void); void ipi_call_unlock_irq(void); |
3d4422332 Add generic helpe... |
86 |
#endif |
a3bc0dbc8 [PATCH] smp_call_... |
87 |
|
1da177e4c Linux-2.6.12-rc2 |
88 89 90 |
/* * Call a function on all processors */ |
15c8b6c1a on_each_cpu(): ki... |
91 |
int on_each_cpu(void (*func) (void *info), void *info, int wait); |
1da177e4c Linux-2.6.12-rc2 |
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */ #define MSG_ALL 0x8001 #define MSG_INVALIDATE_TLB 0x0001 /* Remote processor TLB invalidate */ #define MSG_STOP_CPU 0x0002 /* Sent to shut down slave CPU's * when rebooting */ #define MSG_RESCHEDULE 0x0003 /* Reschedule request from master CPU*/ #define MSG_CALL_FUNCTION 0x0004 /* Call function on all other CPUs */ /* * Mark the boot cpu "online" so that it can call console drivers in * printk() and can access its per-cpu storage. */ void smp_prepare_boot_cpu(void); |
ca74a6f84 x86: optimize loc... |
108 |
extern unsigned int setup_max_cpus; |
1da177e4c Linux-2.6.12-rc2 |
109 |
#else /* !SMP */ |
d1dedb52a panic, smp: provi... |
110 |
static inline void smp_send_stop(void) { } |
1da177e4c Linux-2.6.12-rc2 |
111 112 113 |
/* * These macros fold the SMP functionality into a single CPU system */ |
39c715b71 [PATCH] smp_proce... |
114 |
#define raw_smp_processor_id() 0 |
a5fbb6d10 KVM: fix !SMP bui... |
115 |
static inline int up_smp_call_function(void (*func)(void *), void *info) |
3c30b06df [PATCH] cleanup s... |
116 117 118 |
{ return 0; } |
8691e5a8f smp_call_function... |
119 |
#define smp_call_function(func, info, wait) \ |
a5fbb6d10 KVM: fix !SMP bui... |
120 |
(up_smp_call_function(func, info)) |
15c8b6c1a on_each_cpu(): ki... |
121 |
#define on_each_cpu(func,info,wait) \ |
78eef01b0 [PATCH] on_each_c... |
122 123 124 125 126 127 |
({ \ local_irq_disable(); \ func(info); \ local_irq_enable(); \ 0; \ }) |
79a881022 [PATCH] alpha: fi... |
128 |
static inline void smp_send_reschedule(int cpu) { } |
2ac6608c4 Revert broken "st... |
129 130 |
#define num_booting_cpus() 1 #define smp_prepare_boot_cpu() do {} while (0) |
d2ff91188 Define smp_call_f... |
131 132 |
#define smp_call_function_many(mask, func, info, wait) \ (up_smp_call_function(func, info)) |
2ea6dec4a generic-ipi: Add ... |
133 134 135 136 137 |
static inline void init_call_single_data(void) { } static inline int smp_call_function_any(const struct cpumask *mask, void (*func)(void *info), void *info, int wait) |
3d4422332 Add generic helpe... |
138 |
{ |
2ea6dec4a generic-ipi: Add ... |
139 |
return smp_call_function_single(0, func, info, wait); |
3d4422332 Add generic helpe... |
140 |
} |
2ea6dec4a generic-ipi: Add ... |
141 |
|
1da177e4c Linux-2.6.12-rc2 |
142 143 144 |
#endif /* !SMP */ /* |
39c715b71 [PATCH] smp_proce... |
145 |
* smp_processor_id(): get the current CPU ID. |
1da177e4c Linux-2.6.12-rc2 |
146 |
* |
cfd8d6c0e smp: fix document... |
147 |
* if DEBUG_PREEMPT is enabled then we check whether it is |
39c715b71 [PATCH] smp_proce... |
148 149 150 |
* used in a preemption-safe way. (smp_processor_id() is safe * if it's used in a preemption-off critical section, or in * a thread that is bound to the current CPU.) |
1da177e4c Linux-2.6.12-rc2 |
151 |
* |
39c715b71 [PATCH] smp_proce... |
152 153 154 155 156 157 |
* NOTE: raw_smp_processor_id() is for internal use only * (smp_processor_id() is the preferred variant), but in rare * instances it might also be used to turn off false positives * (i.e. smp_processor_id() use that the debugging code reports but * which use for some reason is legal). Don't use this to hack around * the warning message, as your code might not work under PREEMPT. |
1da177e4c Linux-2.6.12-rc2 |
158 |
*/ |
39c715b71 [PATCH] smp_proce... |
159 160 161 |
#ifdef CONFIG_DEBUG_PREEMPT extern unsigned int debug_smp_processor_id(void); # define smp_processor_id() debug_smp_processor_id() |
1da177e4c Linux-2.6.12-rc2 |
162 |
#else |
39c715b71 [PATCH] smp_proce... |
163 |
# define smp_processor_id() raw_smp_processor_id() |
1da177e4c Linux-2.6.12-rc2 |
164 165 166 167 |
#endif #define get_cpu() ({ preempt_disable(); smp_processor_id(); }) #define put_cpu() preempt_enable() |
1da177e4c Linux-2.6.12-rc2 |
168 |
|
a146649bc smp, generic: int... |
169 170 171 172 173 |
/* * Callback to arch code if there's nosmp or maxcpus=0 on the * boot command line: */ extern void arch_disable_smp_support(void); |
033ab7f8e [PATCH] add smp_s... |
174 |
void smp_setup_processor_id(void); |
1da177e4c Linux-2.6.12-rc2 |
175 |
#endif /* __LINUX_SMP_H */ |