Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * linux/percpu-defs.h - basic definitions for percpu areas
0004  *
0005  * DO NOT INCLUDE DIRECTLY OUTSIDE PERCPU IMPLEMENTATION PROPER.
0006  *
0007  * This file is separate from linux/percpu.h to avoid cyclic inclusion
0008  * dependency from arch header files.  Only to be included from
0009  * asm/percpu.h.
0010  *
0011  * This file includes macros necessary to declare percpu sections and
0012  * variables, and definitions of percpu accessors and operations.  It
0013  * should provide enough percpu features to arch header files even when
0014  * they can only include asm/percpu.h to avoid cyclic inclusion dependency.
0015  */
0016 
0017 #ifndef _LINUX_PERCPU_DEFS_H
0018 #define _LINUX_PERCPU_DEFS_H
0019 
0020 #ifdef CONFIG_SMP
0021 
0022 #ifdef MODULE
0023 #define PER_CPU_SHARED_ALIGNED_SECTION ""
0024 #define PER_CPU_ALIGNED_SECTION ""
0025 #else
0026 #define PER_CPU_SHARED_ALIGNED_SECTION "..shared_aligned"
0027 #define PER_CPU_ALIGNED_SECTION "..shared_aligned"
0028 #endif
0029 #define PER_CPU_FIRST_SECTION "..first"
0030 
0031 #else
0032 
0033 #define PER_CPU_SHARED_ALIGNED_SECTION ""
0034 #define PER_CPU_ALIGNED_SECTION "..shared_aligned"
0035 #define PER_CPU_FIRST_SECTION ""
0036 
0037 #endif
0038 
0039 /*
0040  * Base implementations of per-CPU variable declarations and definitions, where
0041  * the section in which the variable is to be placed is provided by the
0042  * 'sec' argument.  This may be used to affect the parameters governing the
0043  * variable's storage.
0044  *
0045  * NOTE!  The sections for the DECLARE and for the DEFINE must match, lest
0046  * linkage errors occur due the compiler generating the wrong code to access
0047  * that section.
0048  */
0049 #define __PCPU_ATTRS(sec)                       \
0050     __percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \
0051     PER_CPU_ATTRIBUTES
0052 
0053 #define __PCPU_DUMMY_ATTRS                      \
0054     __section(".discard") __attribute__((unused))
0055 
0056 /*
0057  * s390 and alpha modules require percpu variables to be defined as
0058  * weak to force the compiler to generate GOT based external
0059  * references for them.  This is necessary because percpu sections
0060  * will be located outside of the usually addressable area.
0061  *
0062  * This definition puts the following two extra restrictions when
0063  * defining percpu variables.
0064  *
0065  * 1. The symbol must be globally unique, even the static ones.
0066  * 2. Static percpu variables cannot be defined inside a function.
0067  *
0068  * Archs which need weak percpu definitions should define
0069  * ARCH_NEEDS_WEAK_PER_CPU in asm/percpu.h when necessary.
0070  *
0071  * To ensure that the generic code observes the above two
0072  * restrictions, if CONFIG_DEBUG_FORCE_WEAK_PER_CPU is set weak
0073  * definition is used for all cases.
0074  */
0075 #if defined(ARCH_NEEDS_WEAK_PER_CPU) || defined(CONFIG_DEBUG_FORCE_WEAK_PER_CPU)
0076 /*
0077  * __pcpu_scope_* dummy variable is used to enforce scope.  It
0078  * receives the static modifier when it's used in front of
0079  * DEFINE_PER_CPU() and will trigger build failure if
0080  * DECLARE_PER_CPU() is used for the same variable.
0081  *
0082  * __pcpu_unique_* dummy variable is used to enforce symbol uniqueness
0083  * such that hidden weak symbol collision, which will cause unrelated
0084  * variables to share the same address, can be detected during build.
0085  */
0086 #define DECLARE_PER_CPU_SECTION(type, name, sec)            \
0087     extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name;     \
0088     extern __PCPU_ATTRS(sec) __typeof__(type) name
0089 
0090 #define DEFINE_PER_CPU_SECTION(type, name, sec)             \
0091     __PCPU_DUMMY_ATTRS char __pcpu_scope_##name;            \
0092     extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name;        \
0093     __PCPU_DUMMY_ATTRS char __pcpu_unique_##name;           \
0094     extern __PCPU_ATTRS(sec) __typeof__(type) name;         \
0095     __PCPU_ATTRS(sec) __weak __typeof__(type) name
0096 #else
0097 /*
0098  * Normal declaration and definition macros.
0099  */
0100 #define DECLARE_PER_CPU_SECTION(type, name, sec)            \
0101     extern __PCPU_ATTRS(sec) __typeof__(type) name
0102 
0103 #define DEFINE_PER_CPU_SECTION(type, name, sec)             \
0104     __PCPU_ATTRS(sec) __typeof__(type) name
0105 #endif
0106 
0107 /*
0108  * Variant on the per-CPU variable declaration/definition theme used for
0109  * ordinary per-CPU variables.
0110  */
0111 #define DECLARE_PER_CPU(type, name)                 \
0112     DECLARE_PER_CPU_SECTION(type, name, "")
0113 
0114 #define DEFINE_PER_CPU(type, name)                  \
0115     DEFINE_PER_CPU_SECTION(type, name, "")
0116 
0117 /*
0118  * Declaration/definition used for per-CPU variables that must come first in
0119  * the set of variables.
0120  */
0121 #define DECLARE_PER_CPU_FIRST(type, name)               \
0122     DECLARE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION)
0123 
0124 #define DEFINE_PER_CPU_FIRST(type, name)                \
0125     DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION)
0126 
0127 /*
0128  * Declaration/definition used for per-CPU variables that must be cacheline
0129  * aligned under SMP conditions so that, whilst a particular instance of the
0130  * data corresponds to a particular CPU, inefficiencies due to direct access by
0131  * other CPUs are reduced by preventing the data from unnecessarily spanning
0132  * cachelines.
0133  *
0134  * An example of this would be statistical data, where each CPU's set of data
0135  * is updated by that CPU alone, but the data from across all CPUs is collated
0136  * by a CPU processing a read from a proc file.
0137  */
0138 #define DECLARE_PER_CPU_SHARED_ALIGNED(type, name)          \
0139     DECLARE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
0140     ____cacheline_aligned_in_smp
0141 
0142 #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name)           \
0143     DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
0144     ____cacheline_aligned_in_smp
0145 
0146 #define DECLARE_PER_CPU_ALIGNED(type, name)             \
0147     DECLARE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION)    \
0148     ____cacheline_aligned
0149 
0150 #define DEFINE_PER_CPU_ALIGNED(type, name)              \
0151     DEFINE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION) \
0152     ____cacheline_aligned
0153 
0154 /*
0155  * Declaration/definition used for per-CPU variables that must be page aligned.
0156  */
0157 #define DECLARE_PER_CPU_PAGE_ALIGNED(type, name)            \
0158     DECLARE_PER_CPU_SECTION(type, name, "..page_aligned")       \
0159     __aligned(PAGE_SIZE)
0160 
0161 #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name)             \
0162     DEFINE_PER_CPU_SECTION(type, name, "..page_aligned")        \
0163     __aligned(PAGE_SIZE)
0164 
0165 /*
0166  * Declaration/definition used for per-CPU variables that must be read mostly.
0167  */
0168 #define DECLARE_PER_CPU_READ_MOSTLY(type, name)         \
0169     DECLARE_PER_CPU_SECTION(type, name, "..read_mostly")
0170 
0171 #define DEFINE_PER_CPU_READ_MOSTLY(type, name)              \
0172     DEFINE_PER_CPU_SECTION(type, name, "..read_mostly")
0173 
0174 /*
0175  * Declaration/definition used for per-CPU variables that should be accessed
0176  * as decrypted when memory encryption is enabled in the guest.
0177  */
0178 #ifdef CONFIG_AMD_MEM_ENCRYPT
0179 #define DECLARE_PER_CPU_DECRYPTED(type, name)               \
0180     DECLARE_PER_CPU_SECTION(type, name, "..decrypted")
0181 
0182 #define DEFINE_PER_CPU_DECRYPTED(type, name)                \
0183     DEFINE_PER_CPU_SECTION(type, name, "..decrypted")
0184 #else
0185 #define DEFINE_PER_CPU_DECRYPTED(type, name)    DEFINE_PER_CPU(type, name)
0186 #endif
0187 
0188 /*
0189  * Intermodule exports for per-CPU variables.  sparse forgets about
0190  * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to
0191  * noop if __CHECKER__.
0192  */
0193 #ifndef __CHECKER__
0194 #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(var)
0195 #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(var)
0196 #else
0197 #define EXPORT_PER_CPU_SYMBOL(var)
0198 #define EXPORT_PER_CPU_SYMBOL_GPL(var)
0199 #endif
0200 
0201 /*
0202  * Accessors and operations.
0203  */
0204 #ifndef __ASSEMBLY__
0205 
0206 /*
0207  * __verify_pcpu_ptr() verifies @ptr is a percpu pointer without evaluating
0208  * @ptr and is invoked once before a percpu area is accessed by all
0209  * accessors and operations.  This is performed in the generic part of
0210  * percpu and arch overrides don't need to worry about it; however, if an
0211  * arch wants to implement an arch-specific percpu accessor or operation,
0212  * it may use __verify_pcpu_ptr() to verify the parameters.
0213  *
0214  * + 0 is required in order to convert the pointer type from a
0215  * potential array type to a pointer to a single item of the array.
0216  */
0217 #define __verify_pcpu_ptr(ptr)                      \
0218 do {                                    \
0219     const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
0220     (void)__vpp_verify;                     \
0221 } while (0)
0222 
0223 #ifdef CONFIG_SMP
0224 
0225 /*
0226  * Add an offset to a pointer but keep the pointer as-is.  Use RELOC_HIDE()
0227  * to prevent the compiler from making incorrect assumptions about the
0228  * pointer value.  The weird cast keeps both GCC and sparse happy.
0229  */
0230 #define SHIFT_PERCPU_PTR(__p, __offset)                 \
0231     RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset))
0232 
0233 #define per_cpu_ptr(ptr, cpu)                       \
0234 ({                                  \
0235     __verify_pcpu_ptr(ptr);                     \
0236     SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)));         \
0237 })
0238 
0239 #define raw_cpu_ptr(ptr)                        \
0240 ({                                  \
0241     __verify_pcpu_ptr(ptr);                     \
0242     arch_raw_cpu_ptr(ptr);                      \
0243 })
0244 
0245 #ifdef CONFIG_DEBUG_PREEMPT
0246 #define this_cpu_ptr(ptr)                       \
0247 ({                                  \
0248     __verify_pcpu_ptr(ptr);                     \
0249     SHIFT_PERCPU_PTR(ptr, my_cpu_offset);               \
0250 })
0251 #else
0252 #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
0253 #endif
0254 
0255 #else   /* CONFIG_SMP */
0256 
0257 #define VERIFY_PERCPU_PTR(__p)                      \
0258 ({                                  \
0259     __verify_pcpu_ptr(__p);                     \
0260     (typeof(*(__p)) __kernel __force *)(__p);           \
0261 })
0262 
0263 #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
0264 #define raw_cpu_ptr(ptr)    per_cpu_ptr(ptr, 0)
0265 #define this_cpu_ptr(ptr)   raw_cpu_ptr(ptr)
0266 
0267 #endif  /* CONFIG_SMP */
0268 
0269 #define per_cpu(var, cpu)   (*per_cpu_ptr(&(var), cpu))
0270 
0271 /*
0272  * Must be an lvalue. Since @var must be a simple identifier,
0273  * we force a syntax error here if it isn't.
0274  */
0275 #define get_cpu_var(var)                        \
0276 (*({                                    \
0277     preempt_disable();                      \
0278     this_cpu_ptr(&var);                     \
0279 }))
0280 
0281 /*
0282  * The weird & is necessary because sparse considers (void)(var) to be
0283  * a direct dereference of percpu variable (var).
0284  */
0285 #define put_cpu_var(var)                        \
0286 do {                                    \
0287     (void)&(var);                           \
0288     preempt_enable();                       \
0289 } while (0)
0290 
0291 #define get_cpu_ptr(var)                        \
0292 ({                                  \
0293     preempt_disable();                      \
0294     this_cpu_ptr(var);                      \
0295 })
0296 
0297 #define put_cpu_ptr(var)                        \
0298 do {                                    \
0299     (void)(var);                            \
0300     preempt_enable();                       \
0301 } while (0)
0302 
0303 /*
0304  * Branching function to split up a function into a set of functions that
0305  * are called for different scalar sizes of the objects handled.
0306  */
0307 
0308 extern void __bad_size_call_parameter(void);
0309 
0310 #ifdef CONFIG_DEBUG_PREEMPT
0311 extern void __this_cpu_preempt_check(const char *op);
0312 #else
0313 static inline void __this_cpu_preempt_check(const char *op) { }
0314 #endif
0315 
0316 #define __pcpu_size_call_return(stem, variable)             \
0317 ({                                  \
0318     typeof(variable) pscr_ret__;                    \
0319     __verify_pcpu_ptr(&(variable));                 \
0320     switch(sizeof(variable)) {                  \
0321     case 1: pscr_ret__ = stem##1(variable); break;          \
0322     case 2: pscr_ret__ = stem##2(variable); break;          \
0323     case 4: pscr_ret__ = stem##4(variable); break;          \
0324     case 8: pscr_ret__ = stem##8(variable); break;          \
0325     default:                            \
0326         __bad_size_call_parameter(); break;         \
0327     }                               \
0328     pscr_ret__;                         \
0329 })
0330 
0331 #define __pcpu_size_call_return2(stem, variable, ...)           \
0332 ({                                  \
0333     typeof(variable) pscr2_ret__;                   \
0334     __verify_pcpu_ptr(&(variable));                 \
0335     switch(sizeof(variable)) {                  \
0336     case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break;    \
0337     case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break;    \
0338     case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break;    \
0339     case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break;    \
0340     default:                            \
0341         __bad_size_call_parameter(); break;         \
0342     }                               \
0343     pscr2_ret__;                            \
0344 })
0345 
0346 /*
0347  * Special handling for cmpxchg_double.  cmpxchg_double is passed two
0348  * percpu variables.  The first has to be aligned to a double word
0349  * boundary and the second has to follow directly thereafter.
0350  * We enforce this on all architectures even if they don't support
0351  * a double cmpxchg instruction, since it's a cheap requirement, and it
0352  * avoids breaking the requirement for architectures with the instruction.
0353  */
0354 #define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...)       \
0355 ({                                  \
0356     bool pdcrb_ret__;                       \
0357     __verify_pcpu_ptr(&(pcp1));                 \
0358     BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2));         \
0359     VM_BUG_ON((unsigned long)(&(pcp1)) % (2 * sizeof(pcp1)));   \
0360     VM_BUG_ON((unsigned long)(&(pcp2)) !=               \
0361           (unsigned long)(&(pcp1)) + sizeof(pcp1));     \
0362     switch(sizeof(pcp1)) {                      \
0363     case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break;  \
0364     case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break;  \
0365     case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break;  \
0366     case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break;  \
0367     default:                            \
0368         __bad_size_call_parameter(); break;         \
0369     }                               \
0370     pdcrb_ret__;                            \
0371 })
0372 
0373 #define __pcpu_size_call(stem, variable, ...)               \
0374 do {                                    \
0375     __verify_pcpu_ptr(&(variable));                 \
0376     switch(sizeof(variable)) {                  \
0377         case 1: stem##1(variable, __VA_ARGS__);break;       \
0378         case 2: stem##2(variable, __VA_ARGS__);break;       \
0379         case 4: stem##4(variable, __VA_ARGS__);break;       \
0380         case 8: stem##8(variable, __VA_ARGS__);break;       \
0381         default:                        \
0382             __bad_size_call_parameter();break;      \
0383     }                               \
0384 } while (0)
0385 
0386 /*
0387  * this_cpu operations (C) 2008-2013 Christoph Lameter <cl@linux.com>
0388  *
0389  * Optimized manipulation for memory allocated through the per cpu
0390  * allocator or for addresses of per cpu variables.
0391  *
0392  * These operation guarantee exclusivity of access for other operations
0393  * on the *same* processor. The assumption is that per cpu data is only
0394  * accessed by a single processor instance (the current one).
0395  *
0396  * The arch code can provide optimized implementation by defining macros
0397  * for certain scalar sizes. F.e. provide this_cpu_add_2() to provide per
0398  * cpu atomic operations for 2 byte sized RMW actions. If arch code does
0399  * not provide operations for a scalar size then the fallback in the
0400  * generic code will be used.
0401  *
0402  * cmpxchg_double replaces two adjacent scalars at once.  The first two
0403  * parameters are per cpu variables which have to be of the same size.  A
0404  * truth value is returned to indicate success or failure (since a double
0405  * register result is difficult to handle).  There is very limited hardware
0406  * support for these operations, so only certain sizes may work.
0407  */
0408 
0409 /*
0410  * Operations for contexts where we do not want to do any checks for
0411  * preemptions.  Unless strictly necessary, always use [__]this_cpu_*()
0412  * instead.
0413  *
0414  * If there is no other protection through preempt disable and/or disabling
0415  * interrupts then one of these RMW operations can show unexpected behavior
0416  * because the execution thread was rescheduled on another processor or an
0417  * interrupt occurred and the same percpu variable was modified from the
0418  * interrupt context.
0419  */
0420 #define raw_cpu_read(pcp)       __pcpu_size_call_return(raw_cpu_read_, pcp)
0421 #define raw_cpu_write(pcp, val)     __pcpu_size_call(raw_cpu_write_, pcp, val)
0422 #define raw_cpu_add(pcp, val)       __pcpu_size_call(raw_cpu_add_, pcp, val)
0423 #define raw_cpu_and(pcp, val)       __pcpu_size_call(raw_cpu_and_, pcp, val)
0424 #define raw_cpu_or(pcp, val)        __pcpu_size_call(raw_cpu_or_, pcp, val)
0425 #define raw_cpu_add_return(pcp, val)    __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val)
0426 #define raw_cpu_xchg(pcp, nval)     __pcpu_size_call_return2(raw_cpu_xchg_, pcp, nval)
0427 #define raw_cpu_cmpxchg(pcp, oval, nval) \
0428     __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval)
0429 #define raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
0430     __pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2)
0431 
0432 #define raw_cpu_sub(pcp, val)       raw_cpu_add(pcp, -(val))
0433 #define raw_cpu_inc(pcp)        raw_cpu_add(pcp, 1)
0434 #define raw_cpu_dec(pcp)        raw_cpu_sub(pcp, 1)
0435 #define raw_cpu_sub_return(pcp, val)    raw_cpu_add_return(pcp, -(typeof(pcp))(val))
0436 #define raw_cpu_inc_return(pcp)     raw_cpu_add_return(pcp, 1)
0437 #define raw_cpu_dec_return(pcp)     raw_cpu_add_return(pcp, -1)
0438 
0439 /*
0440  * Operations for contexts that are safe from preemption/interrupts.  These
0441  * operations verify that preemption is disabled.
0442  */
0443 #define __this_cpu_read(pcp)                        \
0444 ({                                  \
0445     __this_cpu_preempt_check("read");               \
0446     raw_cpu_read(pcp);                      \
0447 })
0448 
0449 #define __this_cpu_write(pcp, val)                  \
0450 ({                                  \
0451     __this_cpu_preempt_check("write");              \
0452     raw_cpu_write(pcp, val);                    \
0453 })
0454 
0455 #define __this_cpu_add(pcp, val)                    \
0456 ({                                  \
0457     __this_cpu_preempt_check("add");                \
0458     raw_cpu_add(pcp, val);                      \
0459 })
0460 
0461 #define __this_cpu_and(pcp, val)                    \
0462 ({                                  \
0463     __this_cpu_preempt_check("and");                \
0464     raw_cpu_and(pcp, val);                      \
0465 })
0466 
0467 #define __this_cpu_or(pcp, val)                     \
0468 ({                                  \
0469     __this_cpu_preempt_check("or");                 \
0470     raw_cpu_or(pcp, val);                       \
0471 })
0472 
0473 #define __this_cpu_add_return(pcp, val)                 \
0474 ({                                  \
0475     __this_cpu_preempt_check("add_return");             \
0476     raw_cpu_add_return(pcp, val);                   \
0477 })
0478 
0479 #define __this_cpu_xchg(pcp, nval)                  \
0480 ({                                  \
0481     __this_cpu_preempt_check("xchg");               \
0482     raw_cpu_xchg(pcp, nval);                    \
0483 })
0484 
0485 #define __this_cpu_cmpxchg(pcp, oval, nval)             \
0486 ({                                  \
0487     __this_cpu_preempt_check("cmpxchg");                \
0488     raw_cpu_cmpxchg(pcp, oval, nval);               \
0489 })
0490 
0491 #define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
0492 ({  __this_cpu_preempt_check("cmpxchg_double");         \
0493     raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2); \
0494 })
0495 
0496 #define __this_cpu_sub(pcp, val)    __this_cpu_add(pcp, -(typeof(pcp))(val))
0497 #define __this_cpu_inc(pcp)     __this_cpu_add(pcp, 1)
0498 #define __this_cpu_dec(pcp)     __this_cpu_sub(pcp, 1)
0499 #define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val))
0500 #define __this_cpu_inc_return(pcp)  __this_cpu_add_return(pcp, 1)
0501 #define __this_cpu_dec_return(pcp)  __this_cpu_add_return(pcp, -1)
0502 
0503 /*
0504  * Operations with implied preemption/interrupt protection.  These
0505  * operations can be used without worrying about preemption or interrupt.
0506  */
0507 #define this_cpu_read(pcp)      __pcpu_size_call_return(this_cpu_read_, pcp)
0508 #define this_cpu_write(pcp, val)    __pcpu_size_call(this_cpu_write_, pcp, val)
0509 #define this_cpu_add(pcp, val)      __pcpu_size_call(this_cpu_add_, pcp, val)
0510 #define this_cpu_and(pcp, val)      __pcpu_size_call(this_cpu_and_, pcp, val)
0511 #define this_cpu_or(pcp, val)       __pcpu_size_call(this_cpu_or_, pcp, val)
0512 #define this_cpu_add_return(pcp, val)   __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
0513 #define this_cpu_xchg(pcp, nval)    __pcpu_size_call_return2(this_cpu_xchg_, pcp, nval)
0514 #define this_cpu_cmpxchg(pcp, oval, nval) \
0515     __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)
0516 #define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
0517     __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2)
0518 
0519 #define this_cpu_sub(pcp, val)      this_cpu_add(pcp, -(typeof(pcp))(val))
0520 #define this_cpu_inc(pcp)       this_cpu_add(pcp, 1)
0521 #define this_cpu_dec(pcp)       this_cpu_sub(pcp, 1)
0522 #define this_cpu_sub_return(pcp, val)   this_cpu_add_return(pcp, -(typeof(pcp))(val))
0523 #define this_cpu_inc_return(pcp)    this_cpu_add_return(pcp, 1)
0524 #define this_cpu_dec_return(pcp)    this_cpu_add_return(pcp, -1)
0525 
0526 #endif /* __ASSEMBLY__ */
0527 #endif /* _LINUX_PERCPU_DEFS_H */