-
Notifications
You must be signed in to change notification settings - Fork 0
percpu
https://elixir.bootlin.com/linux/v5.7/source/include/linux/percpu-defs.h#L111
#define DECLARE_PER_CPU(type, name) \
DECLARE_PER_CPU_SECTION(type, name, "")
https://elixir.bootlin.com/linux/v5.7/source/include/linux/percpu-defs.h#L100
#define DECLARE_PER_CPU_SECTION(type, name, sec) \
extern __PCPU_ATTRS(sec) __typeof__(type) name
https://elixir.bootlin.com/linux/v5.7/source/include/linux/percpu-defs.h#L49
#define __PCPU_ATTRS(sec) \
__percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \
PER_CPU_ATTRIBUTES
https://elixir.bootlin.com/linux/v5.7/source/include/linux/compiler_types.h#L46 (see https://en.wikipedia.org/wiki/Sparse )
# define __percpu
https://elixir.bootlin.com/linux/v5.7/source/include/asm-generic/percpu.h#L55
#define PER_CPU_BASE_SECTION ".data..percpu"
https://elixir.bootlin.com/linux/v5.7/source/include/asm-generic/percpu.h#L62
#define PER_CPU_ATTRIBUTES
https://elixir.bootlin.com/linux/v5.7/source/arch/x86/include/asm/percpu.h#L392
#define this_cpu_read_stable(var) percpu_stable_op("mov", var)
https://elixir.bootlin.com/linux/v5.7/source/arch/x86/include/asm/percpu.h#L212
#define percpu_stable_op(op, var) \
({ \
typeof(var) pfo_ret__; \
switch (sizeof(var)) { \
case 1: \
asm(op "b "__percpu_arg(P1)",%0" \
: "=q" (pfo_ret__) \
: "p" (&(var))); \
break; \
case 2: \
asm(op "w "__percpu_arg(P1)",%0" \
: "=r" (pfo_ret__) \
: "p" (&(var))); \
break; \
case 4: \
asm(op "l "__percpu_arg(P1)",%0" \
: "=r" (pfo_ret__) \
: "p" (&(var))); \
break; \
case 8: \
asm(op "q "__percpu_arg(P1)",%0" \
: "=r" (pfo_ret__) \
: "p" (&(var))); \
break; \
default: __bad_percpu_size(); \
} \
pfo_ret__; \
})
https://elixir.bootlin.com/linux/v5.7/source/arch/x86/include/asm/percpu.h#L68
#define __percpu_arg(x) __percpu_prefix "%" #x
https://elixir.bootlin.com/linux/v5.7/source/arch/x86/include/asm/percpu.h#L49
#define __percpu_prefix "%%"__stringify(__percpu_seg)":"
https://elixir.bootlin.com/linux/v5.7/source/arch/x86/include/asm/percpu.h#L6
#define __percpu_seg gs