~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/smp.h

Version: ~ [ linux-5.8-rc4 ] ~ [ linux-5.7.7 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.50 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.131 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.187 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.229 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.229 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef __LINUX_SMP_H
  2 #define __LINUX_SMP_H
  3 
  4 /*
  5  *      Generic SMP support
  6  *              Alan Cox. <alan@redhat.com>
  7  */
  8 
  9 #include <linux/config.h>
 10 
 11 #ifdef CONFIG_SMP
 12 
 13 #include <linux/preempt.h>
 14 #include <linux/kernel.h>
 15 #include <linux/compiler.h>
 16 #include <linux/thread_info.h>
 17 #include <asm/smp.h>
 18 #include <asm/bug.h>
 19 
 20 /*
 21  * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc.
 22  * (defined in asm header):
 23  */ 
 24 
 25 /*
 26  * stops all CPUs but the current one:
 27  */
 28 extern void smp_send_stop(void);
 29 
 30 /*
 31  * sends a 'reschedule' event to another CPU:
 32  */
 33 extern void FASTCALL(smp_send_reschedule(int cpu));
 34 
 35 
 36 /*
 37  * Prepare machine for booting other CPUs.
 38  */
 39 extern void smp_prepare_cpus(unsigned int max_cpus);
 40 
 41 /*
 42  * Bring a CPU up
 43  */
 44 extern int __cpu_up(unsigned int cpunum);
 45 
 46 /*
 47  * Final polishing of CPUs
 48  */
 49 extern void smp_cpus_done(unsigned int max_cpus);
 50 
 51 /*
 52  * Call a function on all other processors
 53  */
 54 extern int smp_call_function (void (*func) (void *info), void *info,
 55                               int retry, int wait);
 56 
 57 /*
 58  * Call a function on all processors
 59  */
 60 static inline int on_each_cpu(void (*func) (void *info), void *info,
 61                               int retry, int wait)
 62 {
 63         int ret = 0;
 64 
 65         preempt_disable();
 66         ret = smp_call_function(func, info, retry, wait);
 67         func(info);
 68         preempt_enable();
 69         return ret;
 70 }
 71 
 72 /*
 73  * True once the per process idle is forked
 74  */
 75 extern int smp_threads_ready;
 76 
 77 #define MSG_ALL_BUT_SELF        0x8000  /* Assume <32768 CPU's */
 78 #define MSG_ALL                 0x8001
 79 
 80 #define MSG_INVALIDATE_TLB      0x0001  /* Remote processor TLB invalidate */
 81 #define MSG_STOP_CPU            0x0002  /* Sent to shut down slave CPU's
 82                                          * when rebooting
 83                                          */
 84 #define MSG_RESCHEDULE          0x0003  /* Reschedule request from master CPU*/
 85 #define MSG_CALL_FUNCTION       0x0004  /* Call function on all other CPUs */
 86 
 87 /*
 88  * Mark the boot cpu "online" so that it can call console drivers in
 89  * printk() and can access its per-cpu storage.
 90  */
 91 void smp_prepare_boot_cpu(void);
 92 
 93 #else /* !SMP */
 94 
 95 /*
 96  *      These macros fold the SMP functionality into a single CPU system
 97  */
 98  
 99 #define smp_processor_id()                      0
100 #define hard_smp_processor_id()                 0
101 #define smp_threads_ready                       1
102 #define smp_call_function(func,info,retry,wait) ({ 0; })
103 #define on_each_cpu(func,info,retry,wait)       ({ func(info); 0; })
104 static inline void smp_send_reschedule(int cpu) { }
105 #define num_booting_cpus()                      1
106 #define cpu_possible(cpu)                       ({ BUG_ON((cpu) != 0); 1; })
107 #define smp_prepare_boot_cpu()                  do {} while (0)
108 
109 #endif /* !SMP */
110 
111 #define get_cpu()               ({ preempt_disable(); smp_processor_id(); })
112 #define put_cpu()               preempt_enable()
113 #define put_cpu_no_resched()    preempt_enable_no_resched()
114 
115 #endif /* __LINUX_SMP_H */
116 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp