diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-06 10:44:14 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-06 10:45:01 -0500 |
commit | f0ef03985130287c6c84ebe69416cf790e6cc00e (patch) | |
tree | 3ecb04cc4d82e5fc3ae5f1747e6da172ae8cbcb7 /include/asm-generic | |
parent | 16097439703bcd38e9fe5608c12add6dacb825ea (diff) | |
parent | 31bbed527e7039203920c51c9fb48c27aed0820c (diff) |
Merge branch 'x86/core' into tracing/textedit
Conflicts:
arch/x86/Kconfig
block/blktrace.c
kernel/irq/handle.c
Semantic conflict:
kernel/trace/blktrace.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/percpu.h | 52 | ||||
-rw-r--r-- | include/asm-generic/sections.h | 2 | ||||
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 55 |
3 files changed, 104 insertions, 5 deletions
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index b0e63c672ebd..00f45ff081a6 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
@@ -80,4 +80,56 @@ extern void setup_per_cpu_areas(void); | |||
80 | #define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \ | 80 | #define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \ |
81 | __typeof__(type) per_cpu_var(name) | 81 | __typeof__(type) per_cpu_var(name) |
82 | 82 | ||
83 | /* | ||
84 | * Optional methods for optimized non-lvalue per-cpu variable access. | ||
85 | * | ||
86 | * @var can be a percpu variable or a field of it and its size should | ||
87 | * equal char, int or long. percpu_read() evaluates to a lvalue and | ||
88 | * all others to void. | ||
89 | * | ||
90 | * These operations are guaranteed to be atomic w.r.t. preemption. | ||
91 | * The generic versions use plain get/put_cpu_var(). Archs are | ||
92 | * encouraged to implement single-instruction alternatives which don't | ||
93 | * require preemption protection. | ||
94 | */ | ||
95 | #ifndef percpu_read | ||
96 | # define percpu_read(var) \ | ||
97 | ({ \ | ||
98 | typeof(per_cpu_var(var)) __tmp_var__; \ | ||
99 | __tmp_var__ = get_cpu_var(var); \ | ||
100 | put_cpu_var(var); \ | ||
101 | __tmp_var__; \ | ||
102 | }) | ||
103 | #endif | ||
104 | |||
105 | #define __percpu_generic_to_op(var, val, op) \ | ||
106 | do { \ | ||
107 | get_cpu_var(var) op val; \ | ||
108 | put_cpu_var(var); \ | ||
109 | } while (0) | ||
110 | |||
111 | #ifndef percpu_write | ||
112 | # define percpu_write(var, val) __percpu_generic_to_op(var, (val), =) | ||
113 | #endif | ||
114 | |||
115 | #ifndef percpu_add | ||
116 | # define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=) | ||
117 | #endif | ||
118 | |||
119 | #ifndef percpu_sub | ||
120 | # define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=) | ||
121 | #endif | ||
122 | |||
123 | #ifndef percpu_and | ||
124 | # define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=) | ||
125 | #endif | ||
126 | |||
127 | #ifndef percpu_or | ||
128 | # define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=) | ||
129 | #endif | ||
130 | |||
131 | #ifndef percpu_xor | ||
132 | # define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=) | ||
133 | #endif | ||
134 | |||
83 | #endif /* _ASM_GENERIC_PERCPU_H_ */ | 135 | #endif /* _ASM_GENERIC_PERCPU_H_ */ |
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 79a7ff925bf8..4ce48e878530 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h | |||
@@ -9,7 +9,7 @@ extern char __bss_start[], __bss_stop[]; | |||
9 | extern char __init_begin[], __init_end[]; | 9 | extern char __init_begin[], __init_end[]; |
10 | extern char _sinittext[], _einittext[]; | 10 | extern char _sinittext[], _einittext[]; |
11 | extern char _end[]; | 11 | extern char _end[]; |
12 | extern char __per_cpu_start[], __per_cpu_end[]; | 12 | extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; |
13 | extern char __kprobes_text_start[], __kprobes_text_end[]; | 13 | extern char __kprobes_text_start[], __kprobes_text_end[]; |
14 | extern char __initdata_begin[], __initdata_end[]; | 14 | extern char __initdata_begin[], __initdata_end[]; |
15 | extern char __start_rodata[], __end_rodata[]; | 15 | extern char __start_rodata[], __end_rodata[]; |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 0add6b28c366..9d974914e914 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -439,12 +439,59 @@ | |||
439 | *(.initcall7.init) \ | 439 | *(.initcall7.init) \ |
440 | *(.initcall7s.init) | 440 | *(.initcall7s.init) |
441 | 441 | ||
442 | /** | ||
443 | * PERCPU_VADDR - define output section for percpu area | ||
444 | * @vaddr: explicit base address (optional) | ||
445 | * @phdr: destination PHDR (optional) | ||
446 | * | ||
447 | * Macro which expands to output section for percpu area. If @vaddr | ||
448 | * is not blank, it specifies explicit base address and all percpu | ||
449 | * symbols will be offset from the given address. If blank, @vaddr | ||
450 | * always equals @laddr + LOAD_OFFSET. | ||
451 | * | ||
452 | * @phdr defines the output PHDR to use if not blank. Be warned that | ||
453 | * output PHDR is sticky. If @phdr is specified, the next output | ||
454 | * section in the linker script will go there too. @phdr should have | ||
455 | * a leading colon. | ||
456 | * | ||
457 | * Note that this macros defines __per_cpu_load as an absolute symbol. | ||
458 | * If there is no need to put the percpu section at a predetermined | ||
459 | * address, use PERCPU(). | ||
460 | */ | ||
461 | #define PERCPU_VADDR(vaddr, phdr) \ | ||
462 | VMLINUX_SYMBOL(__per_cpu_load) = .; \ | ||
463 | .data.percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \ | ||
464 | - LOAD_OFFSET) { \ | ||
465 | VMLINUX_SYMBOL(__per_cpu_start) = .; \ | ||
466 | *(.data.percpu.first) \ | ||
467 | *(.data.percpu.page_aligned) \ | ||
468 | *(.data.percpu) \ | ||
469 | *(.data.percpu.shared_aligned) \ | ||
470 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ | ||
471 | } phdr \ | ||
472 | . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data.percpu); | ||
473 | |||
474 | /** | ||
475 | * PERCPU - define output section for percpu area, simple version | ||
476 | * @align: required alignment | ||
477 | * | ||
478 | * Align to @align and outputs output section for percpu area. This | ||
479 | * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and | ||
480 | * __per_cpu_start will be identical. | ||
481 | * | ||
482 | * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except | ||
483 | * that __per_cpu_load is defined as a relative symbol against | ||
484 | * .data.percpu which is required for relocatable x86_32 | ||
485 | * configuration. | ||
486 | */ | ||
442 | #define PERCPU(align) \ | 487 | #define PERCPU(align) \ |
443 | . = ALIGN(align); \ | 488 | . = ALIGN(align); \ |
444 | VMLINUX_SYMBOL(__per_cpu_start) = .; \ | 489 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ |
445 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ | 490 | VMLINUX_SYMBOL(__per_cpu_load) = .; \ |
491 | VMLINUX_SYMBOL(__per_cpu_start) = .; \ | ||
492 | *(.data.percpu.first) \ | ||
446 | *(.data.percpu.page_aligned) \ | 493 | *(.data.percpu.page_aligned) \ |
447 | *(.data.percpu) \ | 494 | *(.data.percpu) \ |
448 | *(.data.percpu.shared_aligned) \ | 495 | *(.data.percpu.shared_aligned) \ |
449 | } \ | 496 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ |
450 | VMLINUX_SYMBOL(__per_cpu_end) = .; | 497 | } |