diff options
Diffstat (limited to 'include')
66 files changed, 1888 insertions, 459 deletions
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index a62720a7edc0..ab0b85cf21f3 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
| @@ -144,6 +144,7 @@ void __iomem *acpi_os_map_memory(acpi_physical_address where, | |||
| 144 | acpi_size length); | 144 | acpi_size length); |
| 145 | 145 | ||
| 146 | void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); | 146 | void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); |
| 147 | void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size); | ||
| 147 | 148 | ||
| 148 | #ifdef ACPI_FUTURE_USAGE | 149 | #ifdef ACPI_FUTURE_USAGE |
| 149 | acpi_status | 150 | acpi_status |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index c8e8cf45830f..cc40102fe2f3 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
| @@ -130,6 +130,10 @@ acpi_get_table_header(acpi_string signature, | |||
| 130 | struct acpi_table_header *out_table_header); | 130 | struct acpi_table_header *out_table_header); |
| 131 | 131 | ||
| 132 | acpi_status | 132 | acpi_status |
| 133 | acpi_get_table_with_size(acpi_string signature, | ||
| 134 | u32 instance, struct acpi_table_header **out_table, | ||
| 135 | acpi_size *tbl_size); | ||
| 136 | acpi_status | ||
| 133 | acpi_get_table(acpi_string signature, | 137 | acpi_get_table(acpi_string signature, |
| 134 | u32 instance, struct acpi_table_header **out_table); | 138 | u32 instance, struct acpi_table_header **out_table); |
| 135 | 139 | ||
diff --git a/include/asm-frv/ftrace.h b/include/asm-frv/ftrace.h new file mode 100644 index 000000000000..40a8c178f10d --- /dev/null +++ b/include/asm-frv/ftrace.h | |||
| @@ -0,0 +1 @@ | |||
| /* empty */ | |||
diff --git a/include/asm-frv/swab.h b/include/asm-frv/swab.h index afb3396ba5ed..f305834b4799 100644 --- a/include/asm-frv/swab.h +++ b/include/asm-frv/swab.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef _ASM_SWAB_H | 1 | #ifndef _ASM_SWAB_H |
| 2 | #define _ASM_SWAB_H | 2 | #define _ASM_SWAB_H |
| 3 | 3 | ||
| 4 | #include <asm/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) | 6 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) |
| 7 | # define __SWAB_64_THRU_32__ | 7 | # define __SWAB_64_THRU_32__ |
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 c61fab1dd2f8..0e0f39be6c8b 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
| @@ -61,6 +61,22 @@ | |||
| 61 | #define BRANCH_PROFILE() | 61 | #define BRANCH_PROFILE() |
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | #ifdef CONFIG_EVENT_TRACER | ||
| 65 | #define FTRACE_EVENTS() VMLINUX_SYMBOL(__start_ftrace_events) = .; \ | ||
| 66 | *(_ftrace_events) \ | ||
| 67 | VMLINUX_SYMBOL(__stop_ftrace_events) = .; | ||
| 68 | #else | ||
| 69 | #define FTRACE_EVENTS() | ||
| 70 | #endif | ||
| 71 | |||
| 72 | #ifdef CONFIG_TRACING | ||
| 73 | #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \ | ||
| 74 | *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \ | ||
| 75 | VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .; | ||
| 76 | #else | ||
| 77 | #define TRACE_PRINTKS() | ||
| 78 | #endif | ||
| 79 | |||
| 64 | /* .data section */ | 80 | /* .data section */ |
| 65 | #define DATA_DATA \ | 81 | #define DATA_DATA \ |
| 66 | *(.data) \ | 82 | *(.data) \ |
| @@ -81,7 +97,9 @@ | |||
| 81 | *(__tracepoints) \ | 97 | *(__tracepoints) \ |
| 82 | VMLINUX_SYMBOL(__stop___tracepoints) = .; \ | 98 | VMLINUX_SYMBOL(__stop___tracepoints) = .; \ |
| 83 | LIKELY_PROFILE() \ | 99 | LIKELY_PROFILE() \ |
| 84 | BRANCH_PROFILE() | 100 | BRANCH_PROFILE() \ |
| 101 | TRACE_PRINTKS() \ | ||
| 102 | FTRACE_EVENTS() | ||
| 85 | 103 | ||
| 86 | #define RO_DATA(align) \ | 104 | #define RO_DATA(align) \ |
| 87 | . = ALIGN((align)); \ | 105 | . = ALIGN((align)); \ |
| @@ -430,12 +448,59 @@ | |||
| 430 | *(.initcall7.init) \ | 448 | *(.initcall7.init) \ |
| 431 | *(.initcall7s.init) | 449 | *(.initcall7s.init) |
| 432 | 450 | ||
| 451 | /** | ||
| 452 | * PERCPU_VADDR - define output section for percpu area | ||
| 453 | * @vaddr: explicit base address (optional) | ||
| 454 | * @phdr: destination PHDR (optional) | ||
| 455 | * | ||
| 456 | * Macro which expands to output section for percpu area. If @vaddr | ||
| 457 | * is not blank, it specifies explicit base address and all percpu | ||
| 458 | * symbols will be offset from the given address. If blank, @vaddr | ||
| 459 | * always equals @laddr + LOAD_OFFSET. | ||
| 460 | * | ||
| 461 | * @phdr defines the output PHDR to use if not blank. Be warned that | ||
| 462 | * output PHDR is sticky. If @phdr is specified, the next output | ||
| 463 | * section in the linker script will go there too. @phdr should have | ||
| 464 | * a leading colon. | ||
| 465 | * | ||
| 466 | * Note that this macros defines __per_cpu_load as an absolute symbol. | ||
| 467 | * If there is no need to put the percpu section at a predetermined | ||
| 468 | * address, use PERCPU(). | ||
| 469 | */ | ||
| 470 | #define PERCPU_VADDR(vaddr, phdr) \ | ||
| 471 | VMLINUX_SYMBOL(__per_cpu_load) = .; \ | ||
| 472 | .data.percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \ | ||
| 473 | - LOAD_OFFSET) { \ | ||
| 474 | VMLINUX_SYMBOL(__per_cpu_start) = .; \ | ||
| 475 | *(.data.percpu.first) \ | ||
| 476 | *(.data.percpu.page_aligned) \ | ||
| 477 | *(.data.percpu) \ | ||
| 478 | *(.data.percpu.shared_aligned) \ | ||
| 479 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ | ||
| 480 | } phdr \ | ||
| 481 | . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data.percpu); | ||
| 482 | |||
| 483 | /** | ||
| 484 | * PERCPU - define output section for percpu area, simple version | ||
| 485 | * @align: required alignment | ||
| 486 | * | ||
| 487 | * Align to @align and outputs output section for percpu area. This | ||
| 488 | * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and | ||
| 489 | * __per_cpu_start will be identical. | ||
| 490 | * | ||
| 491 | * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except | ||
| 492 | * that __per_cpu_load is defined as a relative symbol against | ||
| 493 | * .data.percpu which is required for relocatable x86_32 | ||
| 494 | * configuration. | ||
| 495 | */ | ||
| 433 | #define PERCPU(align) \ | 496 | #define PERCPU(align) \ |
| 434 | . = ALIGN(align); \ | 497 | . = ALIGN(align); \ |
| 435 | VMLINUX_SYMBOL(__per_cpu_start) = .; \ | 498 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ |
| 436 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ | 499 | VMLINUX_SYMBOL(__per_cpu_load) = .; \ |
| 500 | VMLINUX_SYMBOL(__per_cpu_start) = .; \ | ||
| 501 | *(.data.percpu.first) \ | ||
| 437 | *(.data.percpu.page_aligned) \ | 502 | *(.data.percpu.page_aligned) \ |
| 438 | *(.data.percpu) \ | 503 | *(.data.percpu) \ |
| 439 | *(.data.percpu.shared_aligned) \ | 504 | *(.data.percpu.shared_aligned) \ |
| 440 | } \ | 505 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ |
| 441 | VMLINUX_SYMBOL(__per_cpu_end) = .; | 506 | } |
diff --git a/include/asm-m32r/ftrace.h b/include/asm-m32r/ftrace.h new file mode 100644 index 000000000000..40a8c178f10d --- /dev/null +++ b/include/asm-m32r/ftrace.h | |||
| @@ -0,0 +1 @@ | |||
| /* empty */ | |||
diff --git a/include/asm-m32r/swab.h b/include/asm-m32r/swab.h index 97973e101825..54dab001d6d1 100644 --- a/include/asm-m32r/swab.h +++ b/include/asm-m32r/swab.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef _ASM_M32R_SWAB_H | 1 | #ifndef _ASM_M32R_SWAB_H |
| 2 | #define _ASM_M32R_SWAB_H | 2 | #define _ASM_M32R_SWAB_H |
| 3 | 3 | ||
| 4 | #include <asm/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) | 6 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) |
| 7 | # define __SWAB_64_THRU_32__ | 7 | # define __SWAB_64_THRU_32__ |
diff --git a/include/asm-mn10300/ftrace.h b/include/asm-mn10300/ftrace.h new file mode 100644 index 000000000000..40a8c178f10d --- /dev/null +++ b/include/asm-mn10300/ftrace.h | |||
| @@ -0,0 +1 @@ | |||
| /* empty */ | |||
diff --git a/include/asm-mn10300/swab.h b/include/asm-mn10300/swab.h index 4504d1b4b477..bd818a820ca8 100644 --- a/include/asm-mn10300/swab.h +++ b/include/asm-mn10300/swab.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #ifndef _ASM_SWAB_H | 11 | #ifndef _ASM_SWAB_H |
| 12 | #define _ASM_SWAB_H | 12 | #define _ASM_SWAB_H |
| 13 | 13 | ||
| 14 | #include <asm/types.h> | 14 | #include <linux/types.h> |
| 15 | 15 | ||
| 16 | #ifdef __GNUC__ | 16 | #ifdef __GNUC__ |
| 17 | 17 | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6fce2fc2d124..78199151c00b 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -79,6 +79,7 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table); | |||
| 79 | typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); | 79 | typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); |
| 80 | 80 | ||
| 81 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); | 81 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); |
| 82 | void __acpi_unmap_table(char *map, unsigned long size); | ||
| 82 | int early_acpi_boot_init(void); | 83 | int early_acpi_boot_init(void); |
| 83 | int acpi_boot_init (void); | 84 | int acpi_boot_init (void); |
| 84 | int acpi_boot_table_init (void); | 85 | int acpi_boot_table_init (void); |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 6e915878e88c..d960889e92ef 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
| @@ -144,6 +144,9 @@ struct blk_user_trace_setup { | |||
| 144 | 144 | ||
| 145 | #ifdef __KERNEL__ | 145 | #ifdef __KERNEL__ |
| 146 | #if defined(CONFIG_BLK_DEV_IO_TRACE) | 146 | #if defined(CONFIG_BLK_DEV_IO_TRACE) |
| 147 | |||
| 148 | #include <linux/sysfs.h> | ||
| 149 | |||
| 147 | struct blk_trace { | 150 | struct blk_trace { |
| 148 | int trace_state; | 151 | int trace_state; |
| 149 | struct rchan *rchan; | 152 | struct rchan *rchan; |
| @@ -194,6 +197,8 @@ extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, | |||
| 194 | extern int blk_trace_startstop(struct request_queue *q, int start); | 197 | extern int blk_trace_startstop(struct request_queue *q, int start); |
| 195 | extern int blk_trace_remove(struct request_queue *q); | 198 | extern int blk_trace_remove(struct request_queue *q); |
| 196 | 199 | ||
| 200 | extern struct attribute_group blk_trace_attr_group; | ||
| 201 | |||
| 197 | #else /* !CONFIG_BLK_DEV_IO_TRACE */ | 202 | #else /* !CONFIG_BLK_DEV_IO_TRACE */ |
| 198 | #define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) | 203 | #define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) |
| 199 | #define blk_trace_shutdown(q) do { } while (0) | 204 | #define blk_trace_shutdown(q) do { } while (0) |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 95837bfb5256..455d83219fae 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
| @@ -65,23 +65,20 @@ extern void free_bootmem(unsigned long addr, unsigned long size); | |||
| 65 | #define BOOTMEM_DEFAULT 0 | 65 | #define BOOTMEM_DEFAULT 0 |
| 66 | #define BOOTMEM_EXCLUSIVE (1<<0) | 66 | #define BOOTMEM_EXCLUSIVE (1<<0) |
| 67 | 67 | ||
| 68 | extern int reserve_bootmem(unsigned long addr, | ||
| 69 | unsigned long size, | ||
| 70 | int flags); | ||
| 68 | extern int reserve_bootmem_node(pg_data_t *pgdat, | 71 | extern int reserve_bootmem_node(pg_data_t *pgdat, |
| 69 | unsigned long physaddr, | 72 | unsigned long physaddr, |
| 70 | unsigned long size, | 73 | unsigned long size, |
| 71 | int flags); | 74 | int flags); |
| 72 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | ||
| 73 | extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags); | ||
| 74 | #endif | ||
| 75 | 75 | ||
| 76 | extern void *__alloc_bootmem_nopanic(unsigned long size, | 76 | extern void *__alloc_bootmem(unsigned long size, |
| 77 | unsigned long align, | 77 | unsigned long align, |
| 78 | unsigned long goal); | 78 | unsigned long goal); |
| 79 | extern void *__alloc_bootmem(unsigned long size, | 79 | extern void *__alloc_bootmem_nopanic(unsigned long size, |
| 80 | unsigned long align, | 80 | unsigned long align, |
| 81 | unsigned long goal); | 81 | unsigned long goal); |
| 82 | extern void *__alloc_bootmem_low(unsigned long size, | ||
| 83 | unsigned long align, | ||
| 84 | unsigned long goal); | ||
| 85 | extern void *__alloc_bootmem_node(pg_data_t *pgdat, | 82 | extern void *__alloc_bootmem_node(pg_data_t *pgdat, |
| 86 | unsigned long size, | 83 | unsigned long size, |
| 87 | unsigned long align, | 84 | unsigned long align, |
| @@ -90,30 +87,35 @@ extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat, | |||
| 90 | unsigned long size, | 87 | unsigned long size, |
| 91 | unsigned long align, | 88 | unsigned long align, |
| 92 | unsigned long goal); | 89 | unsigned long goal); |
| 90 | extern void *__alloc_bootmem_low(unsigned long size, | ||
| 91 | unsigned long align, | ||
| 92 | unsigned long goal); | ||
| 93 | extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, | 93 | extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, |
| 94 | unsigned long size, | 94 | unsigned long size, |
| 95 | unsigned long align, | 95 | unsigned long align, |
| 96 | unsigned long goal); | 96 | unsigned long goal); |
| 97 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | 97 | |
| 98 | #define alloc_bootmem(x) \ | 98 | #define alloc_bootmem(x) \ |
| 99 | __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 99 | __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
| 100 | #define alloc_bootmem_nopanic(x) \ | 100 | #define alloc_bootmem_nopanic(x) \ |
| 101 | __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 101 | __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
| 102 | #define alloc_bootmem_low(x) \ | ||
| 103 | __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0) | ||
| 104 | #define alloc_bootmem_pages(x) \ | 102 | #define alloc_bootmem_pages(x) \ |
| 105 | __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 103 | __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
| 106 | #define alloc_bootmem_pages_nopanic(x) \ | 104 | #define alloc_bootmem_pages_nopanic(x) \ |
| 107 | __alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 105 | __alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
| 108 | #define alloc_bootmem_low_pages(x) \ | ||
| 109 | __alloc_bootmem_low(x, PAGE_SIZE, 0) | ||
| 110 | #define alloc_bootmem_node(pgdat, x) \ | 106 | #define alloc_bootmem_node(pgdat, x) \ |
| 111 | __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 107 | __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
| 112 | #define alloc_bootmem_pages_node(pgdat, x) \ | 108 | #define alloc_bootmem_pages_node(pgdat, x) \ |
| 113 | __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 109 | __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
| 110 | #define alloc_bootmem_pages_node_nopanic(pgdat, x) \ | ||
| 111 | __alloc_bootmem_node_nopanic(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
| 112 | |||
| 113 | #define alloc_bootmem_low(x) \ | ||
| 114 | __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0) | ||
| 115 | #define alloc_bootmem_low_pages(x) \ | ||
| 116 | __alloc_bootmem_low(x, PAGE_SIZE, 0) | ||
| 114 | #define alloc_bootmem_low_pages_node(pgdat, x) \ | 117 | #define alloc_bootmem_low_pages_node(pgdat, x) \ |
| 115 | __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) | 118 | __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) |
| 116 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | ||
| 117 | 119 | ||
| 118 | extern int reserve_bootmem_generic(unsigned long addr, unsigned long size, | 120 | extern int reserve_bootmem_generic(unsigned long addr, unsigned long size, |
| 119 | int flags); | 121 | int flags); |
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h index 07ae8f846055..5b5d4731f956 100644 --- a/include/linux/coda_psdev.h +++ b/include/linux/coda_psdev.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #define CODA_PSDEV_MAJOR 67 | 6 | #define CODA_PSDEV_MAJOR 67 |
| 7 | #define MAX_CODADEVS 5 /* how many do we allow */ | 7 | #define MAX_CODADEVS 5 /* how many do we allow */ |
| 8 | 8 | ||
| 9 | #ifdef __KERNEL__ | ||
| 9 | struct kstatfs; | 10 | struct kstatfs; |
| 10 | 11 | ||
| 11 | /* communication pending/processing queues */ | 12 | /* communication pending/processing queues */ |
| @@ -24,7 +25,6 @@ static inline struct venus_comm *coda_vcp(struct super_block *sb) | |||
| 24 | return (struct venus_comm *)((sb)->s_fs_info); | 25 | return (struct venus_comm *)((sb)->s_fs_info); |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 27 | |||
| 28 | /* upcalls */ | 28 | /* upcalls */ |
| 29 | int venus_rootfid(struct super_block *sb, struct CodaFid *fidp); | 29 | int venus_rootfid(struct super_block *sb, struct CodaFid *fidp); |
| 30 | int venus_getattr(struct super_block *sb, struct CodaFid *fid, | 30 | int venus_getattr(struct super_block *sb, struct CodaFid *fid, |
| @@ -64,6 +64,12 @@ int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb); | |||
| 64 | int venus_fsync(struct super_block *sb, struct CodaFid *fid); | 64 | int venus_fsync(struct super_block *sb, struct CodaFid *fid); |
| 65 | int venus_statfs(struct dentry *dentry, struct kstatfs *sfs); | 65 | int venus_statfs(struct dentry *dentry, struct kstatfs *sfs); |
| 66 | 66 | ||
| 67 | /* | ||
| 68 | * Statistics | ||
| 69 | */ | ||
| 70 | |||
| 71 | extern struct venus_comm coda_comms[]; | ||
| 72 | #endif /* __KERNEL__ */ | ||
| 67 | 73 | ||
| 68 | /* messages between coda filesystem in kernel and Venus */ | 74 | /* messages between coda filesystem in kernel and Venus */ |
| 69 | struct upc_req { | 75 | struct upc_req { |
| @@ -82,11 +88,4 @@ struct upc_req { | |||
| 82 | #define REQ_WRITE 0x4 | 88 | #define REQ_WRITE 0x4 |
| 83 | #define REQ_ABORT 0x8 | 89 | #define REQ_ABORT 0x8 |
| 84 | 90 | ||
| 85 | |||
| 86 | /* | ||
| 87 | * Statistics | ||
| 88 | */ | ||
| 89 | |||
| 90 | extern struct venus_comm coda_comms[]; | ||
| 91 | |||
| 92 | #endif | 91 | #endif |
diff --git a/include/linux/decompress/bunzip2.h b/include/linux/decompress/bunzip2.h new file mode 100644 index 000000000000..115272137a9c --- /dev/null +++ b/include/linux/decompress/bunzip2.h | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #ifndef DECOMPRESS_BUNZIP2_H | ||
| 2 | #define DECOMPRESS_BUNZIP2_H | ||
| 3 | |||
| 4 | int bunzip2(unsigned char *inbuf, int len, | ||
| 5 | int(*fill)(void*, unsigned int), | ||
| 6 | int(*flush)(void*, unsigned int), | ||
| 7 | unsigned char *output, | ||
| 8 | int *pos, | ||
| 9 | void(*error)(char *x)); | ||
| 10 | #endif | ||
diff --git a/include/linux/decompress/generic.h b/include/linux/decompress/generic.h new file mode 100644 index 000000000000..6dfb856327bb --- /dev/null +++ b/include/linux/decompress/generic.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #ifndef DECOMPRESS_GENERIC_H | ||
| 2 | #define DECOMPRESS_GENERIC_H | ||
| 3 | |||
| 4 | /* Minimal chunksize to be read. | ||
| 5 | *Bzip2 prefers at least 4096 | ||
| 6 | *Lzma prefers 0x10000 */ | ||
| 7 | #define COMPR_IOBUF_SIZE 4096 | ||
| 8 | |||
| 9 | typedef int (*decompress_fn) (unsigned char *inbuf, int len, | ||
| 10 | int(*fill)(void*, unsigned int), | ||
| 11 | int(*writebb)(void*, unsigned int), | ||
| 12 | unsigned char *output, | ||
| 13 | int *posp, | ||
| 14 | void(*error)(char *x)); | ||
| 15 | |||
| 16 | /* inbuf - input buffer | ||
| 17 | *len - len of pre-read data in inbuf | ||
| 18 | *fill - function to fill inbuf if empty | ||
| 19 | *writebb - function to write out outbug | ||
| 20 | *posp - if non-null, input position (number of bytes read) will be | ||
| 21 | * returned here | ||
| 22 | * | ||
| 23 | *If len != 0, the inbuf is initialized (with as much data), and fill | ||
| 24 | *should not be called | ||
| 25 | *If len = 0, the inbuf is allocated, but empty. Its size is IOBUF_SIZE | ||
| 26 | *fill should be called (repeatedly...) to read data, at most IOBUF_SIZE | ||
| 27 | */ | ||
| 28 | |||
| 29 | /* Utility routine to detect the decompression method */ | ||
| 30 | decompress_fn decompress_method(const unsigned char *inbuf, int len, | ||
| 31 | const char **name); | ||
| 32 | |||
| 33 | #endif | ||
diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h new file mode 100644 index 000000000000..f9b06ccc3e5c --- /dev/null +++ b/include/linux/decompress/inflate.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | #ifndef INFLATE_H | ||
| 2 | #define INFLATE_H | ||
| 3 | |||
| 4 | /* Other housekeeping constants */ | ||
| 5 | #define INBUFSIZ 4096 | ||
| 6 | |||
| 7 | int gunzip(unsigned char *inbuf, int len, | ||
| 8 | int(*fill)(void*, unsigned int), | ||
| 9 | int(*flush)(void*, unsigned int), | ||
| 10 | unsigned char *output, | ||
| 11 | int *pos, | ||
| 12 | void(*error_fn)(char *x)); | ||
| 13 | #endif | ||
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h new file mode 100644 index 000000000000..12ff8c3f1d05 --- /dev/null +++ b/include/linux/decompress/mm.h | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | /* | ||
| 2 | * linux/compr_mm.h | ||
| 3 | * | ||
| 4 | * Memory management for pre-boot and ramdisk uncompressors | ||
| 5 | * | ||
| 6 | * Authors: Alain Knaff <alain@knaff.lu> | ||
| 7 | * | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef DECOMPR_MM_H | ||
| 11 | #define DECOMPR_MM_H | ||
| 12 | |||
| 13 | #ifdef STATIC | ||
| 14 | |||
| 15 | /* Code active when included from pre-boot environment: */ | ||
| 16 | |||
| 17 | /* A trivial malloc implementation, adapted from | ||
| 18 | * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 | ||
| 19 | */ | ||
| 20 | static unsigned long malloc_ptr; | ||
| 21 | static int malloc_count; | ||
| 22 | |||
| 23 | static void *malloc(int size) | ||
| 24 | { | ||
| 25 | void *p; | ||
| 26 | |||
| 27 | if (size < 0) | ||
| 28 | error("Malloc error"); | ||
| 29 | if (!malloc_ptr) | ||
| 30 | malloc_ptr = free_mem_ptr; | ||
| 31 | |||
| 32 | malloc_ptr = (malloc_ptr + 3) & ~3; /* Align */ | ||
| 33 | |||
| 34 | p = (void *)malloc_ptr; | ||
| 35 | malloc_ptr += size; | ||
| 36 | |||
| 37 | if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) | ||
| 38 | error("Out of memory"); | ||
| 39 | |||
| 40 | malloc_count++; | ||
| 41 | return p; | ||
| 42 | } | ||
| 43 | |||
| 44 | static void free(void *where) | ||
| 45 | { | ||
| 46 | malloc_count--; | ||
| 47 | if (!malloc_count) | ||
| 48 | malloc_ptr = free_mem_ptr; | ||
| 49 | } | ||
| 50 | |||
| 51 | #define large_malloc(a) malloc(a) | ||
| 52 | #define large_free(a) free(a) | ||
| 53 | |||
| 54 | #define set_error_fn(x) | ||
| 55 | |||
| 56 | #define INIT | ||
| 57 | |||
| 58 | #else /* STATIC */ | ||
| 59 | |||
| 60 | /* Code active when compiled standalone for use when loading ramdisk: */ | ||
| 61 | |||
| 62 | #include <linux/kernel.h> | ||
| 63 | #include <linux/fs.h> | ||
| 64 | #include <linux/string.h> | ||
| 65 | #include <linux/vmalloc.h> | ||
| 66 | |||
| 67 | /* Use defines rather than static inline in order to avoid spurious | ||
| 68 | * warnings when not needed (indeed large_malloc / large_free are not | ||
| 69 | * needed by inflate */ | ||
| 70 | |||
| 71 | #define malloc(a) kmalloc(a, GFP_KERNEL) | ||
| 72 | #define free(a) kfree(a) | ||
| 73 | |||
| 74 | #define large_malloc(a) vmalloc(a) | ||
| 75 | #define large_free(a) vfree(a) | ||
| 76 | |||
| 77 | static void(*error)(char *m); | ||
| 78 | #define set_error_fn(x) error = x; | ||
| 79 | |||
| 80 | #define INIT __init | ||
| 81 | #define STATIC | ||
| 82 | |||
| 83 | #include <linux/init.h> | ||
| 84 | |||
| 85 | #endif /* STATIC */ | ||
| 86 | |||
| 87 | #endif /* DECOMPR_MM_H */ | ||
diff --git a/include/linux/decompress/unlzma.h b/include/linux/decompress/unlzma.h new file mode 100644 index 000000000000..7796538f1bf4 --- /dev/null +++ b/include/linux/decompress/unlzma.h | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | #ifndef DECOMPRESS_UNLZMA_H | ||
| 2 | #define DECOMPRESS_UNLZMA_H | ||
| 3 | |||
| 4 | int unlzma(unsigned char *, int, | ||
| 5 | int(*fill)(void*, unsigned int), | ||
| 6 | int(*flush)(void*, unsigned int), | ||
| 7 | unsigned char *output, | ||
| 8 | int *posp, | ||
| 9 | void(*error)(char *x) | ||
| 10 | ); | ||
| 11 | |||
| 12 | #endif | ||
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h index 5ca54d77079f..7605c5e9589f 100644 --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h | |||
| @@ -111,6 +111,15 @@ static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *re | |||
| 111 | #endif | 111 | #endif |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | static inline void elf_core_copy_kernel_regs(elf_gregset_t *elfregs, struct pt_regs *regs) | ||
| 115 | { | ||
| 116 | #ifdef ELF_CORE_COPY_KERNEL_REGS | ||
| 117 | ELF_CORE_COPY_KERNEL_REGS((*elfregs), regs); | ||
| 118 | #else | ||
| 119 | elf_core_copy_regs(elfregs, regs); | ||
| 120 | #endif | ||
| 121 | } | ||
| 122 | |||
| 114 | static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) | 123 | static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) |
| 115 | { | 124 | { |
| 116 | #ifdef ELF_CORE_COPY_TASK_REGS | 125 | #ifdef ELF_CORE_COPY_TASK_REGS |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 677432b9cb7e..e1583f2639b0 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
| @@ -1,15 +1,18 @@ | |||
| 1 | #ifndef _LINUX_FTRACE_H | 1 | #ifndef _LINUX_FTRACE_H |
| 2 | #define _LINUX_FTRACE_H | 2 | #define _LINUX_FTRACE_H |
| 3 | 3 | ||
| 4 | #include <linux/linkage.h> | 4 | #include <linux/trace_clock.h> |
| 5 | #include <linux/fs.h> | ||
| 6 | #include <linux/ktime.h> | ||
| 7 | #include <linux/init.h> | ||
| 8 | #include <linux/types.h> | ||
| 9 | #include <linux/module.h> | ||
| 10 | #include <linux/kallsyms.h> | 5 | #include <linux/kallsyms.h> |
| 6 | #include <linux/linkage.h> | ||
| 11 | #include <linux/bitops.h> | 7 | #include <linux/bitops.h> |
| 8 | #include <linux/module.h> | ||
| 9 | #include <linux/ktime.h> | ||
| 12 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
| 11 | #include <linux/types.h> | ||
| 12 | #include <linux/init.h> | ||
| 13 | #include <linux/fs.h> | ||
| 14 | |||
| 15 | #include <asm/ftrace.h> | ||
| 13 | 16 | ||
| 14 | #ifdef CONFIG_FUNCTION_TRACER | 17 | #ifdef CONFIG_FUNCTION_TRACER |
| 15 | 18 | ||
| @@ -95,9 +98,41 @@ stack_trace_sysctl(struct ctl_table *table, int write, | |||
| 95 | loff_t *ppos); | 98 | loff_t *ppos); |
| 96 | #endif | 99 | #endif |
| 97 | 100 | ||
| 101 | struct ftrace_func_command { | ||
| 102 | struct list_head list; | ||
| 103 | char *name; | ||
| 104 | int (*func)(char *func, char *cmd, | ||
| 105 | char *params, int enable); | ||
| 106 | }; | ||
| 107 | |||
| 98 | #ifdef CONFIG_DYNAMIC_FTRACE | 108 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 99 | /* asm/ftrace.h must be defined for archs supporting dynamic ftrace */ | 109 | |
| 100 | #include <asm/ftrace.h> | 110 | int ftrace_arch_code_modify_prepare(void); |
| 111 | int ftrace_arch_code_modify_post_process(void); | ||
| 112 | |||
| 113 | struct seq_file; | ||
| 114 | |||
| 115 | struct ftrace_probe_ops { | ||
| 116 | void (*func)(unsigned long ip, | ||
| 117 | unsigned long parent_ip, | ||
| 118 | void **data); | ||
| 119 | int (*callback)(unsigned long ip, void **data); | ||
| 120 | void (*free)(void **data); | ||
| 121 | int (*print)(struct seq_file *m, | ||
| 122 | unsigned long ip, | ||
| 123 | struct ftrace_probe_ops *ops, | ||
| 124 | void *data); | ||
| 125 | }; | ||
| 126 | |||
| 127 | extern int | ||
| 128 | register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | ||
| 129 | void *data); | ||
| 130 | extern void | ||
| 131 | unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | ||
| 132 | void *data); | ||
| 133 | extern void | ||
| 134 | unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops); | ||
| 135 | extern void unregister_ftrace_function_probe_all(char *glob); | ||
| 101 | 136 | ||
| 102 | enum { | 137 | enum { |
| 103 | FTRACE_FL_FREE = (1 << 0), | 138 | FTRACE_FL_FREE = (1 << 0), |
| @@ -119,6 +154,9 @@ struct dyn_ftrace { | |||
| 119 | int ftrace_force_update(void); | 154 | int ftrace_force_update(void); |
| 120 | void ftrace_set_filter(unsigned char *buf, int len, int reset); | 155 | void ftrace_set_filter(unsigned char *buf, int len, int reset); |
| 121 | 156 | ||
| 157 | int register_ftrace_command(struct ftrace_func_command *cmd); | ||
| 158 | int unregister_ftrace_command(struct ftrace_func_command *cmd); | ||
| 159 | |||
| 122 | /* defined in arch */ | 160 | /* defined in arch */ |
| 123 | extern int ftrace_ip_converted(unsigned long ip); | 161 | extern int ftrace_ip_converted(unsigned long ip); |
| 124 | extern int ftrace_dyn_arch_init(void *data); | 162 | extern int ftrace_dyn_arch_init(void *data); |
| @@ -126,6 +164,10 @@ extern int ftrace_update_ftrace_func(ftrace_func_t func); | |||
| 126 | extern void ftrace_caller(void); | 164 | extern void ftrace_caller(void); |
| 127 | extern void ftrace_call(void); | 165 | extern void ftrace_call(void); |
| 128 | extern void mcount_call(void); | 166 | extern void mcount_call(void); |
| 167 | |||
| 168 | #ifndef FTRACE_ADDR | ||
| 169 | #define FTRACE_ADDR ((unsigned long)ftrace_caller) | ||
| 170 | #endif | ||
| 129 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 171 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 130 | extern void ftrace_graph_caller(void); | 172 | extern void ftrace_graph_caller(void); |
| 131 | extern int ftrace_enable_ftrace_graph_caller(void); | 173 | extern int ftrace_enable_ftrace_graph_caller(void); |
| @@ -136,7 +178,7 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; } | |||
| 136 | #endif | 178 | #endif |
| 137 | 179 | ||
| 138 | /** | 180 | /** |
| 139 | * ftrace_make_nop - convert code into top | 181 | * ftrace_make_nop - convert code into nop |
| 140 | * @mod: module structure if called by module load initialization | 182 | * @mod: module structure if called by module load initialization |
| 141 | * @rec: the mcount call site record | 183 | * @rec: the mcount call site record |
| 142 | * @addr: the address that the call site should be calling | 184 | * @addr: the address that the call site should be calling |
| @@ -181,7 +223,6 @@ extern int ftrace_make_nop(struct module *mod, | |||
| 181 | */ | 223 | */ |
| 182 | extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr); | 224 | extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr); |
| 183 | 225 | ||
| 184 | |||
| 185 | /* May be defined in arch */ | 226 | /* May be defined in arch */ |
| 186 | extern int ftrace_arch_read_dyn_info(char *buf, int size); | 227 | extern int ftrace_arch_read_dyn_info(char *buf, int size); |
| 187 | 228 | ||
| @@ -198,6 +239,14 @@ extern void ftrace_enable_daemon(void); | |||
| 198 | # define ftrace_disable_daemon() do { } while (0) | 239 | # define ftrace_disable_daemon() do { } while (0) |
| 199 | # define ftrace_enable_daemon() do { } while (0) | 240 | # define ftrace_enable_daemon() do { } while (0) |
| 200 | static inline void ftrace_release(void *start, unsigned long size) { } | 241 | static inline void ftrace_release(void *start, unsigned long size) { } |
| 242 | static inline int register_ftrace_command(struct ftrace_func_command *cmd) | ||
| 243 | { | ||
| 244 | return -EINVAL; | ||
| 245 | } | ||
| 246 | static inline int unregister_ftrace_command(char *cmd_name) | ||
| 247 | { | ||
| 248 | return -EINVAL; | ||
| 249 | } | ||
| 201 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 250 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
| 202 | 251 | ||
| 203 | /* totally disable ftrace - can not re-enable after this */ | 252 | /* totally disable ftrace - can not re-enable after this */ |
| @@ -233,24 +282,25 @@ static inline void __ftrace_enabled_restore(int enabled) | |||
| 233 | #endif | 282 | #endif |
| 234 | } | 283 | } |
| 235 | 284 | ||
| 236 | #ifdef CONFIG_FRAME_POINTER | 285 | #ifndef HAVE_ARCH_CALLER_ADDR |
| 237 | /* TODO: need to fix this for ARM */ | 286 | # ifdef CONFIG_FRAME_POINTER |
| 238 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) | 287 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) |
| 239 | # define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1)) | 288 | # define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1)) |
| 240 | # define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2)) | 289 | # define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2)) |
| 241 | # define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3)) | 290 | # define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3)) |
| 242 | # define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4)) | 291 | # define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4)) |
| 243 | # define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5)) | 292 | # define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5)) |
| 244 | # define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6)) | 293 | # define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6)) |
| 245 | #else | 294 | # else |
| 246 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) | 295 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) |
| 247 | # define CALLER_ADDR1 0UL | 296 | # define CALLER_ADDR1 0UL |
| 248 | # define CALLER_ADDR2 0UL | 297 | # define CALLER_ADDR2 0UL |
| 249 | # define CALLER_ADDR3 0UL | 298 | # define CALLER_ADDR3 0UL |
| 250 | # define CALLER_ADDR4 0UL | 299 | # define CALLER_ADDR4 0UL |
| 251 | # define CALLER_ADDR5 0UL | 300 | # define CALLER_ADDR5 0UL |
| 252 | # define CALLER_ADDR6 0UL | 301 | # define CALLER_ADDR6 0UL |
| 253 | #endif | 302 | # endif |
| 303 | #endif /* ifndef HAVE_ARCH_CALLER_ADDR */ | ||
| 254 | 304 | ||
| 255 | #ifdef CONFIG_IRQSOFF_TRACER | 305 | #ifdef CONFIG_IRQSOFF_TRACER |
| 256 | extern void time_hardirqs_on(unsigned long a0, unsigned long a1); | 306 | extern void time_hardirqs_on(unsigned long a0, unsigned long a1); |
| @@ -268,54 +318,6 @@ static inline void __ftrace_enabled_restore(int enabled) | |||
| 268 | # define trace_preempt_off(a0, a1) do { } while (0) | 318 | # define trace_preempt_off(a0, a1) do { } while (0) |
| 269 | #endif | 319 | #endif |
| 270 | 320 | ||
| 271 | #ifdef CONFIG_TRACING | ||
| 272 | extern int ftrace_dump_on_oops; | ||
| 273 | |||
| 274 | extern void tracing_start(void); | ||
| 275 | extern void tracing_stop(void); | ||
| 276 | extern void ftrace_off_permanent(void); | ||
| 277 | |||
| 278 | extern void | ||
| 279 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | ||
| 280 | |||
| 281 | /** | ||
| 282 | * ftrace_printk - printf formatting in the ftrace buffer | ||
| 283 | * @fmt: the printf format for printing | ||
| 284 | * | ||
| 285 | * Note: __ftrace_printk is an internal function for ftrace_printk and | ||
| 286 | * the @ip is passed in via the ftrace_printk macro. | ||
| 287 | * | ||
| 288 | * This function allows a kernel developer to debug fast path sections | ||
| 289 | * that printk is not appropriate for. By scattering in various | ||
| 290 | * printk like tracing in the code, a developer can quickly see | ||
| 291 | * where problems are occurring. | ||
| 292 | * | ||
| 293 | * This is intended as a debugging tool for the developer only. | ||
| 294 | * Please refrain from leaving ftrace_printks scattered around in | ||
| 295 | * your code. | ||
| 296 | */ | ||
| 297 | # define ftrace_printk(fmt...) __ftrace_printk(_THIS_IP_, fmt) | ||
| 298 | extern int | ||
| 299 | __ftrace_printk(unsigned long ip, const char *fmt, ...) | ||
| 300 | __attribute__ ((format (printf, 2, 3))); | ||
| 301 | extern void ftrace_dump(void); | ||
| 302 | #else | ||
| 303 | static inline void | ||
| 304 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } | ||
| 305 | static inline int | ||
| 306 | ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | ||
| 307 | |||
| 308 | static inline void tracing_start(void) { } | ||
| 309 | static inline void tracing_stop(void) { } | ||
| 310 | static inline void ftrace_off_permanent(void) { } | ||
| 311 | static inline int | ||
| 312 | ftrace_printk(const char *fmt, ...) | ||
| 313 | { | ||
| 314 | return 0; | ||
| 315 | } | ||
| 316 | static inline void ftrace_dump(void) { } | ||
| 317 | #endif | ||
| 318 | |||
| 319 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 321 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| 320 | extern void ftrace_init(void); | 322 | extern void ftrace_init(void); |
| 321 | extern void ftrace_init_module(struct module *mod, | 323 | extern void ftrace_init_module(struct module *mod, |
| @@ -327,36 +329,6 @@ ftrace_init_module(struct module *mod, | |||
| 327 | unsigned long *start, unsigned long *end) { } | 329 | unsigned long *start, unsigned long *end) { } |
| 328 | #endif | 330 | #endif |
| 329 | 331 | ||
| 330 | enum { | ||
| 331 | POWER_NONE = 0, | ||
| 332 | POWER_CSTATE = 1, | ||
| 333 | POWER_PSTATE = 2, | ||
| 334 | }; | ||
| 335 | |||
| 336 | struct power_trace { | ||
| 337 | #ifdef CONFIG_POWER_TRACER | ||
| 338 | ktime_t stamp; | ||
| 339 | ktime_t end; | ||
| 340 | int type; | ||
| 341 | int state; | ||
| 342 | #endif | ||
| 343 | }; | ||
| 344 | |||
| 345 | #ifdef CONFIG_POWER_TRACER | ||
| 346 | extern void trace_power_start(struct power_trace *it, unsigned int type, | ||
| 347 | unsigned int state); | ||
| 348 | extern void trace_power_mark(struct power_trace *it, unsigned int type, | ||
| 349 | unsigned int state); | ||
| 350 | extern void trace_power_end(struct power_trace *it); | ||
| 351 | #else | ||
| 352 | static inline void trace_power_start(struct power_trace *it, unsigned int type, | ||
| 353 | unsigned int state) { } | ||
| 354 | static inline void trace_power_mark(struct power_trace *it, unsigned int type, | ||
| 355 | unsigned int state) { } | ||
| 356 | static inline void trace_power_end(struct power_trace *it) { } | ||
| 357 | #endif | ||
| 358 | |||
| 359 | |||
| 360 | /* | 332 | /* |
| 361 | * Structure that defines an entry function trace. | 333 | * Structure that defines an entry function trace. |
| 362 | */ | 334 | */ |
| @@ -380,6 +352,30 @@ struct ftrace_graph_ret { | |||
| 380 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 352 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 381 | 353 | ||
| 382 | /* | 354 | /* |
| 355 | * Stack of return addresses for functions | ||
| 356 | * of a thread. | ||
| 357 | * Used in struct thread_info | ||
| 358 | */ | ||
| 359 | struct ftrace_ret_stack { | ||
| 360 | unsigned long ret; | ||
| 361 | unsigned long func; | ||
| 362 | unsigned long long calltime; | ||
| 363 | }; | ||
| 364 | |||
| 365 | /* | ||
| 366 | * Primary handler of a function return. | ||
| 367 | * It relays on ftrace_return_to_handler. | ||
| 368 | * Defined in entry_32/64.S | ||
| 369 | */ | ||
| 370 | extern void return_to_handler(void); | ||
| 371 | |||
| 372 | extern int | ||
| 373 | ftrace_push_return_trace(unsigned long ret, unsigned long long time, | ||
| 374 | unsigned long func, int *depth); | ||
| 375 | extern void | ||
| 376 | ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret); | ||
| 377 | |||
| 378 | /* | ||
| 383 | * Sometimes we don't want to trace a function with the function | 379 | * Sometimes we don't want to trace a function with the function |
| 384 | * graph tracer but we want them to keep traced by the usual function | 380 | * graph tracer but we want them to keep traced by the usual function |
| 385 | * tracer if the function graph tracer is not configured. | 381 | * tracer if the function graph tracer is not configured. |
| @@ -490,6 +486,21 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk) | |||
| 490 | return tsk->trace & TSK_TRACE_FL_GRAPH; | 486 | return tsk->trace & TSK_TRACE_FL_GRAPH; |
| 491 | } | 487 | } |
| 492 | 488 | ||
| 489 | extern int ftrace_dump_on_oops; | ||
| 490 | |||
| 493 | #endif /* CONFIG_TRACING */ | 491 | #endif /* CONFIG_TRACING */ |
| 494 | 492 | ||
| 493 | |||
| 494 | #ifdef CONFIG_HW_BRANCH_TRACER | ||
| 495 | |||
| 496 | void trace_hw_branch(u64 from, u64 to); | ||
| 497 | void trace_hw_branch_oops(void); | ||
| 498 | |||
| 499 | #else /* CONFIG_HW_BRANCH_TRACER */ | ||
| 500 | |||
| 501 | static inline void trace_hw_branch(u64 from, u64 to) {} | ||
| 502 | static inline void trace_hw_branch_oops(void) {} | ||
| 503 | |||
| 504 | #endif /* CONFIG_HW_BRANCH_TRACER */ | ||
| 505 | |||
| 495 | #endif /* _LINUX_FTRACE_H */ | 506 | #endif /* _LINUX_FTRACE_H */ |
diff --git a/include/linux/ftrace_irq.h b/include/linux/ftrace_irq.h index 366a054d0b05..dca7bf8cffe2 100644 --- a/include/linux/ftrace_irq.h +++ b/include/linux/ftrace_irq.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define _LINUX_FTRACE_IRQ_H | 2 | #define _LINUX_FTRACE_IRQ_H |
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | #if defined(CONFIG_DYNAMIC_FTRACE) || defined(CONFIG_FUNCTION_GRAPH_TRACER) | 5 | #ifdef CONFIG_FTRACE_NMI_ENTER |
| 6 | extern void ftrace_nmi_enter(void); | 6 | extern void ftrace_nmi_enter(void); |
| 7 | extern void ftrace_nmi_exit(void); | 7 | extern void ftrace_nmi_exit(void); |
| 8 | #else | 8 | #else |
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index f83288347dda..faa1cf848bcd 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
| @@ -15,55 +15,61 @@ | |||
| 15 | * - bits 0-7 are the preemption count (max preemption depth: 256) | 15 | * - bits 0-7 are the preemption count (max preemption depth: 256) |
| 16 | * - bits 8-15 are the softirq count (max # of softirqs: 256) | 16 | * - bits 8-15 are the softirq count (max # of softirqs: 256) |
| 17 | * | 17 | * |
| 18 | * The hardirq count can be overridden per architecture, the default is: | 18 | * The hardirq count can in theory reach the same as NR_IRQS. |
| 19 | * In reality, the number of nested IRQS is limited to the stack | ||
| 20 | * size as well. For archs with over 1000 IRQS it is not practical | ||
| 21 | * to expect that they will all nest. We give a max of 10 bits for | ||
| 22 | * hardirq nesting. An arch may choose to give less than 10 bits. | ||
| 23 | * m68k expects it to be 8. | ||
| 19 | * | 24 | * |
| 20 | * - bits 16-27 are the hardirq count (max # of hardirqs: 4096) | 25 | * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024) |
| 21 | * - ( bit 28 is the PREEMPT_ACTIVE flag. ) | 26 | * - bit 26 is the NMI_MASK |
| 27 | * - bit 28 is the PREEMPT_ACTIVE flag | ||
| 22 | * | 28 | * |
| 23 | * PREEMPT_MASK: 0x000000ff | 29 | * PREEMPT_MASK: 0x000000ff |
| 24 | * SOFTIRQ_MASK: 0x0000ff00 | 30 | * SOFTIRQ_MASK: 0x0000ff00 |
| 25 | * HARDIRQ_MASK: 0x0fff0000 | 31 | * HARDIRQ_MASK: 0x03ff0000 |
| 32 | * NMI_MASK: 0x04000000 | ||
| 26 | */ | 33 | */ |
| 27 | #define PREEMPT_BITS 8 | 34 | #define PREEMPT_BITS 8 |
| 28 | #define SOFTIRQ_BITS 8 | 35 | #define SOFTIRQ_BITS 8 |
| 36 | #define NMI_BITS 1 | ||
| 29 | 37 | ||
| 30 | #ifndef HARDIRQ_BITS | 38 | #define MAX_HARDIRQ_BITS 10 |
| 31 | #define HARDIRQ_BITS 12 | ||
| 32 | 39 | ||
| 33 | #ifndef MAX_HARDIRQS_PER_CPU | 40 | #ifndef HARDIRQ_BITS |
| 34 | #define MAX_HARDIRQS_PER_CPU NR_IRQS | 41 | # define HARDIRQ_BITS MAX_HARDIRQ_BITS |
| 35 | #endif | 42 | #endif |
| 36 | 43 | ||
| 37 | /* | 44 | #if HARDIRQ_BITS > MAX_HARDIRQ_BITS |
| 38 | * The hardirq mask has to be large enough to have space for potentially | 45 | #error HARDIRQ_BITS too high! |
| 39 | * all IRQ sources in the system nesting on a single CPU. | ||
| 40 | */ | ||
| 41 | #if (1 << HARDIRQ_BITS) < MAX_HARDIRQS_PER_CPU | ||
| 42 | # error HARDIRQ_BITS is too low! | ||
| 43 | #endif | ||
| 44 | #endif | 46 | #endif |
| 45 | 47 | ||
| 46 | #define PREEMPT_SHIFT 0 | 48 | #define PREEMPT_SHIFT 0 |
| 47 | #define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) | 49 | #define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) |
| 48 | #define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) | 50 | #define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) |
| 51 | #define NMI_SHIFT (HARDIRQ_SHIFT + HARDIRQ_BITS) | ||
| 49 | 52 | ||
| 50 | #define __IRQ_MASK(x) ((1UL << (x))-1) | 53 | #define __IRQ_MASK(x) ((1UL << (x))-1) |
| 51 | 54 | ||
| 52 | #define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT) | 55 | #define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT) |
| 53 | #define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) | 56 | #define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) |
| 54 | #define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) | 57 | #define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) |
| 58 | #define NMI_MASK (__IRQ_MASK(NMI_BITS) << NMI_SHIFT) | ||
| 55 | 59 | ||
| 56 | #define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) | 60 | #define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) |
| 57 | #define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) | 61 | #define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) |
| 58 | #define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) | 62 | #define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) |
| 63 | #define NMI_OFFSET (1UL << NMI_SHIFT) | ||
| 59 | 64 | ||
| 60 | #if PREEMPT_ACTIVE < (1 << (HARDIRQ_SHIFT + HARDIRQ_BITS)) | 65 | #if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS)) |
| 61 | #error PREEMPT_ACTIVE is too low! | 66 | #error PREEMPT_ACTIVE is too low! |
| 62 | #endif | 67 | #endif |
| 63 | 68 | ||
| 64 | #define hardirq_count() (preempt_count() & HARDIRQ_MASK) | 69 | #define hardirq_count() (preempt_count() & HARDIRQ_MASK) |
| 65 | #define softirq_count() (preempt_count() & SOFTIRQ_MASK) | 70 | #define softirq_count() (preempt_count() & SOFTIRQ_MASK) |
| 66 | #define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) | 71 | #define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \ |
| 72 | | NMI_MASK)) | ||
| 67 | 73 | ||
| 68 | /* | 74 | /* |
| 69 | * Are we doing bottom half or hardware interrupt processing? | 75 | * Are we doing bottom half or hardware interrupt processing? |
| @@ -73,6 +79,11 @@ | |||
| 73 | #define in_softirq() (softirq_count()) | 79 | #define in_softirq() (softirq_count()) |
| 74 | #define in_interrupt() (irq_count()) | 80 | #define in_interrupt() (irq_count()) |
| 75 | 81 | ||
| 82 | /* | ||
| 83 | * Are we in NMI context? | ||
| 84 | */ | ||
| 85 | #define in_nmi() (preempt_count() & NMI_MASK) | ||
| 86 | |||
| 76 | #if defined(CONFIG_PREEMPT) | 87 | #if defined(CONFIG_PREEMPT) |
| 77 | # define PREEMPT_INATOMIC_BASE kernel_locked() | 88 | # define PREEMPT_INATOMIC_BASE kernel_locked() |
| 78 | # define PREEMPT_CHECK_OFFSET 1 | 89 | # define PREEMPT_CHECK_OFFSET 1 |
| @@ -164,20 +175,24 @@ extern void irq_enter(void); | |||
| 164 | */ | 175 | */ |
| 165 | extern void irq_exit(void); | 176 | extern void irq_exit(void); |
| 166 | 177 | ||
| 167 | #define nmi_enter() \ | 178 | #define nmi_enter() \ |
| 168 | do { \ | 179 | do { \ |
| 169 | ftrace_nmi_enter(); \ | 180 | ftrace_nmi_enter(); \ |
| 170 | lockdep_off(); \ | 181 | BUG_ON(in_nmi()); \ |
| 171 | rcu_nmi_enter(); \ | 182 | add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ |
| 172 | __irq_enter(); \ | 183 | lockdep_off(); \ |
| 184 | rcu_nmi_enter(); \ | ||
| 185 | trace_hardirq_enter(); \ | ||
| 173 | } while (0) | 186 | } while (0) |
| 174 | 187 | ||
| 175 | #define nmi_exit() \ | 188 | #define nmi_exit() \ |
| 176 | do { \ | 189 | do { \ |
| 177 | __irq_exit(); \ | 190 | trace_hardirq_exit(); \ |
| 178 | rcu_nmi_exit(); \ | 191 | rcu_nmi_exit(); \ |
| 179 | lockdep_on(); \ | 192 | lockdep_on(); \ |
| 180 | ftrace_nmi_exit(); \ | 193 | BUG_ON(!in_nmi()); \ |
| 194 | sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ | ||
| 195 | ftrace_nmi_exit(); \ | ||
| 181 | } while (0) | 196 | } while (0) |
| 182 | 197 | ||
| 183 | #endif /* LINUX_HARDIRQ_H */ | 198 | #endif /* LINUX_HARDIRQ_H */ |
diff --git a/include/linux/in6.h b/include/linux/in6.h index bc492048c349..718bf21c5754 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h | |||
| @@ -44,11 +44,11 @@ struct in6_addr | |||
| 44 | * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined | 44 | * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined |
| 45 | * in network byte order, not in host byte order as are the IPv4 equivalents | 45 | * in network byte order, not in host byte order as are the IPv4 equivalents |
| 46 | */ | 46 | */ |
| 47 | #ifdef __KERNEL__ | ||
| 47 | extern const struct in6_addr in6addr_any; | 48 | extern const struct in6_addr in6addr_any; |
| 48 | #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } | 49 | #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } |
| 49 | extern const struct in6_addr in6addr_loopback; | 50 | extern const struct in6_addr in6addr_loopback; |
| 50 | #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } | 51 | #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } |
| 51 | #ifdef __KERNEL__ | ||
| 52 | extern const struct in6_addr in6addr_linklocal_allnodes; | 52 | extern const struct in6_addr in6addr_linklocal_allnodes; |
| 53 | #define IN6ADDR_LINKLOCAL_ALLNODES_INIT \ | 53 | #define IN6ADDR_LINKLOCAL_ALLNODES_INIT \ |
| 54 | { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } | 54 | { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 9127f6b51a39..472f11765f60 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
| @@ -467,6 +467,7 @@ int show_interrupts(struct seq_file *p, void *v); | |||
| 467 | struct irq_desc; | 467 | struct irq_desc; |
| 468 | 468 | ||
| 469 | extern int early_irq_init(void); | 469 | extern int early_irq_init(void); |
| 470 | extern int arch_probe_nr_irqs(void); | ||
| 470 | extern int arch_early_irq_init(void); | 471 | extern int arch_early_irq_init(void); |
| 471 | extern int arch_init_chip_data(struct irq_desc *desc, int cpu); | 472 | extern int arch_init_chip_data(struct irq_desc *desc, int cpu); |
| 472 | 473 | ||
diff --git a/include/linux/irq.h b/include/linux/irq.h index f899b502f186..27a67536511e 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
| @@ -182,11 +182,11 @@ struct irq_desc { | |||
| 182 | unsigned int irqs_unhandled; | 182 | unsigned int irqs_unhandled; |
| 183 | spinlock_t lock; | 183 | spinlock_t lock; |
| 184 | #ifdef CONFIG_SMP | 184 | #ifdef CONFIG_SMP |
| 185 | cpumask_t affinity; | 185 | cpumask_var_t affinity; |
| 186 | unsigned int cpu; | 186 | unsigned int cpu; |
| 187 | #endif | ||
| 188 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 187 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
| 189 | cpumask_t pending_mask; | 188 | cpumask_var_t pending_mask; |
| 189 | #endif | ||
| 190 | #endif | 190 | #endif |
| 191 | #ifdef CONFIG_PROC_FS | 191 | #ifdef CONFIG_PROC_FS |
| 192 | struct proc_dir_entry *dir; | 192 | struct proc_dir_entry *dir; |
| @@ -422,4 +422,84 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | |||
| 422 | 422 | ||
| 423 | #endif /* !CONFIG_S390 */ | 423 | #endif /* !CONFIG_S390 */ |
| 424 | 424 | ||
| 425 | #ifdef CONFIG_SMP | ||
| 426 | /** | ||
| 427 | * init_alloc_desc_masks - allocate cpumasks for irq_desc | ||
| 428 | * @desc: pointer to irq_desc struct | ||
| 429 | * @cpu: cpu which will be handling the cpumasks | ||
| 430 | * @boot: true if need bootmem | ||
| 431 | * | ||
| 432 | * Allocates affinity and pending_mask cpumask if required. | ||
| 433 | * Returns true if successful (or not required). | ||
| 434 | * Side effect: affinity has all bits set, pending_mask has all bits clear. | ||
| 435 | */ | ||
| 436 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | ||
| 437 | bool boot) | ||
| 438 | { | ||
| 439 | int node; | ||
| 440 | |||
| 441 | if (boot) { | ||
| 442 | alloc_bootmem_cpumask_var(&desc->affinity); | ||
| 443 | cpumask_setall(desc->affinity); | ||
| 444 | |||
| 445 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
| 446 | alloc_bootmem_cpumask_var(&desc->pending_mask); | ||
| 447 | cpumask_clear(desc->pending_mask); | ||
| 448 | #endif | ||
| 449 | return true; | ||
| 450 | } | ||
| 451 | |||
| 452 | node = cpu_to_node(cpu); | ||
| 453 | |||
| 454 | if (!alloc_cpumask_var_node(&desc->affinity, GFP_ATOMIC, node)) | ||
| 455 | return false; | ||
| 456 | cpumask_setall(desc->affinity); | ||
| 457 | |||
| 458 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
| 459 | if (!alloc_cpumask_var_node(&desc->pending_mask, GFP_ATOMIC, node)) { | ||
| 460 | free_cpumask_var(desc->affinity); | ||
| 461 | return false; | ||
| 462 | } | ||
| 463 | cpumask_clear(desc->pending_mask); | ||
| 464 | #endif | ||
| 465 | return true; | ||
| 466 | } | ||
| 467 | |||
| 468 | /** | ||
| 469 | * init_copy_desc_masks - copy cpumasks for irq_desc | ||
| 470 | * @old_desc: pointer to old irq_desc struct | ||
| 471 | * @new_desc: pointer to new irq_desc struct | ||
| 472 | * | ||
| 473 | * Insures affinity and pending_masks are copied to new irq_desc. | ||
| 474 | * If !CONFIG_CPUMASKS_OFFSTACK the cpumasks are embedded in the | ||
| 475 | * irq_desc struct so the copy is redundant. | ||
| 476 | */ | ||
| 477 | |||
| 478 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
| 479 | struct irq_desc *new_desc) | ||
| 480 | { | ||
| 481 | #ifdef CONFIG_CPUMASKS_OFFSTACK | ||
| 482 | cpumask_copy(new_desc->affinity, old_desc->affinity); | ||
| 483 | |||
| 484 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
| 485 | cpumask_copy(new_desc->pending_mask, old_desc->pending_mask); | ||
| 486 | #endif | ||
| 487 | #endif | ||
| 488 | } | ||
| 489 | |||
| 490 | #else /* !CONFIG_SMP */ | ||
| 491 | |||
| 492 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | ||
| 493 | bool boot) | ||
| 494 | { | ||
| 495 | return true; | ||
| 496 | } | ||
| 497 | |||
| 498 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
| 499 | struct irq_desc *new_desc) | ||
| 500 | { | ||
| 501 | } | ||
| 502 | |||
| 503 | #endif /* CONFIG_SMP */ | ||
| 504 | |||
| 425 | #endif /* _LINUX_IRQ_H */ | 505 | #endif /* _LINUX_IRQ_H */ |
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h index 86af92e9e84c..887477bc2ab0 100644 --- a/include/linux/irqnr.h +++ b/include/linux/irqnr.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | # define for_each_irq_desc_reverse(irq, desc) \ | 21 | # define for_each_irq_desc_reverse(irq, desc) \ |
| 22 | for (irq = nr_irqs - 1; irq >= 0; irq--) | 22 | for (irq = nr_irqs - 1; irq >= 0; irq--) |
| 23 | |||
| 23 | #else /* CONFIG_GENERIC_HARDIRQS */ | 24 | #else /* CONFIG_GENERIC_HARDIRQS */ |
| 24 | 25 | ||
| 25 | extern int nr_irqs; | 26 | extern int nr_irqs; |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 7fa371898e3e..7742798c9208 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -242,6 +242,19 @@ extern struct ratelimit_state printk_ratelimit_state; | |||
| 242 | extern int printk_ratelimit(void); | 242 | extern int printk_ratelimit(void); |
| 243 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 243 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
| 244 | unsigned int interval_msec); | 244 | unsigned int interval_msec); |
| 245 | |||
| 246 | /* | ||
| 247 | * Print a one-time message (analogous to WARN_ONCE() et al): | ||
| 248 | */ | ||
| 249 | #define printk_once(x...) ({ \ | ||
| 250 | static int __print_once = 1; \ | ||
| 251 | \ | ||
| 252 | if (__print_once) { \ | ||
| 253 | __print_once = 0; \ | ||
| 254 | printk(x); \ | ||
| 255 | } \ | ||
| 256 | }) | ||
| 257 | |||
| 245 | #else | 258 | #else |
| 246 | static inline int vprintk(const char *s, va_list args) | 259 | static inline int vprintk(const char *s, va_list args) |
| 247 | __attribute__ ((format (printf, 1, 0))); | 260 | __attribute__ ((format (printf, 1, 0))); |
| @@ -253,6 +266,10 @@ static inline int printk_ratelimit(void) { return 0; } | |||
| 253 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ | 266 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ |
| 254 | unsigned int interval_msec) \ | 267 | unsigned int interval_msec) \ |
| 255 | { return false; } | 268 | { return false; } |
| 269 | |||
| 270 | /* No effect, but we still get type checking even in the !PRINTK case: */ | ||
| 271 | #define printk_once(x...) printk(x) | ||
| 272 | |||
| 256 | #endif | 273 | #endif |
| 257 | 274 | ||
| 258 | extern int printk_needs_cpu(int cpu); | 275 | extern int printk_needs_cpu(int cpu); |
| @@ -368,6 +385,125 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 368 | #endif | 385 | #endif |
| 369 | 386 | ||
| 370 | /* | 387 | /* |
| 388 | * General tracing related utility functions - trace_printk(), | ||
| 389 | * tracing_on/tracing_off and tracing_start()/tracing_stop | ||
| 390 | * | ||
| 391 | * Use tracing_on/tracing_off when you want to quickly turn on or off | ||
| 392 | * tracing. It simply enables or disables the recording of the trace events. | ||
| 393 | * This also corresponds to the user space debugfs/tracing/tracing_on | ||
| 394 | * file, which gives a means for the kernel and userspace to interact. | ||
| 395 | * Place a tracing_off() in the kernel where you want tracing to end. | ||
| 396 | * From user space, examine the trace, and then echo 1 > tracing_on | ||
| 397 | * to continue tracing. | ||
| 398 | * | ||
| 399 | * tracing_stop/tracing_start has slightly more overhead. It is used | ||
| 400 | * by things like suspend to ram where disabling the recording of the | ||
| 401 | * trace is not enough, but tracing must actually stop because things | ||
| 402 | * like calling smp_processor_id() may crash the system. | ||
| 403 | * | ||
| 404 | * Most likely, you want to use tracing_on/tracing_off. | ||
| 405 | */ | ||
| 406 | #ifdef CONFIG_RING_BUFFER | ||
| 407 | void tracing_on(void); | ||
| 408 | void tracing_off(void); | ||
| 409 | /* trace_off_permanent stops recording with no way to bring it back */ | ||
| 410 | void tracing_off_permanent(void); | ||
| 411 | int tracing_is_on(void); | ||
| 412 | #else | ||
| 413 | static inline void tracing_on(void) { } | ||
| 414 | static inline void tracing_off(void) { } | ||
| 415 | static inline void tracing_off_permanent(void) { } | ||
| 416 | static inline int tracing_is_on(void) { return 0; } | ||
| 417 | #endif | ||
| 418 | #ifdef CONFIG_TRACING | ||
| 419 | extern void tracing_start(void); | ||
| 420 | extern void tracing_stop(void); | ||
| 421 | extern void ftrace_off_permanent(void); | ||
| 422 | |||
| 423 | extern void | ||
| 424 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | ||
| 425 | |||
| 426 | static inline void __attribute__ ((format (printf, 1, 2))) | ||
| 427 | ____trace_printk_check_format(const char *fmt, ...) | ||
| 428 | { | ||
| 429 | } | ||
| 430 | #define __trace_printk_check_format(fmt, args...) \ | ||
| 431 | do { \ | ||
| 432 | if (0) \ | ||
| 433 | ____trace_printk_check_format(fmt, ##args); \ | ||
| 434 | } while (0) | ||
| 435 | |||
| 436 | /** | ||
| 437 | * trace_printk - printf formatting in the ftrace buffer | ||
| 438 | * @fmt: the printf format for printing | ||
| 439 | * | ||
| 440 | * Note: __trace_printk is an internal function for trace_printk and | ||
| 441 | * the @ip is passed in via the trace_printk macro. | ||
| 442 | * | ||
| 443 | * This function allows a kernel developer to debug fast path sections | ||
| 444 | * that printk is not appropriate for. By scattering in various | ||
| 445 | * printk like tracing in the code, a developer can quickly see | ||
| 446 | * where problems are occurring. | ||
| 447 | * | ||
| 448 | * This is intended as a debugging tool for the developer only. | ||
| 449 | * Please refrain from leaving trace_printks scattered around in | ||
| 450 | * your code. | ||
| 451 | */ | ||
| 452 | |||
| 453 | #define trace_printk(fmt, args...) \ | ||
| 454 | do { \ | ||
| 455 | static const char *trace_printk_fmt \ | ||
| 456 | __attribute__((section("__trace_printk_fmt"))); \ | ||
| 457 | \ | ||
| 458 | if (!trace_printk_fmt) \ | ||
| 459 | trace_printk_fmt = fmt; \ | ||
| 460 | \ | ||
| 461 | __trace_printk_check_format(fmt, ##args); \ | ||
| 462 | __trace_printk(_THIS_IP_, trace_printk_fmt, ##args); \ | ||
| 463 | } while (0) | ||
| 464 | |||
| 465 | extern int | ||
| 466 | __trace_printk(unsigned long ip, const char *fmt, ...) | ||
| 467 | __attribute__ ((format (printf, 2, 3))); | ||
| 468 | |||
| 469 | #define ftrace_vprintk(fmt, vargs) \ | ||
| 470 | do { \ | ||
| 471 | static const char *trace_printk_fmt \ | ||
| 472 | __attribute__((section("__trace_printk_fmt"))); \ | ||
| 473 | \ | ||
| 474 | if (!trace_printk_fmt) \ | ||
| 475 | trace_printk_fmt = fmt; \ | ||
| 476 | \ | ||
| 477 | __ftrace_vprintk(_THIS_IP_, trace_printk_fmt, vargs); \ | ||
| 478 | } while (0) | ||
| 479 | |||
| 480 | extern int | ||
| 481 | __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); | ||
| 482 | |||
| 483 | extern void ftrace_dump(void); | ||
| 484 | #else | ||
| 485 | static inline void | ||
| 486 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } | ||
| 487 | static inline int | ||
| 488 | trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | ||
| 489 | |||
| 490 | static inline void tracing_start(void) { } | ||
| 491 | static inline void tracing_stop(void) { } | ||
| 492 | static inline void ftrace_off_permanent(void) { } | ||
| 493 | static inline int | ||
| 494 | trace_printk(const char *fmt, ...) | ||
| 495 | { | ||
| 496 | return 0; | ||
| 497 | } | ||
| 498 | static inline int | ||
| 499 | ftrace_vprintk(const char *fmt, va_list ap) | ||
| 500 | { | ||
| 501 | return 0; | ||
| 502 | } | ||
| 503 | static inline void ftrace_dump(void) { } | ||
| 504 | #endif /* CONFIG_TRACING */ | ||
| 505 | |||
| 506 | /* | ||
| 371 | * Display an IP address in readable format. | 507 | * Display an IP address in readable format. |
| 372 | */ | 508 | */ |
| 373 | 509 | ||
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 32851eef48f0..2ec6cc14a114 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
| @@ -182,6 +182,14 @@ struct kprobe_blackpoint { | |||
| 182 | DECLARE_PER_CPU(struct kprobe *, current_kprobe); | 182 | DECLARE_PER_CPU(struct kprobe *, current_kprobe); |
| 183 | DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | 183 | DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); |
| 184 | 184 | ||
| 185 | /* | ||
| 186 | * For #ifdef avoidance: | ||
| 187 | */ | ||
| 188 | static inline int kprobes_built_in(void) | ||
| 189 | { | ||
| 190 | return 1; | ||
| 191 | } | ||
| 192 | |||
| 185 | #ifdef CONFIG_KRETPROBES | 193 | #ifdef CONFIG_KRETPROBES |
| 186 | extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, | 194 | extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, |
| 187 | struct pt_regs *regs); | 195 | struct pt_regs *regs); |
| @@ -271,8 +279,16 @@ void unregister_kretprobes(struct kretprobe **rps, int num); | |||
| 271 | void kprobe_flush_task(struct task_struct *tk); | 279 | void kprobe_flush_task(struct task_struct *tk); |
| 272 | void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); | 280 | void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); |
| 273 | 281 | ||
| 274 | #else /* CONFIG_KPROBES */ | 282 | #else /* !CONFIG_KPROBES: */ |
| 275 | 283 | ||
| 284 | static inline int kprobes_built_in(void) | ||
| 285 | { | ||
| 286 | return 0; | ||
| 287 | } | ||
| 288 | static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) | ||
| 289 | { | ||
| 290 | return 0; | ||
| 291 | } | ||
| 276 | static inline struct kprobe *get_kprobe(void *addr) | 292 | static inline struct kprobe *get_kprobe(void *addr) |
| 277 | { | 293 | { |
| 278 | return NULL; | 294 | return NULL; |
| @@ -329,5 +345,5 @@ static inline void unregister_kretprobes(struct kretprobe **rps, int num) | |||
| 329 | static inline void kprobe_flush_task(struct task_struct *tk) | 345 | static inline void kprobe_flush_task(struct task_struct *tk) |
| 330 | { | 346 | { |
| 331 | } | 347 | } |
| 332 | #endif /* CONFIG_KPROBES */ | 348 | #endif /* CONFIG_KPROBES */ |
| 333 | #endif /* _LINUX_KPROBES_H */ | 349 | #endif /* _LINUX_KPROBES_H */ |
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 23bf02fb124f..5a58ea3e91e9 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
| @@ -20,43 +20,10 @@ struct lockdep_map; | |||
| 20 | #include <linux/stacktrace.h> | 20 | #include <linux/stacktrace.h> |
| 21 | 21 | ||
| 22 | /* | 22 | /* |
| 23 | * Lock-class usage-state bits: | 23 | * We'd rather not expose kernel/lockdep_states.h this wide, but we do need |
| 24 | * the total number of states... :-( | ||
| 24 | */ | 25 | */ |
| 25 | enum lock_usage_bit | 26 | #define XXX_LOCK_USAGE_STATES (1+3*4) |
| 26 | { | ||
| 27 | LOCK_USED = 0, | ||
| 28 | LOCK_USED_IN_HARDIRQ, | ||
| 29 | LOCK_USED_IN_SOFTIRQ, | ||
| 30 | LOCK_ENABLED_SOFTIRQS, | ||
| 31 | LOCK_ENABLED_HARDIRQS, | ||
| 32 | LOCK_USED_IN_HARDIRQ_READ, | ||
| 33 | LOCK_USED_IN_SOFTIRQ_READ, | ||
| 34 | LOCK_ENABLED_SOFTIRQS_READ, | ||
| 35 | LOCK_ENABLED_HARDIRQS_READ, | ||
| 36 | LOCK_USAGE_STATES | ||
| 37 | }; | ||
| 38 | |||
| 39 | /* | ||
| 40 | * Usage-state bitmasks: | ||
| 41 | */ | ||
| 42 | #define LOCKF_USED (1 << LOCK_USED) | ||
| 43 | #define LOCKF_USED_IN_HARDIRQ (1 << LOCK_USED_IN_HARDIRQ) | ||
| 44 | #define LOCKF_USED_IN_SOFTIRQ (1 << LOCK_USED_IN_SOFTIRQ) | ||
| 45 | #define LOCKF_ENABLED_HARDIRQS (1 << LOCK_ENABLED_HARDIRQS) | ||
| 46 | #define LOCKF_ENABLED_SOFTIRQS (1 << LOCK_ENABLED_SOFTIRQS) | ||
| 47 | |||
| 48 | #define LOCKF_ENABLED_IRQS (LOCKF_ENABLED_HARDIRQS | LOCKF_ENABLED_SOFTIRQS) | ||
| 49 | #define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ) | ||
| 50 | |||
| 51 | #define LOCKF_USED_IN_HARDIRQ_READ (1 << LOCK_USED_IN_HARDIRQ_READ) | ||
| 52 | #define LOCKF_USED_IN_SOFTIRQ_READ (1 << LOCK_USED_IN_SOFTIRQ_READ) | ||
| 53 | #define LOCKF_ENABLED_HARDIRQS_READ (1 << LOCK_ENABLED_HARDIRQS_READ) | ||
| 54 | #define LOCKF_ENABLED_SOFTIRQS_READ (1 << LOCK_ENABLED_SOFTIRQS_READ) | ||
| 55 | |||
| 56 | #define LOCKF_ENABLED_IRQS_READ \ | ||
| 57 | (LOCKF_ENABLED_HARDIRQS_READ | LOCKF_ENABLED_SOFTIRQS_READ) | ||
| 58 | #define LOCKF_USED_IN_IRQ_READ \ | ||
| 59 | (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ) | ||
| 60 | 27 | ||
| 61 | #define MAX_LOCKDEP_SUBCLASSES 8UL | 28 | #define MAX_LOCKDEP_SUBCLASSES 8UL |
| 62 | 29 | ||
| @@ -97,7 +64,7 @@ struct lock_class { | |||
| 97 | * IRQ/softirq usage tracking bits: | 64 | * IRQ/softirq usage tracking bits: |
| 98 | */ | 65 | */ |
| 99 | unsigned long usage_mask; | 66 | unsigned long usage_mask; |
| 100 | struct stack_trace usage_traces[LOCK_USAGE_STATES]; | 67 | struct stack_trace usage_traces[XXX_LOCK_USAGE_STATES]; |
| 101 | 68 | ||
| 102 | /* | 69 | /* |
| 103 | * These fields represent a directed graph of lock dependencies, | 70 | * These fields represent a directed graph of lock dependencies, |
| @@ -324,7 +291,11 @@ static inline void lock_set_subclass(struct lockdep_map *lock, | |||
| 324 | lock_set_class(lock, lock->name, lock->key, subclass, ip); | 291 | lock_set_class(lock, lock->name, lock->key, subclass, ip); |
| 325 | } | 292 | } |
| 326 | 293 | ||
| 327 | # define INIT_LOCKDEP .lockdep_recursion = 0, | 294 | extern void lockdep_set_current_reclaim_state(gfp_t gfp_mask); |
| 295 | extern void lockdep_clear_current_reclaim_state(void); | ||
| 296 | extern void lockdep_trace_alloc(gfp_t mask); | ||
| 297 | |||
| 298 | # define INIT_LOCKDEP .lockdep_recursion = 0, .lockdep_reclaim_gfp = 0, | ||
| 328 | 299 | ||
| 329 | #define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) | 300 | #define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) |
| 330 | 301 | ||
| @@ -342,6 +313,9 @@ static inline void lockdep_on(void) | |||
| 342 | # define lock_release(l, n, i) do { } while (0) | 313 | # define lock_release(l, n, i) do { } while (0) |
| 343 | # define lock_set_class(l, n, k, s, i) do { } while (0) | 314 | # define lock_set_class(l, n, k, s, i) do { } while (0) |
| 344 | # define lock_set_subclass(l, s, i) do { } while (0) | 315 | # define lock_set_subclass(l, s, i) do { } while (0) |
| 316 | # define lockdep_set_current_reclaim_state(g) do { } while (0) | ||
| 317 | # define lockdep_clear_current_reclaim_state() do { } while (0) | ||
| 318 | # define lockdep_trace_alloc(g) do { } while (0) | ||
| 345 | # define lockdep_init() do { } while (0) | 319 | # define lockdep_init() do { } while (0) |
| 346 | # define lockdep_info() do { } while (0) | 320 | # define lockdep_info() do { } while (0) |
| 347 | # define lockdep_init_map(lock, name, key, sub) \ | 321 | # define lockdep_init_map(lock, name, key, sub) \ |
diff --git a/include/linux/magic.h b/include/linux/magic.h index 0b4df7eba852..5b4e28bcb788 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
| @@ -49,4 +49,5 @@ | |||
| 49 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA | 49 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA |
| 50 | #define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA | 50 | #define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA |
| 51 | 51 | ||
| 52 | #define STACK_END_MAGIC 0x57AC6E9D | ||
| 52 | #endif /* __LINUX_MAGIC_H__ */ | 53 | #endif /* __LINUX_MAGIC_H__ */ |
diff --git a/include/linux/memory.h b/include/linux/memory.h index 3fdc10806d31..86a6c0f0518d 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
| @@ -99,4 +99,10 @@ enum mem_add_context { BOOT, HOTPLUG }; | |||
| 99 | #define hotplug_memory_notifier(fn, pri) do { } while (0) | 99 | #define hotplug_memory_notifier(fn, pri) do { } while (0) |
| 100 | #endif | 100 | #endif |
| 101 | 101 | ||
| 102 | /* | ||
| 103 | * Kernel text modification mutex, used for code patching. Users of this lock | ||
| 104 | * can sleep. | ||
| 105 | */ | ||
| 106 | extern struct mutex text_mutex; | ||
| 107 | |||
| 102 | #endif /* _LINUX_MEMORY_H_ */ | 108 | #endif /* _LINUX_MEMORY_H_ */ |
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h index 139d7c88d9c9..3d1b7bde1283 100644 --- a/include/linux/mmiotrace.h +++ b/include/linux/mmiotrace.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #ifndef MMIOTRACE_H | 1 | #ifndef _LINUX_MMIOTRACE_H |
| 2 | #define MMIOTRACE_H | 2 | #define _LINUX_MMIOTRACE_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
| @@ -13,28 +13,34 @@ typedef void (*kmmio_post_handler_t)(struct kmmio_probe *, | |||
| 13 | unsigned long condition, struct pt_regs *); | 13 | unsigned long condition, struct pt_regs *); |
| 14 | 14 | ||
| 15 | struct kmmio_probe { | 15 | struct kmmio_probe { |
| 16 | struct list_head list; /* kmmio internal list */ | 16 | /* kmmio internal list: */ |
| 17 | unsigned long addr; /* start location of the probe point */ | 17 | struct list_head list; |
| 18 | unsigned long len; /* length of the probe region */ | 18 | /* start location of the probe point: */ |
| 19 | kmmio_pre_handler_t pre_handler; /* Called before addr is executed. */ | 19 | unsigned long addr; |
| 20 | kmmio_post_handler_t post_handler; /* Called after addr is executed */ | 20 | /* length of the probe region: */ |
| 21 | void *private; | 21 | unsigned long len; |
| 22 | /* Called before addr is executed: */ | ||
| 23 | kmmio_pre_handler_t pre_handler; | ||
| 24 | /* Called after addr is executed: */ | ||
| 25 | kmmio_post_handler_t post_handler; | ||
| 26 | void *private; | ||
| 22 | }; | 27 | }; |
| 23 | 28 | ||
| 29 | extern unsigned int kmmio_count; | ||
| 30 | |||
| 31 | extern int register_kmmio_probe(struct kmmio_probe *p); | ||
| 32 | extern void unregister_kmmio_probe(struct kmmio_probe *p); | ||
| 33 | |||
| 34 | #ifdef CONFIG_MMIOTRACE | ||
| 24 | /* kmmio is active by some kmmio_probes? */ | 35 | /* kmmio is active by some kmmio_probes? */ |
| 25 | static inline int is_kmmio_active(void) | 36 | static inline int is_kmmio_active(void) |
| 26 | { | 37 | { |
| 27 | extern unsigned int kmmio_count; | ||
| 28 | return kmmio_count; | 38 | return kmmio_count; |
| 29 | } | 39 | } |
| 30 | 40 | ||
| 31 | extern int register_kmmio_probe(struct kmmio_probe *p); | ||
| 32 | extern void unregister_kmmio_probe(struct kmmio_probe *p); | ||
| 33 | |||
| 34 | /* Called from page fault handler. */ | 41 | /* Called from page fault handler. */ |
| 35 | extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); | 42 | extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); |
| 36 | 43 | ||
| 37 | #ifdef CONFIG_MMIOTRACE | ||
| 38 | /* Called from ioremap.c */ | 44 | /* Called from ioremap.c */ |
| 39 | extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, | 45 | extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, |
| 40 | void __iomem *addr); | 46 | void __iomem *addr); |
| @@ -43,7 +49,17 @@ extern void mmiotrace_iounmap(volatile void __iomem *addr); | |||
| 43 | /* For anyone to insert markers. Remember trailing newline. */ | 49 | /* For anyone to insert markers. Remember trailing newline. */ |
| 44 | extern int mmiotrace_printk(const char *fmt, ...) | 50 | extern int mmiotrace_printk(const char *fmt, ...) |
| 45 | __attribute__ ((format (printf, 1, 2))); | 51 | __attribute__ ((format (printf, 1, 2))); |
| 46 | #else | 52 | #else /* !CONFIG_MMIOTRACE: */ |
| 53 | static inline int is_kmmio_active(void) | ||
| 54 | { | ||
| 55 | return 0; | ||
| 56 | } | ||
| 57 | |||
| 58 | static inline int kmmio_handler(struct pt_regs *regs, unsigned long addr) | ||
| 59 | { | ||
| 60 | return 0; | ||
| 61 | } | ||
| 62 | |||
| 47 | static inline void mmiotrace_ioremap(resource_size_t offset, | 63 | static inline void mmiotrace_ioremap(resource_size_t offset, |
| 48 | unsigned long size, void __iomem *addr) | 64 | unsigned long size, void __iomem *addr) |
| 49 | { | 65 | { |
| @@ -63,28 +79,28 @@ static inline int mmiotrace_printk(const char *fmt, ...) | |||
| 63 | #endif /* CONFIG_MMIOTRACE */ | 79 | #endif /* CONFIG_MMIOTRACE */ |
| 64 | 80 | ||
| 65 | enum mm_io_opcode { | 81 | enum mm_io_opcode { |
| 66 | MMIO_READ = 0x1, /* struct mmiotrace_rw */ | 82 | MMIO_READ = 0x1, /* struct mmiotrace_rw */ |
| 67 | MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ | 83 | MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ |
| 68 | MMIO_PROBE = 0x3, /* struct mmiotrace_map */ | 84 | MMIO_PROBE = 0x3, /* struct mmiotrace_map */ |
| 69 | MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ | 85 | MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ |
| 70 | MMIO_UNKNOWN_OP = 0x5, /* struct mmiotrace_rw */ | 86 | MMIO_UNKNOWN_OP = 0x5, /* struct mmiotrace_rw */ |
| 71 | }; | 87 | }; |
| 72 | 88 | ||
| 73 | struct mmiotrace_rw { | 89 | struct mmiotrace_rw { |
| 74 | resource_size_t phys; /* PCI address of register */ | 90 | resource_size_t phys; /* PCI address of register */ |
| 75 | unsigned long value; | 91 | unsigned long value; |
| 76 | unsigned long pc; /* optional program counter */ | 92 | unsigned long pc; /* optional program counter */ |
| 77 | int map_id; | 93 | int map_id; |
| 78 | unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */ | 94 | unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */ |
| 79 | unsigned char width; /* size of register access in bytes */ | 95 | unsigned char width; /* size of register access in bytes */ |
| 80 | }; | 96 | }; |
| 81 | 97 | ||
| 82 | struct mmiotrace_map { | 98 | struct mmiotrace_map { |
| 83 | resource_size_t phys; /* base address in PCI space */ | 99 | resource_size_t phys; /* base address in PCI space */ |
| 84 | unsigned long virt; /* base virtual address */ | 100 | unsigned long virt; /* base virtual address */ |
| 85 | unsigned long len; /* mapping size */ | 101 | unsigned long len; /* mapping size */ |
| 86 | int map_id; | 102 | int map_id; |
| 87 | unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */ | 103 | unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */ |
| 88 | }; | 104 | }; |
| 89 | 105 | ||
| 90 | /* in kernel/trace/trace_mmiotrace.c */ | 106 | /* in kernel/trace/trace_mmiotrace.c */ |
| @@ -94,4 +110,4 @@ extern void mmio_trace_rw(struct mmiotrace_rw *rw); | |||
| 94 | extern void mmio_trace_mapping(struct mmiotrace_map *map); | 110 | extern void mmio_trace_mapping(struct mmiotrace_map *map); |
| 95 | extern int mmio_trace_printk(const char *fmt, va_list args); | 111 | extern int mmio_trace_printk(const char *fmt, va_list args); |
| 96 | 112 | ||
| 97 | #endif /* MMIOTRACE_H */ | 113 | #endif /* _LINUX_MMIOTRACE_H */ |
diff --git a/include/linux/module.h b/include/linux/module.h index 145a75528cc1..22d9878e868c 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -329,6 +329,11 @@ struct module | |||
| 329 | unsigned int num_tracepoints; | 329 | unsigned int num_tracepoints; |
| 330 | #endif | 330 | #endif |
| 331 | 331 | ||
| 332 | #ifdef CONFIG_TRACING | ||
| 333 | const char **trace_bprintk_fmt_start; | ||
| 334 | unsigned int num_trace_bprintk_fmt; | ||
| 335 | #endif | ||
| 336 | |||
| 332 | #ifdef CONFIG_MODULE_UNLOAD | 337 | #ifdef CONFIG_MODULE_UNLOAD |
| 333 | /* What modules depend on me? */ | 338 | /* What modules depend on me? */ |
| 334 | struct list_head modules_which_use_me; | 339 | struct list_head modules_which_use_me; |
diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 7a0e5c4f8072..3069ec7e0ab8 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h | |||
| @@ -50,8 +50,10 @@ struct mutex { | |||
| 50 | atomic_t count; | 50 | atomic_t count; |
| 51 | spinlock_t wait_lock; | 51 | spinlock_t wait_lock; |
| 52 | struct list_head wait_list; | 52 | struct list_head wait_list; |
| 53 | #ifdef CONFIG_DEBUG_MUTEXES | 53 | #if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP) |
| 54 | struct thread_info *owner; | 54 | struct thread_info *owner; |
| 55 | #endif | ||
| 56 | #ifdef CONFIG_DEBUG_MUTEXES | ||
| 55 | const char *name; | 57 | const char *name; |
| 56 | void *magic; | 58 | void *magic; |
| 57 | #endif | 59 | #endif |
| @@ -68,7 +70,6 @@ struct mutex_waiter { | |||
| 68 | struct list_head list; | 70 | struct list_head list; |
| 69 | struct task_struct *task; | 71 | struct task_struct *task; |
| 70 | #ifdef CONFIG_DEBUG_MUTEXES | 72 | #ifdef CONFIG_DEBUG_MUTEXES |
| 71 | struct mutex *lock; | ||
| 72 | void *magic; | 73 | void *magic; |
| 73 | #endif | 74 | #endif |
| 74 | }; | 75 | }; |
diff --git a/include/linux/nubus.h b/include/linux/nubus.h index 7382af374731..e137b3c486a7 100644 --- a/include/linux/nubus.h +++ b/include/linux/nubus.h | |||
| @@ -237,6 +237,7 @@ struct nubus_dirent | |||
| 237 | int mask; | 237 | int mask; |
| 238 | }; | 238 | }; |
| 239 | 239 | ||
| 240 | #ifdef __KERNEL__ | ||
| 240 | struct nubus_board { | 241 | struct nubus_board { |
| 241 | struct nubus_board* next; | 242 | struct nubus_board* next; |
| 242 | struct nubus_dev* first_dev; | 243 | struct nubus_dev* first_dev; |
| @@ -351,6 +352,7 @@ void nubus_get_rsrc_mem(void* dest, | |||
| 351 | void nubus_get_rsrc_str(void* dest, | 352 | void nubus_get_rsrc_str(void* dest, |
| 352 | const struct nubus_dirent *dirent, | 353 | const struct nubus_dirent *dirent, |
| 353 | int maxlen); | 354 | int maxlen); |
| 355 | #endif /* __KERNEL__ */ | ||
| 354 | 356 | ||
| 355 | /* We'd like to get rid of this eventually. Only daynaport.c uses it now. */ | 357 | /* We'd like to get rid of this eventually. Only daynaport.c uses it now. */ |
| 356 | static inline void *nubus_slot_addr(int slot) | 358 | static inline void *nubus_slot_addr(int slot) |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 9f2a3751873a..54a968b4b924 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
| @@ -5,53 +5,66 @@ | |||
| 5 | #include <linux/slab.h> /* For kmalloc() */ | 5 | #include <linux/slab.h> /* For kmalloc() */ |
| 6 | #include <linux/smp.h> | 6 | #include <linux/smp.h> |
| 7 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
| 8 | #include <linux/pfn.h> | ||
| 8 | 9 | ||
| 9 | #include <asm/percpu.h> | 10 | #include <asm/percpu.h> |
| 10 | 11 | ||
| 12 | #ifndef PER_CPU_BASE_SECTION | ||
| 13 | #ifdef CONFIG_SMP | ||
| 14 | #define PER_CPU_BASE_SECTION ".data.percpu" | ||
| 15 | #else | ||
| 16 | #define PER_CPU_BASE_SECTION ".data" | ||
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | |||
| 11 | #ifdef CONFIG_SMP | 20 | #ifdef CONFIG_SMP |
| 12 | #define DEFINE_PER_CPU(type, name) \ | ||
| 13 | __attribute__((__section__(".data.percpu"))) \ | ||
| 14 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | ||
| 15 | 21 | ||
| 16 | #ifdef MODULE | 22 | #ifdef MODULE |
| 17 | #define SHARED_ALIGNED_SECTION ".data.percpu" | 23 | #define PER_CPU_SHARED_ALIGNED_SECTION "" |
| 18 | #else | 24 | #else |
| 19 | #define SHARED_ALIGNED_SECTION ".data.percpu.shared_aligned" | 25 | #define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned" |
| 20 | #endif | 26 | #endif |
| 27 | #define PER_CPU_FIRST_SECTION ".first" | ||
| 21 | 28 | ||
| 22 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | 29 | #else |
| 23 | __attribute__((__section__(SHARED_ALIGNED_SECTION))) \ | 30 | |
| 24 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ | 31 | #define PER_CPU_SHARED_ALIGNED_SECTION "" |
| 25 | ____cacheline_aligned_in_smp | 32 | #define PER_CPU_FIRST_SECTION "" |
| 26 | 33 | ||
| 27 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | 34 | #endif |
| 28 | __attribute__((__section__(".data.percpu.page_aligned"))) \ | 35 | |
| 36 | #define DEFINE_PER_CPU_SECTION(type, name, section) \ | ||
| 37 | __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ | ||
| 29 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | 38 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name |
| 30 | #else | 39 | |
| 31 | #define DEFINE_PER_CPU(type, name) \ | 40 | #define DEFINE_PER_CPU(type, name) \ |
| 32 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | 41 | DEFINE_PER_CPU_SECTION(type, name, "") |
| 33 | 42 | ||
| 34 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | 43 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ |
| 35 | DEFINE_PER_CPU(type, name) | 44 | DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ |
| 45 | ____cacheline_aligned_in_smp | ||
| 36 | 46 | ||
| 37 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | 47 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ |
| 38 | DEFINE_PER_CPU(type, name) | 48 | DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") |
| 39 | #endif | 49 | |
| 50 | #define DEFINE_PER_CPU_FIRST(type, name) \ | ||
| 51 | DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION) | ||
| 40 | 52 | ||
| 41 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | 53 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) |
| 42 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) | 54 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) |
| 43 | 55 | ||
| 44 | /* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ | 56 | /* enough to cover all DEFINE_PER_CPUs in modules */ |
| 45 | #ifndef PERCPU_ENOUGH_ROOM | ||
| 46 | #ifdef CONFIG_MODULES | 57 | #ifdef CONFIG_MODULES |
| 47 | #define PERCPU_MODULE_RESERVE 8192 | 58 | #define PERCPU_MODULE_RESERVE (8 << 10) |
| 48 | #else | 59 | #else |
| 49 | #define PERCPU_MODULE_RESERVE 0 | 60 | #define PERCPU_MODULE_RESERVE 0 |
| 50 | #endif | 61 | #endif |
| 51 | 62 | ||
| 63 | #ifndef PERCPU_ENOUGH_ROOM | ||
| 52 | #define PERCPU_ENOUGH_ROOM \ | 64 | #define PERCPU_ENOUGH_ROOM \ |
| 53 | (__per_cpu_end - __per_cpu_start + PERCPU_MODULE_RESERVE) | 65 | (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \ |
| 54 | #endif /* PERCPU_ENOUGH_ROOM */ | 66 | PERCPU_MODULE_RESERVE) |
| 67 | #endif | ||
| 55 | 68 | ||
| 56 | /* | 69 | /* |
| 57 | * Must be an lvalue. Since @var must be a simple identifier, | 70 | * Must be an lvalue. Since @var must be a simple identifier, |
| @@ -65,52 +78,90 @@ | |||
| 65 | 78 | ||
| 66 | #ifdef CONFIG_SMP | 79 | #ifdef CONFIG_SMP |
| 67 | 80 | ||
| 81 | #ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA | ||
| 82 | |||
| 83 | /* minimum unit size, also is the maximum supported allocation size */ | ||
| 84 | #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) | ||
| 85 | |||
| 86 | /* | ||
| 87 | * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy | ||
| 88 | * back on the first chunk for dynamic percpu allocation if arch is | ||
| 89 | * manually allocating and mapping it for faster access (as a part of | ||
| 90 | * large page mapping for example). | ||
| 91 | * | ||
| 92 | * The following values give between one and two pages of free space | ||
| 93 | * after typical minimal boot (2-way SMP, single disk and NIC) with | ||
| 94 | * both defconfig and a distro config on x86_64 and 32. More | ||
| 95 | * intelligent way to determine this would be nice. | ||
| 96 | */ | ||
| 97 | #if BITS_PER_LONG > 32 | ||
| 98 | #define PERCPU_DYNAMIC_RESERVE (20 << 10) | ||
| 99 | #else | ||
| 100 | #define PERCPU_DYNAMIC_RESERVE (12 << 10) | ||
| 101 | #endif | ||
| 102 | |||
| 103 | extern void *pcpu_base_addr; | ||
| 104 | |||
| 105 | typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno); | ||
| 106 | typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr); | ||
| 107 | |||
| 108 | extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, | ||
| 109 | size_t static_size, size_t reserved_size, | ||
| 110 | ssize_t unit_size, ssize_t dyn_size, | ||
| 111 | void *base_addr, | ||
| 112 | pcpu_populate_pte_fn_t populate_pte_fn); | ||
| 113 | |||
| 114 | /* | ||
| 115 | * Use this to get to a cpu's version of the per-cpu object | ||
| 116 | * dynamically allocated. Non-atomic access to the current CPU's | ||
| 117 | * version should probably be combined with get_cpu()/put_cpu(). | ||
| 118 | */ | ||
| 119 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) | ||
| 120 | |||
| 121 | extern void *__alloc_reserved_percpu(size_t size, size_t align); | ||
| 122 | |||
| 123 | #else /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ | ||
| 124 | |||
| 68 | struct percpu_data { | 125 | struct percpu_data { |
| 69 | void *ptrs[1]; | 126 | void *ptrs[1]; |
| 70 | }; | 127 | }; |
| 71 | 128 | ||
| 72 | #define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) | 129 | #define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) |
| 73 | /* | 130 | |
| 74 | * Use this to get to a cpu's version of the per-cpu object dynamically | 131 | #define per_cpu_ptr(ptr, cpu) \ |
| 75 | * allocated. Non-atomic access to the current CPU's version should | 132 | ({ \ |
| 76 | * probably be combined with get_cpu()/put_cpu(). | 133 | struct percpu_data *__p = __percpu_disguise(ptr); \ |
| 77 | */ | 134 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ |
| 78 | #define percpu_ptr(ptr, cpu) \ | ||
| 79 | ({ \ | ||
| 80 | struct percpu_data *__p = __percpu_disguise(ptr); \ | ||
| 81 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ | ||
| 82 | }) | 135 | }) |
| 83 | 136 | ||
| 84 | extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); | 137 | #endif /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ |
| 85 | extern void percpu_free(void *__pdata); | 138 | |
| 139 | extern void *__alloc_percpu(size_t size, size_t align); | ||
| 140 | extern void free_percpu(void *__pdata); | ||
| 86 | 141 | ||
| 87 | #else /* CONFIG_SMP */ | 142 | #else /* CONFIG_SMP */ |
| 88 | 143 | ||
| 89 | #define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) | 144 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) |
| 90 | 145 | ||
| 91 | static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) | 146 | static inline void *__alloc_percpu(size_t size, size_t align) |
| 92 | { | 147 | { |
| 93 | return kzalloc(size, gfp); | 148 | /* |
| 149 | * Can't easily make larger alignment work with kmalloc. WARN | ||
| 150 | * on it. Larger alignment should only be used for module | ||
| 151 | * percpu sections on SMP for which this path isn't used. | ||
| 152 | */ | ||
| 153 | WARN_ON_ONCE(align > SMP_CACHE_BYTES); | ||
| 154 | return kzalloc(size, GFP_KERNEL); | ||
| 94 | } | 155 | } |
| 95 | 156 | ||
| 96 | static inline void percpu_free(void *__pdata) | 157 | static inline void free_percpu(void *p) |
| 97 | { | 158 | { |
| 98 | kfree(__pdata); | 159 | kfree(p); |
| 99 | } | 160 | } |
| 100 | 161 | ||
| 101 | #endif /* CONFIG_SMP */ | 162 | #endif /* CONFIG_SMP */ |
| 102 | 163 | ||
| 103 | #define percpu_alloc_mask(size, gfp, mask) \ | 164 | #define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \ |
| 104 | __percpu_alloc_mask((size), (gfp), &(mask)) | 165 | __alignof__(type)) |
| 105 | |||
| 106 | #define percpu_alloc(size, gfp) percpu_alloc_mask((size), (gfp), cpu_online_map) | ||
| 107 | |||
| 108 | /* (legacy) interface for use without CPU hotplug handling */ | ||
| 109 | |||
| 110 | #define __alloc_percpu(size) percpu_alloc_mask((size), GFP_KERNEL, \ | ||
| 111 | cpu_possible_map) | ||
| 112 | #define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type)) | ||
| 113 | #define free_percpu(ptr) percpu_free((ptr)) | ||
| 114 | #define per_cpu_ptr(ptr, cpu) percpu_ptr((ptr), (cpu)) | ||
| 115 | 166 | ||
| 116 | #endif /* __LINUX_PERCPU_H */ | 167 | #endif /* __LINUX_PERCPU_H */ |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index bc5114d35e99..e356c99f0659 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
| @@ -28,8 +28,6 @@ | |||
| 28 | #include <linux/reiserfs_fs_sb.h> | 28 | #include <linux/reiserfs_fs_sb.h> |
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
| 31 | struct fid; | ||
| 32 | |||
| 33 | /* | 31 | /* |
| 34 | * include/linux/reiser_fs.h | 32 | * include/linux/reiser_fs.h |
| 35 | * | 33 | * |
| @@ -37,6 +35,33 @@ struct fid; | |||
| 37 | * | 35 | * |
| 38 | */ | 36 | */ |
| 39 | 37 | ||
| 38 | /* ioctl's command */ | ||
| 39 | #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) | ||
| 40 | /* define following flags to be the same as in ext2, so that chattr(1), | ||
| 41 | lsattr(1) will work with us. */ | ||
| 42 | #define REISERFS_IOC_GETFLAGS FS_IOC_GETFLAGS | ||
| 43 | #define REISERFS_IOC_SETFLAGS FS_IOC_SETFLAGS | ||
| 44 | #define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION | ||
| 45 | #define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION | ||
| 46 | |||
| 47 | #ifdef __KERNEL__ | ||
| 48 | /* the 32 bit compat definitions with int argument */ | ||
| 49 | #define REISERFS_IOC32_UNPACK _IOW(0xCD, 1, int) | ||
| 50 | #define REISERFS_IOC32_GETFLAGS FS_IOC32_GETFLAGS | ||
| 51 | #define REISERFS_IOC32_SETFLAGS FS_IOC32_SETFLAGS | ||
| 52 | #define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION | ||
| 53 | #define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION | ||
| 54 | |||
| 55 | /* Locking primitives */ | ||
| 56 | /* Right now we are still falling back to (un)lock_kernel, but eventually that | ||
| 57 | would evolve into real per-fs locks */ | ||
| 58 | #define reiserfs_write_lock( sb ) lock_kernel() | ||
| 59 | #define reiserfs_write_unlock( sb ) unlock_kernel() | ||
| 60 | |||
| 61 | /* xattr stuff */ | ||
| 62 | #define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem) | ||
| 63 | struct fid; | ||
| 64 | |||
| 40 | /* in reading the #defines, it may help to understand that they employ | 65 | /* in reading the #defines, it may help to understand that they employ |
| 41 | the following abbreviations: | 66 | the following abbreviations: |
| 42 | 67 | ||
| @@ -698,6 +723,7 @@ static inline void cpu_key_k_offset_dec(struct cpu_key *key) | |||
| 698 | /* object identifier for root dir */ | 723 | /* object identifier for root dir */ |
| 699 | #define REISERFS_ROOT_OBJECTID 2 | 724 | #define REISERFS_ROOT_OBJECTID 2 |
| 700 | #define REISERFS_ROOT_PARENT_OBJECTID 1 | 725 | #define REISERFS_ROOT_PARENT_OBJECTID 1 |
| 726 | |||
| 701 | extern struct reiserfs_key root_key; | 727 | extern struct reiserfs_key root_key; |
| 702 | 728 | ||
| 703 | /* | 729 | /* |
| @@ -1540,7 +1566,6 @@ struct reiserfs_iget_args { | |||
| 1540 | /* FUNCTION DECLARATIONS */ | 1566 | /* FUNCTION DECLARATIONS */ |
| 1541 | /***************************************************************************/ | 1567 | /***************************************************************************/ |
| 1542 | 1568 | ||
| 1543 | /*#ifdef __KERNEL__*/ | ||
| 1544 | #define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12) | 1569 | #define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12) |
| 1545 | 1570 | ||
| 1546 | #define journal_trans_half(blocksize) \ | 1571 | #define journal_trans_half(blocksize) \ |
| @@ -2178,29 +2203,6 @@ long reiserfs_compat_ioctl(struct file *filp, | |||
| 2178 | unsigned int cmd, unsigned long arg); | 2203 | unsigned int cmd, unsigned long arg); |
| 2179 | int reiserfs_unpack(struct inode *inode, struct file *filp); | 2204 | int reiserfs_unpack(struct inode *inode, struct file *filp); |
| 2180 | 2205 | ||
| 2181 | /* ioctl's command */ | ||
| 2182 | #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) | ||
| 2183 | /* define following flags to be the same as in ext2, so that chattr(1), | ||
| 2184 | lsattr(1) will work with us. */ | ||
| 2185 | #define REISERFS_IOC_GETFLAGS FS_IOC_GETFLAGS | ||
| 2186 | #define REISERFS_IOC_SETFLAGS FS_IOC_SETFLAGS | ||
| 2187 | #define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION | ||
| 2188 | #define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION | ||
| 2189 | |||
| 2190 | /* the 32 bit compat definitions with int argument */ | ||
| 2191 | #define REISERFS_IOC32_UNPACK _IOW(0xCD, 1, int) | ||
| 2192 | #define REISERFS_IOC32_GETFLAGS FS_IOC32_GETFLAGS | ||
| 2193 | #define REISERFS_IOC32_SETFLAGS FS_IOC32_SETFLAGS | ||
| 2194 | #define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION | ||
| 2195 | #define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION | ||
| 2196 | |||
| 2197 | /* Locking primitives */ | ||
| 2198 | /* Right now we are still falling back to (un)lock_kernel, but eventually that | ||
| 2199 | would evolve into real per-fs locks */ | ||
| 2200 | #define reiserfs_write_lock( sb ) lock_kernel() | ||
| 2201 | #define reiserfs_write_unlock( sb ) unlock_kernel() | ||
| 2202 | |||
| 2203 | /* xattr stuff */ | ||
| 2204 | #define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem) | ||
| 2205 | 2206 | ||
| 2207 | #endif /* __KERNEL__ */ | ||
| 2206 | #endif /* _LINUX_REISER_FS_H */ | 2208 | #endif /* _LINUX_REISER_FS_H */ |
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index b3b359660082..b1a0068a5557 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
| @@ -8,7 +8,7 @@ struct ring_buffer; | |||
| 8 | struct ring_buffer_iter; | 8 | struct ring_buffer_iter; |
| 9 | 9 | ||
| 10 | /* | 10 | /* |
| 11 | * Don't reference this struct directly, use functions below. | 11 | * Don't refer to this struct directly, use functions below. |
| 12 | */ | 12 | */ |
| 13 | struct ring_buffer_event { | 13 | struct ring_buffer_event { |
| 14 | u32 type:2, len:3, time_delta:27; | 14 | u32 type:2, len:3, time_delta:27; |
| @@ -74,13 +74,10 @@ void ring_buffer_free(struct ring_buffer *buffer); | |||
| 74 | 74 | ||
| 75 | int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); | 75 | int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); |
| 76 | 76 | ||
| 77 | struct ring_buffer_event * | 77 | struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer, |
| 78 | ring_buffer_lock_reserve(struct ring_buffer *buffer, | 78 | unsigned long length); |
| 79 | unsigned long length, | ||
| 80 | unsigned long *flags); | ||
| 81 | int ring_buffer_unlock_commit(struct ring_buffer *buffer, | 79 | int ring_buffer_unlock_commit(struct ring_buffer *buffer, |
| 82 | struct ring_buffer_event *event, | 80 | struct ring_buffer_event *event); |
| 83 | unsigned long flags); | ||
| 84 | int ring_buffer_write(struct ring_buffer *buffer, | 81 | int ring_buffer_write(struct ring_buffer *buffer, |
| 85 | unsigned long length, void *data); | 82 | unsigned long length, void *data); |
| 86 | 83 | ||
| @@ -124,14 +121,13 @@ unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); | |||
| 124 | u64 ring_buffer_time_stamp(int cpu); | 121 | u64 ring_buffer_time_stamp(int cpu); |
| 125 | void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); | 122 | void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); |
| 126 | 123 | ||
| 127 | void tracing_on(void); | 124 | size_t ring_buffer_page_len(void *page); |
| 128 | void tracing_off(void); | 125 | |
| 129 | void tracing_off_permanent(void); | ||
| 130 | 126 | ||
| 131 | void *ring_buffer_alloc_read_page(struct ring_buffer *buffer); | 127 | void *ring_buffer_alloc_read_page(struct ring_buffer *buffer); |
| 132 | void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data); | 128 | void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data); |
| 133 | int ring_buffer_read_page(struct ring_buffer *buffer, | 129 | int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page, |
| 134 | void **data_page, int cpu, int full); | 130 | size_t len, int cpu, int full); |
| 135 | 131 | ||
| 136 | enum ring_buffer_flags { | 132 | enum ring_buffer_flags { |
| 137 | RB_FL_OVERWRITE = 1 << 0, | 133 | RB_FL_OVERWRITE = 1 << 0, |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 8c216e057c94..5b9424eaa58f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -137,6 +137,8 @@ extern unsigned long nr_uninterruptible(void); | |||
| 137 | extern unsigned long nr_active(void); | 137 | extern unsigned long nr_active(void); |
| 138 | extern unsigned long nr_iowait(void); | 138 | extern unsigned long nr_iowait(void); |
| 139 | 139 | ||
| 140 | extern unsigned long get_parent_ip(unsigned long addr); | ||
| 141 | |||
| 140 | struct seq_file; | 142 | struct seq_file; |
| 141 | struct cfs_rq; | 143 | struct cfs_rq; |
| 142 | struct task_group; | 144 | struct task_group; |
| @@ -331,7 +333,9 @@ extern signed long schedule_timeout(signed long timeout); | |||
| 331 | extern signed long schedule_timeout_interruptible(signed long timeout); | 333 | extern signed long schedule_timeout_interruptible(signed long timeout); |
| 332 | extern signed long schedule_timeout_killable(signed long timeout); | 334 | extern signed long schedule_timeout_killable(signed long timeout); |
| 333 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | 335 | extern signed long schedule_timeout_uninterruptible(signed long timeout); |
| 336 | asmlinkage void __schedule(void); | ||
| 334 | asmlinkage void schedule(void); | 337 | asmlinkage void schedule(void); |
| 338 | extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner); | ||
| 335 | 339 | ||
| 336 | struct nsproxy; | 340 | struct nsproxy; |
| 337 | struct user_namespace; | 341 | struct user_namespace; |
| @@ -1178,10 +1182,9 @@ struct task_struct { | |||
| 1178 | pid_t pid; | 1182 | pid_t pid; |
| 1179 | pid_t tgid; | 1183 | pid_t tgid; |
| 1180 | 1184 | ||
| 1181 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
| 1182 | /* Canary value for the -fstack-protector gcc feature */ | 1185 | /* Canary value for the -fstack-protector gcc feature */ |
| 1183 | unsigned long stack_canary; | 1186 | unsigned long stack_canary; |
| 1184 | #endif | 1187 | |
| 1185 | /* | 1188 | /* |
| 1186 | * pointers to (original) parent process, youngest child, younger sibling, | 1189 | * pointers to (original) parent process, youngest child, younger sibling, |
| 1187 | * older sibling, respectively. (p->father can be replaced with | 1190 | * older sibling, respectively. (p->father can be replaced with |
| @@ -1328,6 +1331,7 @@ struct task_struct { | |||
| 1328 | int lockdep_depth; | 1331 | int lockdep_depth; |
| 1329 | unsigned int lockdep_recursion; | 1332 | unsigned int lockdep_recursion; |
| 1330 | struct held_lock held_locks[MAX_LOCK_DEPTH]; | 1333 | struct held_lock held_locks[MAX_LOCK_DEPTH]; |
| 1334 | gfp_t lockdep_reclaim_gfp; | ||
| 1331 | #endif | 1335 | #endif |
| 1332 | 1336 | ||
| 1333 | /* journalling filesystem info */ | 1337 | /* journalling filesystem info */ |
| @@ -1670,6 +1674,16 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) | |||
| 1670 | return set_cpus_allowed_ptr(p, &new_mask); | 1674 | return set_cpus_allowed_ptr(p, &new_mask); |
| 1671 | } | 1675 | } |
| 1672 | 1676 | ||
| 1677 | /* | ||
| 1678 | * Architectures can set this to 1 if they have specified | ||
| 1679 | * CONFIG_HAVE_UNSTABLE_SCHED_CLOCK in their arch Kconfig, | ||
| 1680 | * but then during bootup it turns out that sched_clock() | ||
| 1681 | * is reliable after all: | ||
| 1682 | */ | ||
| 1683 | #ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK | ||
| 1684 | extern int sched_clock_stable; | ||
| 1685 | #endif | ||
| 1686 | |||
| 1673 | extern unsigned long long sched_clock(void); | 1687 | extern unsigned long long sched_clock(void); |
| 1674 | 1688 | ||
| 1675 | extern void sched_clock_init(void); | 1689 | extern void sched_clock_init(void); |
| @@ -2087,6 +2101,19 @@ static inline int object_is_on_stack(void *obj) | |||
| 2087 | 2101 | ||
| 2088 | extern void thread_info_cache_init(void); | 2102 | extern void thread_info_cache_init(void); |
| 2089 | 2103 | ||
| 2104 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
| 2105 | static inline unsigned long stack_not_used(struct task_struct *p) | ||
| 2106 | { | ||
| 2107 | unsigned long *n = end_of_stack(p); | ||
| 2108 | |||
| 2109 | do { /* Skip over canary */ | ||
| 2110 | n++; | ||
| 2111 | } while (!*n); | ||
| 2112 | |||
| 2113 | return (unsigned long)n - (unsigned long)end_of_stack(p); | ||
| 2114 | } | ||
| 2115 | #endif | ||
| 2116 | |||
| 2090 | /* set thread flags in other task's structures | 2117 | /* set thread flags in other task's structures |
| 2091 | * - see asm/thread_info.h for TIF_xxxx flags available | 2118 | * - see asm/thread_info.h for TIF_xxxx flags available |
| 2092 | */ | 2119 | */ |
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 6ca6a7b66d75..f4523651fa42 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ | 14 | #include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ |
| 15 | #include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ | 15 | #include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ |
| 16 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
| 17 | #include <trace/kmemtrace.h> | ||
| 17 | 18 | ||
| 18 | /* Size description struct for general caches. */ | 19 | /* Size description struct for general caches. */ |
| 19 | struct cache_sizes { | 20 | struct cache_sizes { |
| @@ -28,8 +29,26 @@ extern struct cache_sizes malloc_sizes[]; | |||
| 28 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); | 29 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); |
| 29 | void *__kmalloc(size_t size, gfp_t flags); | 30 | void *__kmalloc(size_t size, gfp_t flags); |
| 30 | 31 | ||
| 31 | static inline void *kmalloc(size_t size, gfp_t flags) | 32 | #ifdef CONFIG_KMEMTRACE |
| 33 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags); | ||
| 34 | extern size_t slab_buffer_size(struct kmem_cache *cachep); | ||
| 35 | #else | ||
| 36 | static __always_inline void * | ||
| 37 | kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags) | ||
| 32 | { | 38 | { |
| 39 | return kmem_cache_alloc(cachep, flags); | ||
| 40 | } | ||
| 41 | static inline size_t slab_buffer_size(struct kmem_cache *cachep) | ||
| 42 | { | ||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | #endif | ||
| 46 | |||
| 47 | static __always_inline void *kmalloc(size_t size, gfp_t flags) | ||
| 48 | { | ||
| 49 | struct kmem_cache *cachep; | ||
| 50 | void *ret; | ||
| 51 | |||
| 33 | if (__builtin_constant_p(size)) { | 52 | if (__builtin_constant_p(size)) { |
| 34 | int i = 0; | 53 | int i = 0; |
| 35 | 54 | ||
| @@ -47,10 +66,17 @@ static inline void *kmalloc(size_t size, gfp_t flags) | |||
| 47 | found: | 66 | found: |
| 48 | #ifdef CONFIG_ZONE_DMA | 67 | #ifdef CONFIG_ZONE_DMA |
| 49 | if (flags & GFP_DMA) | 68 | if (flags & GFP_DMA) |
| 50 | return kmem_cache_alloc(malloc_sizes[i].cs_dmacachep, | 69 | cachep = malloc_sizes[i].cs_dmacachep; |
| 51 | flags); | 70 | else |
| 52 | #endif | 71 | #endif |
| 53 | return kmem_cache_alloc(malloc_sizes[i].cs_cachep, flags); | 72 | cachep = malloc_sizes[i].cs_cachep; |
| 73 | |||
| 74 | ret = kmem_cache_alloc_notrace(cachep, flags); | ||
| 75 | |||
| 76 | kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret, | ||
| 77 | size, slab_buffer_size(cachep), flags); | ||
| 78 | |||
| 79 | return ret; | ||
| 54 | } | 80 | } |
| 55 | return __kmalloc(size, flags); | 81 | return __kmalloc(size, flags); |
| 56 | } | 82 | } |
| @@ -59,8 +85,25 @@ found: | |||
| 59 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); | 85 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); |
| 60 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 86 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
| 61 | 87 | ||
| 62 | static inline void *kmalloc_node(size_t size, gfp_t flags, int node) | 88 | #ifdef CONFIG_KMEMTRACE |
| 89 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep, | ||
| 90 | gfp_t flags, | ||
| 91 | int nodeid); | ||
| 92 | #else | ||
| 93 | static __always_inline void * | ||
| 94 | kmem_cache_alloc_node_notrace(struct kmem_cache *cachep, | ||
| 95 | gfp_t flags, | ||
| 96 | int nodeid) | ||
| 97 | { | ||
| 98 | return kmem_cache_alloc_node(cachep, flags, nodeid); | ||
| 99 | } | ||
| 100 | #endif | ||
| 101 | |||
| 102 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) | ||
| 63 | { | 103 | { |
| 104 | struct kmem_cache *cachep; | ||
| 105 | void *ret; | ||
| 106 | |||
| 64 | if (__builtin_constant_p(size)) { | 107 | if (__builtin_constant_p(size)) { |
| 65 | int i = 0; | 108 | int i = 0; |
| 66 | 109 | ||
| @@ -78,11 +121,18 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node) | |||
| 78 | found: | 121 | found: |
| 79 | #ifdef CONFIG_ZONE_DMA | 122 | #ifdef CONFIG_ZONE_DMA |
| 80 | if (flags & GFP_DMA) | 123 | if (flags & GFP_DMA) |
| 81 | return kmem_cache_alloc_node(malloc_sizes[i].cs_dmacachep, | 124 | cachep = malloc_sizes[i].cs_dmacachep; |
| 82 | flags, node); | 125 | else |
| 83 | #endif | 126 | #endif |
| 84 | return kmem_cache_alloc_node(malloc_sizes[i].cs_cachep, | 127 | cachep = malloc_sizes[i].cs_cachep; |
| 85 | flags, node); | 128 | |
| 129 | ret = kmem_cache_alloc_node_notrace(cachep, flags, node); | ||
| 130 | |||
| 131 | kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, | ||
| 132 | ret, size, slab_buffer_size(cachep), | ||
| 133 | flags, node); | ||
| 134 | |||
| 135 | return ret; | ||
| 86 | } | 136 | } |
| 87 | return __kmalloc_node(size, flags, node); | 137 | return __kmalloc_node(size, flags, node); |
| 88 | } | 138 | } |
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h index 59a3fa476ab9..0ec00b39d006 100644 --- a/include/linux/slob_def.h +++ b/include/linux/slob_def.h | |||
| @@ -3,14 +3,15 @@ | |||
| 3 | 3 | ||
| 4 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 4 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
| 5 | 5 | ||
| 6 | static inline void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags) | 6 | static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep, |
| 7 | gfp_t flags) | ||
| 7 | { | 8 | { |
| 8 | return kmem_cache_alloc_node(cachep, flags, -1); | 9 | return kmem_cache_alloc_node(cachep, flags, -1); |
| 9 | } | 10 | } |
| 10 | 11 | ||
| 11 | void *__kmalloc_node(size_t size, gfp_t flags, int node); | 12 | void *__kmalloc_node(size_t size, gfp_t flags, int node); |
| 12 | 13 | ||
| 13 | static inline void *kmalloc_node(size_t size, gfp_t flags, int node) | 14 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) |
| 14 | { | 15 | { |
| 15 | return __kmalloc_node(size, flags, node); | 16 | return __kmalloc_node(size, flags, node); |
| 16 | } | 17 | } |
| @@ -23,12 +24,12 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node) | |||
| 23 | * kmalloc is the normal method of allocating memory | 24 | * kmalloc is the normal method of allocating memory |
| 24 | * in the kernel. | 25 | * in the kernel. |
| 25 | */ | 26 | */ |
| 26 | static inline void *kmalloc(size_t size, gfp_t flags) | 27 | static __always_inline void *kmalloc(size_t size, gfp_t flags) |
| 27 | { | 28 | { |
| 28 | return __kmalloc_node(size, flags, -1); | 29 | return __kmalloc_node(size, flags, -1); |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | static inline void *__kmalloc(size_t size, gfp_t flags) | 32 | static __always_inline void *__kmalloc(size_t size, gfp_t flags) |
| 32 | { | 33 | { |
| 33 | return kmalloc(size, flags); | 34 | return kmalloc(size, flags); |
| 34 | } | 35 | } |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 2f5c16b1aacd..9e3a575b2c30 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <linux/gfp.h> | 10 | #include <linux/gfp.h> |
| 11 | #include <linux/workqueue.h> | 11 | #include <linux/workqueue.h> |
| 12 | #include <linux/kobject.h> | 12 | #include <linux/kobject.h> |
| 13 | #include <trace/kmemtrace.h> | ||
| 13 | 14 | ||
| 14 | enum stat_item { | 15 | enum stat_item { |
| 15 | ALLOC_FASTPATH, /* Allocation from cpu slab */ | 16 | ALLOC_FASTPATH, /* Allocation from cpu slab */ |
| @@ -121,10 +122,23 @@ struct kmem_cache { | |||
| 121 | #define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) | 122 | #define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) |
| 122 | 123 | ||
| 123 | /* | 124 | /* |
| 125 | * Maximum kmalloc object size handled by SLUB. Larger object allocations | ||
| 126 | * are passed through to the page allocator. The page allocator "fastpath" | ||
| 127 | * is relatively slow so we need this value sufficiently high so that | ||
| 128 | * performance critical objects are allocated through the SLUB fastpath. | ||
| 129 | * | ||
| 130 | * This should be dropped to PAGE_SIZE / 2 once the page allocator | ||
| 131 | * "fastpath" becomes competitive with the slab allocator fastpaths. | ||
| 132 | */ | ||
| 133 | #define SLUB_MAX_SIZE (PAGE_SIZE) | ||
| 134 | |||
| 135 | #define SLUB_PAGE_SHIFT (PAGE_SHIFT + 1) | ||
| 136 | |||
| 137 | /* | ||
| 124 | * We keep the general caches in an array of slab caches that are used for | 138 | * We keep the general caches in an array of slab caches that are used for |
| 125 | * 2^x bytes of allocations. | 139 | * 2^x bytes of allocations. |
| 126 | */ | 140 | */ |
| 127 | extern struct kmem_cache kmalloc_caches[PAGE_SHIFT + 1]; | 141 | extern struct kmem_cache kmalloc_caches[SLUB_PAGE_SHIFT]; |
| 128 | 142 | ||
| 129 | /* | 143 | /* |
| 130 | * Sorry that the following has to be that ugly but some versions of GCC | 144 | * Sorry that the following has to be that ugly but some versions of GCC |
| @@ -204,15 +218,33 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size) | |||
| 204 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); | 218 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); |
| 205 | void *__kmalloc(size_t size, gfp_t flags); | 219 | void *__kmalloc(size_t size, gfp_t flags); |
| 206 | 220 | ||
| 221 | #ifdef CONFIG_KMEMTRACE | ||
| 222 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags); | ||
| 223 | #else | ||
| 224 | static __always_inline void * | ||
| 225 | kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags) | ||
| 226 | { | ||
| 227 | return kmem_cache_alloc(s, gfpflags); | ||
| 228 | } | ||
| 229 | #endif | ||
| 230 | |||
| 207 | static __always_inline void *kmalloc_large(size_t size, gfp_t flags) | 231 | static __always_inline void *kmalloc_large(size_t size, gfp_t flags) |
| 208 | { | 232 | { |
| 209 | return (void *)__get_free_pages(flags | __GFP_COMP, get_order(size)); | 233 | unsigned int order = get_order(size); |
| 234 | void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); | ||
| 235 | |||
| 236 | kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret, | ||
| 237 | size, PAGE_SIZE << order, flags); | ||
| 238 | |||
| 239 | return ret; | ||
| 210 | } | 240 | } |
| 211 | 241 | ||
| 212 | static __always_inline void *kmalloc(size_t size, gfp_t flags) | 242 | static __always_inline void *kmalloc(size_t size, gfp_t flags) |
| 213 | { | 243 | { |
| 244 | void *ret; | ||
| 245 | |||
| 214 | if (__builtin_constant_p(size)) { | 246 | if (__builtin_constant_p(size)) { |
| 215 | if (size > PAGE_SIZE) | 247 | if (size > SLUB_MAX_SIZE) |
| 216 | return kmalloc_large(size, flags); | 248 | return kmalloc_large(size, flags); |
| 217 | 249 | ||
| 218 | if (!(flags & SLUB_DMA)) { | 250 | if (!(flags & SLUB_DMA)) { |
| @@ -221,7 +253,13 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) | |||
| 221 | if (!s) | 253 | if (!s) |
| 222 | return ZERO_SIZE_PTR; | 254 | return ZERO_SIZE_PTR; |
| 223 | 255 | ||
| 224 | return kmem_cache_alloc(s, flags); | 256 | ret = kmem_cache_alloc_notrace(s, flags); |
| 257 | |||
| 258 | kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, | ||
| 259 | _THIS_IP_, ret, | ||
| 260 | size, s->size, flags); | ||
| 261 | |||
| 262 | return ret; | ||
| 225 | } | 263 | } |
| 226 | } | 264 | } |
| 227 | return __kmalloc(size, flags); | 265 | return __kmalloc(size, flags); |
| @@ -231,16 +269,38 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) | |||
| 231 | void *__kmalloc_node(size_t size, gfp_t flags, int node); | 269 | void *__kmalloc_node(size_t size, gfp_t flags, int node); |
| 232 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 270 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
| 233 | 271 | ||
| 272 | #ifdef CONFIG_KMEMTRACE | ||
| 273 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s, | ||
| 274 | gfp_t gfpflags, | ||
| 275 | int node); | ||
| 276 | #else | ||
| 277 | static __always_inline void * | ||
| 278 | kmem_cache_alloc_node_notrace(struct kmem_cache *s, | ||
| 279 | gfp_t gfpflags, | ||
| 280 | int node) | ||
| 281 | { | ||
| 282 | return kmem_cache_alloc_node(s, gfpflags, node); | ||
| 283 | } | ||
| 284 | #endif | ||
| 285 | |||
| 234 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) | 286 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) |
| 235 | { | 287 | { |
| 288 | void *ret; | ||
| 289 | |||
| 236 | if (__builtin_constant_p(size) && | 290 | if (__builtin_constant_p(size) && |
| 237 | size <= PAGE_SIZE && !(flags & SLUB_DMA)) { | 291 | size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) { |
| 238 | struct kmem_cache *s = kmalloc_slab(size); | 292 | struct kmem_cache *s = kmalloc_slab(size); |
| 239 | 293 | ||
| 240 | if (!s) | 294 | if (!s) |
| 241 | return ZERO_SIZE_PTR; | 295 | return ZERO_SIZE_PTR; |
| 242 | 296 | ||
| 243 | return kmem_cache_alloc_node(s, flags, node); | 297 | ret = kmem_cache_alloc_node_notrace(s, flags, node); |
| 298 | |||
| 299 | kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC, | ||
| 300 | _THIS_IP_, ret, | ||
| 301 | size, s->size, flags, node); | ||
| 302 | |||
| 303 | return ret; | ||
| 244 | } | 304 | } |
| 245 | return __kmalloc_node(size, flags, node); | 305 | return __kmalloc_node(size, flags, node); |
| 246 | } | 306 | } |
diff --git a/include/linux/smp.h b/include/linux/smp.h index 715196b09d67..bbacb7baa446 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
| @@ -176,6 +176,12 @@ static inline void init_call_single_data(void) | |||
| 176 | #define put_cpu() preempt_enable() | 176 | #define put_cpu() preempt_enable() |
| 177 | #define put_cpu_no_resched() preempt_enable_no_resched() | 177 | #define put_cpu_no_resched() preempt_enable_no_resched() |
| 178 | 178 | ||
| 179 | /* | ||
| 180 | * Callback to arch code if there's nosmp or maxcpus=0 on the | ||
| 181 | * boot command line: | ||
| 182 | */ | ||
| 183 | extern void arch_disable_smp_support(void); | ||
| 184 | |||
| 179 | void smp_setup_processor_id(void); | 185 | void smp_setup_processor_id(void); |
| 180 | 186 | ||
| 181 | #endif /* __LINUX_SMP_H */ | 187 | #endif /* __LINUX_SMP_H */ |
diff --git a/include/linux/socket.h b/include/linux/socket.h index 20fc4bbfca42..afc01909a428 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
| @@ -24,10 +24,12 @@ struct __kernel_sockaddr_storage { | |||
| 24 | #include <linux/types.h> /* pid_t */ | 24 | #include <linux/types.h> /* pid_t */ |
| 25 | #include <linux/compiler.h> /* __user */ | 25 | #include <linux/compiler.h> /* __user */ |
| 26 | 26 | ||
| 27 | #ifdef CONFIG_PROC_FS | 27 | #ifdef __KERNEL__ |
| 28 | # ifdef CONFIG_PROC_FS | ||
| 28 | struct seq_file; | 29 | struct seq_file; |
| 29 | extern void socket_seq_show(struct seq_file *seq); | 30 | extern void socket_seq_show(struct seq_file *seq); |
| 30 | #endif | 31 | # endif |
| 32 | #endif /* __KERNEL__ */ | ||
| 31 | 33 | ||
| 32 | typedef unsigned short sa_family_t; | 34 | typedef unsigned short sa_family_t; |
| 33 | 35 | ||
diff --git a/include/linux/stackprotector.h b/include/linux/stackprotector.h new file mode 100644 index 000000000000..6f3e54c704c0 --- /dev/null +++ b/include/linux/stackprotector.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #ifndef _LINUX_STACKPROTECTOR_H | ||
| 2 | #define _LINUX_STACKPROTECTOR_H 1 | ||
| 3 | |||
| 4 | #include <linux/compiler.h> | ||
| 5 | #include <linux/sched.h> | ||
| 6 | #include <linux/random.h> | ||
| 7 | |||
| 8 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
| 9 | # include <asm/stackprotector.h> | ||
| 10 | #else | ||
| 11 | static inline void boot_init_stack_canary(void) | ||
| 12 | { | ||
| 13 | } | ||
| 14 | #endif | ||
| 15 | |||
| 16 | #endif | ||
diff --git a/include/linux/string.h b/include/linux/string.h index d18fc198aa2f..27ac31784ad2 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <linux/compiler.h> /* for inline */ | 10 | #include <linux/compiler.h> /* for inline */ |
| 11 | #include <linux/types.h> /* for size_t */ | 11 | #include <linux/types.h> /* for size_t */ |
| 12 | #include <linux/stddef.h> /* for NULL */ | 12 | #include <linux/stddef.h> /* for NULL */ |
| 13 | #include <stdarg.h> | ||
| 13 | 14 | ||
| 14 | extern char *strndup_user(const char __user *, long); | 15 | extern char *strndup_user(const char __user *, long); |
| 15 | 16 | ||
| @@ -111,6 +112,12 @@ extern void argv_free(char **argv); | |||
| 111 | 112 | ||
| 112 | extern bool sysfs_streq(const char *s1, const char *s2); | 113 | extern bool sysfs_streq(const char *s1, const char *s2); |
| 113 | 114 | ||
| 115 | #ifdef CONFIG_BINARY_PRINTF | ||
| 116 | int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args); | ||
| 117 | int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf); | ||
| 118 | int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4); | ||
| 119 | #endif | ||
| 120 | |||
| 114 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, | 121 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, |
| 115 | const void *from, size_t available); | 122 | const void *from, size_t available); |
| 116 | 123 | ||
diff --git a/include/linux/timer.h b/include/linux/timer.h index daf9685b861c..51774eb87cc6 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <linux/ktime.h> | 5 | #include <linux/ktime.h> |
| 6 | #include <linux/stddef.h> | 6 | #include <linux/stddef.h> |
| 7 | #include <linux/debugobjects.h> | 7 | #include <linux/debugobjects.h> |
| 8 | #include <linux/stringify.h> | ||
| 8 | 9 | ||
| 9 | struct tvec_base; | 10 | struct tvec_base; |
| 10 | 11 | ||
| @@ -21,52 +22,126 @@ struct timer_list { | |||
| 21 | char start_comm[16]; | 22 | char start_comm[16]; |
| 22 | int start_pid; | 23 | int start_pid; |
| 23 | #endif | 24 | #endif |
| 25 | #ifdef CONFIG_LOCKDEP | ||
| 26 | struct lockdep_map lockdep_map; | ||
| 27 | #endif | ||
| 24 | }; | 28 | }; |
| 25 | 29 | ||
| 26 | extern struct tvec_base boot_tvec_bases; | 30 | extern struct tvec_base boot_tvec_bases; |
| 27 | 31 | ||
| 32 | #ifdef CONFIG_LOCKDEP | ||
| 33 | /* | ||
| 34 | * NB: because we have to copy the lockdep_map, setting the lockdep_map key | ||
| 35 | * (second argument) here is required, otherwise it could be initialised to | ||
| 36 | * the copy of the lockdep_map later! We use the pointer to and the string | ||
| 37 | * "<file>:<line>" as the key resp. the name of the lockdep_map. | ||
| 38 | */ | ||
| 39 | #define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn) \ | ||
| 40 | .lockdep_map = STATIC_LOCKDEP_MAP_INIT(_kn, &_kn), | ||
| 41 | #else | ||
| 42 | #define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn) | ||
| 43 | #endif | ||
| 44 | |||
| 28 | #define TIMER_INITIALIZER(_function, _expires, _data) { \ | 45 | #define TIMER_INITIALIZER(_function, _expires, _data) { \ |
| 29 | .entry = { .prev = TIMER_ENTRY_STATIC }, \ | 46 | .entry = { .prev = TIMER_ENTRY_STATIC }, \ |
| 30 | .function = (_function), \ | 47 | .function = (_function), \ |
| 31 | .expires = (_expires), \ | 48 | .expires = (_expires), \ |
| 32 | .data = (_data), \ | 49 | .data = (_data), \ |
| 33 | .base = &boot_tvec_bases, \ | 50 | .base = &boot_tvec_bases, \ |
| 51 | __TIMER_LOCKDEP_MAP_INITIALIZER( \ | ||
| 52 | __FILE__ ":" __stringify(__LINE__)) \ | ||
| 34 | } | 53 | } |
| 35 | 54 | ||
| 36 | #define DEFINE_TIMER(_name, _function, _expires, _data) \ | 55 | #define DEFINE_TIMER(_name, _function, _expires, _data) \ |
| 37 | struct timer_list _name = \ | 56 | struct timer_list _name = \ |
| 38 | TIMER_INITIALIZER(_function, _expires, _data) | 57 | TIMER_INITIALIZER(_function, _expires, _data) |
| 39 | 58 | ||
| 40 | void init_timer(struct timer_list *timer); | 59 | void init_timer_key(struct timer_list *timer, |
| 41 | void init_timer_deferrable(struct timer_list *timer); | 60 | const char *name, |
| 61 | struct lock_class_key *key); | ||
| 62 | void init_timer_deferrable_key(struct timer_list *timer, | ||
| 63 | const char *name, | ||
| 64 | struct lock_class_key *key); | ||
| 65 | |||
| 66 | #ifdef CONFIG_LOCKDEP | ||
| 67 | #define init_timer(timer) \ | ||
| 68 | do { \ | ||
| 69 | static struct lock_class_key __key; \ | ||
| 70 | init_timer_key((timer), #timer, &__key); \ | ||
| 71 | } while (0) | ||
| 72 | |||
| 73 | #define init_timer_deferrable(timer) \ | ||
| 74 | do { \ | ||
| 75 | static struct lock_class_key __key; \ | ||
| 76 | init_timer_deferrable_key((timer), #timer, &__key); \ | ||
| 77 | } while (0) | ||
| 78 | |||
| 79 | #define init_timer_on_stack(timer) \ | ||
| 80 | do { \ | ||
| 81 | static struct lock_class_key __key; \ | ||
| 82 | init_timer_on_stack_key((timer), #timer, &__key); \ | ||
| 83 | } while (0) | ||
| 84 | |||
| 85 | #define setup_timer(timer, fn, data) \ | ||
| 86 | do { \ | ||
| 87 | static struct lock_class_key __key; \ | ||
| 88 | setup_timer_key((timer), #timer, &__key, (fn), (data));\ | ||
| 89 | } while (0) | ||
| 90 | |||
| 91 | #define setup_timer_on_stack(timer, fn, data) \ | ||
| 92 | do { \ | ||
| 93 | static struct lock_class_key __key; \ | ||
| 94 | setup_timer_on_stack_key((timer), #timer, &__key, \ | ||
| 95 | (fn), (data)); \ | ||
| 96 | } while (0) | ||
| 97 | #else | ||
| 98 | #define init_timer(timer)\ | ||
| 99 | init_timer_key((timer), NULL, NULL) | ||
| 100 | #define init_timer_deferrable(timer)\ | ||
| 101 | init_timer_deferrable_key((timer), NULL, NULL) | ||
| 102 | #define init_timer_on_stack(timer)\ | ||
| 103 | init_timer_on_stack_key((timer), NULL, NULL) | ||
| 104 | #define setup_timer(timer, fn, data)\ | ||
| 105 | setup_timer_key((timer), NULL, NULL, (fn), (data)) | ||
| 106 | #define setup_timer_on_stack(timer, fn, data)\ | ||
| 107 | setup_timer_on_stack_key((timer), NULL, NULL, (fn), (data)) | ||
| 108 | #endif | ||
| 42 | 109 | ||
| 43 | #ifdef CONFIG_DEBUG_OBJECTS_TIMERS | 110 | #ifdef CONFIG_DEBUG_OBJECTS_TIMERS |
| 44 | extern void init_timer_on_stack(struct timer_list *timer); | 111 | extern void init_timer_on_stack_key(struct timer_list *timer, |
| 112 | const char *name, | ||
| 113 | struct lock_class_key *key); | ||
| 45 | extern void destroy_timer_on_stack(struct timer_list *timer); | 114 | extern void destroy_timer_on_stack(struct timer_list *timer); |
| 46 | #else | 115 | #else |
| 47 | static inline void destroy_timer_on_stack(struct timer_list *timer) { } | 116 | static inline void destroy_timer_on_stack(struct timer_list *timer) { } |
| 48 | static inline void init_timer_on_stack(struct timer_list *timer) | 117 | static inline void init_timer_on_stack_key(struct timer_list *timer, |
| 118 | const char *name, | ||
| 119 | struct lock_class_key *key) | ||
| 49 | { | 120 | { |
| 50 | init_timer(timer); | 121 | init_timer_key(timer, name, key); |
| 51 | } | 122 | } |
| 52 | #endif | 123 | #endif |
| 53 | 124 | ||
| 54 | static inline void setup_timer(struct timer_list * timer, | 125 | static inline void setup_timer_key(struct timer_list * timer, |
| 126 | const char *name, | ||
| 127 | struct lock_class_key *key, | ||
| 55 | void (*function)(unsigned long), | 128 | void (*function)(unsigned long), |
| 56 | unsigned long data) | 129 | unsigned long data) |
| 57 | { | 130 | { |
| 58 | timer->function = function; | 131 | timer->function = function; |
| 59 | timer->data = data; | 132 | timer->data = data; |
| 60 | init_timer(timer); | 133 | init_timer_key(timer, name, key); |
| 61 | } | 134 | } |
| 62 | 135 | ||
| 63 | static inline void setup_timer_on_stack(struct timer_list *timer, | 136 | static inline void setup_timer_on_stack_key(struct timer_list *timer, |
| 137 | const char *name, | ||
| 138 | struct lock_class_key *key, | ||
| 64 | void (*function)(unsigned long), | 139 | void (*function)(unsigned long), |
| 65 | unsigned long data) | 140 | unsigned long data) |
| 66 | { | 141 | { |
| 67 | timer->function = function; | 142 | timer->function = function; |
| 68 | timer->data = data; | 143 | timer->data = data; |
| 69 | init_timer_on_stack(timer); | 144 | init_timer_on_stack_key(timer, name, key); |
| 70 | } | 145 | } |
| 71 | 146 | ||
| 72 | /** | 147 | /** |
diff --git a/include/linux/topology.h b/include/linux/topology.h index e632d29f0544..a16b9e06f2e5 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
| @@ -193,5 +193,11 @@ int arch_update_cpu_topology(void); | |||
| 193 | #ifndef topology_core_siblings | 193 | #ifndef topology_core_siblings |
| 194 | #define topology_core_siblings(cpu) cpumask_of_cpu(cpu) | 194 | #define topology_core_siblings(cpu) cpumask_of_cpu(cpu) |
| 195 | #endif | 195 | #endif |
| 196 | #ifndef topology_thread_cpumask | ||
| 197 | #define topology_thread_cpumask(cpu) cpumask_of(cpu) | ||
| 198 | #endif | ||
| 199 | #ifndef topology_core_cpumask | ||
| 200 | #define topology_core_cpumask(cpu) cpumask_of(cpu) | ||
| 201 | #endif | ||
| 196 | 202 | ||
| 197 | #endif /* _LINUX_TOPOLOGY_H */ | 203 | #endif /* _LINUX_TOPOLOGY_H */ |
diff --git a/include/linux/trace_clock.h b/include/linux/trace_clock.h new file mode 100644 index 000000000000..7a8130384087 --- /dev/null +++ b/include/linux/trace_clock.h | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #ifndef _LINUX_TRACE_CLOCK_H | ||
| 2 | #define _LINUX_TRACE_CLOCK_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * 3 trace clock variants, with differing scalability/precision | ||
| 6 | * tradeoffs: | ||
| 7 | * | ||
| 8 | * - local: CPU-local trace clock | ||
| 9 | * - medium: scalable global clock with some jitter | ||
| 10 | * - global: globally monotonic, serialized clock | ||
| 11 | */ | ||
| 12 | #include <linux/compiler.h> | ||
| 13 | #include <linux/types.h> | ||
| 14 | |||
| 15 | extern u64 notrace trace_clock_local(void); | ||
| 16 | extern u64 notrace trace_clock(void); | ||
| 17 | extern u64 notrace trace_clock_global(void); | ||
| 18 | |||
| 19 | #endif /* _LINUX_TRACE_CLOCK_H */ | ||
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 757005458366..69b56988813d 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
| @@ -31,8 +31,8 @@ struct tracepoint { | |||
| 31 | * Keep in sync with vmlinux.lds.h. | 31 | * Keep in sync with vmlinux.lds.h. |
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | #define TPPROTO(args...) args | 34 | #define TP_PROTO(args...) args |
| 35 | #define TPARGS(args...) args | 35 | #define TP_ARGS(args...) args |
| 36 | 36 | ||
| 37 | #ifdef CONFIG_TRACEPOINTS | 37 | #ifdef CONFIG_TRACEPOINTS |
| 38 | 38 | ||
| @@ -65,7 +65,7 @@ struct tracepoint { | |||
| 65 | { \ | 65 | { \ |
| 66 | if (unlikely(__tracepoint_##name.state)) \ | 66 | if (unlikely(__tracepoint_##name.state)) \ |
| 67 | __DO_TRACE(&__tracepoint_##name, \ | 67 | __DO_TRACE(&__tracepoint_##name, \ |
| 68 | TPPROTO(proto), TPARGS(args)); \ | 68 | TP_PROTO(proto), TP_ARGS(args)); \ |
| 69 | } \ | 69 | } \ |
| 70 | static inline int register_trace_##name(void (*probe)(proto)) \ | 70 | static inline int register_trace_##name(void (*probe)(proto)) \ |
| 71 | { \ | 71 | { \ |
| @@ -153,4 +153,11 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 153 | synchronize_sched(); | 153 | synchronize_sched(); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | #define PARAMS(args...) args | ||
| 157 | #define TRACE_FORMAT(name, proto, args, fmt) \ | ||
| 158 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | ||
| 159 | |||
| 160 | #define TRACE_EVENT(name, proto, args, struct, print, assign) \ | ||
| 161 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | ||
| 162 | |||
| 156 | #endif | 163 | #endif |
diff --git a/include/linux/types.h b/include/linux/types.h index 712ca53bc348..fca82ed55f49 100644 --- a/include/linux/types.h +++ b/include/linux/types.h | |||
| @@ -1,6 +1,9 @@ | |||
| 1 | #ifndef _LINUX_TYPES_H | 1 | #ifndef _LINUX_TYPES_H |
| 2 | #define _LINUX_TYPES_H | 2 | #define _LINUX_TYPES_H |
| 3 | 3 | ||
| 4 | #include <asm/types.h> | ||
| 5 | |||
| 6 | #ifndef __ASSEMBLY__ | ||
| 4 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 5 | 8 | ||
| 6 | #define DECLARE_BITMAP(name,bits) \ | 9 | #define DECLARE_BITMAP(name,bits) \ |
| @@ -9,7 +12,6 @@ | |||
| 9 | #endif | 12 | #endif |
| 10 | 13 | ||
| 11 | #include <linux/posix_types.h> | 14 | #include <linux/posix_types.h> |
| 12 | #include <asm/types.h> | ||
| 13 | 15 | ||
| 14 | #ifndef __KERNEL_STRICT_NAMES | 16 | #ifndef __KERNEL_STRICT_NAMES |
| 15 | 17 | ||
| @@ -212,5 +214,5 @@ struct ustat { | |||
| 212 | }; | 214 | }; |
| 213 | 215 | ||
| 214 | #endif /* __KERNEL__ */ | 216 | #endif /* __KERNEL__ */ |
| 215 | 217 | #endif /* __ASSEMBLY__ */ | |
| 216 | #endif /* _LINUX_TYPES_H */ | 218 | #endif /* _LINUX_TYPES_H */ |
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 9c0890c7a06a..a43ebec3a7b9 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
| @@ -95,6 +95,9 @@ extern struct vm_struct *remove_vm_area(const void *addr); | |||
| 95 | 95 | ||
| 96 | extern int map_vm_area(struct vm_struct *area, pgprot_t prot, | 96 | extern int map_vm_area(struct vm_struct *area, pgprot_t prot, |
| 97 | struct page ***pages); | 97 | struct page ***pages); |
| 98 | extern int map_kernel_range_noflush(unsigned long start, unsigned long size, | ||
| 99 | pgprot_t prot, struct page **pages); | ||
| 100 | extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size); | ||
| 98 | extern void unmap_kernel_range(unsigned long addr, unsigned long size); | 101 | extern void unmap_kernel_range(unsigned long addr, unsigned long size); |
| 99 | 102 | ||
| 100 | /* Allocate/destroy a 'vmalloc' VM area. */ | 103 | /* Allocate/destroy a 'vmalloc' VM area. */ |
| @@ -110,5 +113,6 @@ extern long vwrite(char *buf, char *addr, unsigned long count); | |||
| 110 | */ | 113 | */ |
| 111 | extern rwlock_t vmlist_lock; | 114 | extern rwlock_t vmlist_lock; |
| 112 | extern struct vm_struct *vmlist; | 115 | extern struct vm_struct *vmlist; |
| 116 | extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); | ||
| 113 | 117 | ||
| 114 | #endif /* _LINUX_VMALLOC_H */ | 118 | #endif /* _LINUX_VMALLOC_H */ |
diff --git a/include/trace/block.h b/include/trace/block.h index 25c6a1fd5b77..25b7068b819e 100644 --- a/include/trace/block.h +++ b/include/trace/block.h | |||
| @@ -5,72 +5,72 @@ | |||
| 5 | #include <linux/tracepoint.h> | 5 | #include <linux/tracepoint.h> |
| 6 | 6 | ||
| 7 | DECLARE_TRACE(block_rq_abort, | 7 | DECLARE_TRACE(block_rq_abort, |
| 8 | TPPROTO(struct request_queue *q, struct request *rq), | 8 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 9 | TPARGS(q, rq)); | 9 | TP_ARGS(q, rq)); |
| 10 | 10 | ||
| 11 | DECLARE_TRACE(block_rq_insert, | 11 | DECLARE_TRACE(block_rq_insert, |
| 12 | TPPROTO(struct request_queue *q, struct request *rq), | 12 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 13 | TPARGS(q, rq)); | 13 | TP_ARGS(q, rq)); |
| 14 | 14 | ||
| 15 | DECLARE_TRACE(block_rq_issue, | 15 | DECLARE_TRACE(block_rq_issue, |
| 16 | TPPROTO(struct request_queue *q, struct request *rq), | 16 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 17 | TPARGS(q, rq)); | 17 | TP_ARGS(q, rq)); |
| 18 | 18 | ||
| 19 | DECLARE_TRACE(block_rq_requeue, | 19 | DECLARE_TRACE(block_rq_requeue, |
| 20 | TPPROTO(struct request_queue *q, struct request *rq), | 20 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 21 | TPARGS(q, rq)); | 21 | TP_ARGS(q, rq)); |
| 22 | 22 | ||
| 23 | DECLARE_TRACE(block_rq_complete, | 23 | DECLARE_TRACE(block_rq_complete, |
| 24 | TPPROTO(struct request_queue *q, struct request *rq), | 24 | TP_PROTO(struct request_queue *q, struct request *rq), |
| 25 | TPARGS(q, rq)); | 25 | TP_ARGS(q, rq)); |
| 26 | 26 | ||
| 27 | DECLARE_TRACE(block_bio_bounce, | 27 | DECLARE_TRACE(block_bio_bounce, |
| 28 | TPPROTO(struct request_queue *q, struct bio *bio), | 28 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 29 | TPARGS(q, bio)); | 29 | TP_ARGS(q, bio)); |
| 30 | 30 | ||
| 31 | DECLARE_TRACE(block_bio_complete, | 31 | DECLARE_TRACE(block_bio_complete, |
| 32 | TPPROTO(struct request_queue *q, struct bio *bio), | 32 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 33 | TPARGS(q, bio)); | 33 | TP_ARGS(q, bio)); |
| 34 | 34 | ||
| 35 | DECLARE_TRACE(block_bio_backmerge, | 35 | DECLARE_TRACE(block_bio_backmerge, |
| 36 | TPPROTO(struct request_queue *q, struct bio *bio), | 36 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 37 | TPARGS(q, bio)); | 37 | TP_ARGS(q, bio)); |
| 38 | 38 | ||
| 39 | DECLARE_TRACE(block_bio_frontmerge, | 39 | DECLARE_TRACE(block_bio_frontmerge, |
| 40 | TPPROTO(struct request_queue *q, struct bio *bio), | 40 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 41 | TPARGS(q, bio)); | 41 | TP_ARGS(q, bio)); |
| 42 | 42 | ||
| 43 | DECLARE_TRACE(block_bio_queue, | 43 | DECLARE_TRACE(block_bio_queue, |
| 44 | TPPROTO(struct request_queue *q, struct bio *bio), | 44 | TP_PROTO(struct request_queue *q, struct bio *bio), |
| 45 | TPARGS(q, bio)); | 45 | TP_ARGS(q, bio)); |
| 46 | 46 | ||
| 47 | DECLARE_TRACE(block_getrq, | 47 | DECLARE_TRACE(block_getrq, |
| 48 | TPPROTO(struct request_queue *q, struct bio *bio, int rw), | 48 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 49 | TPARGS(q, bio, rw)); | 49 | TP_ARGS(q, bio, rw)); |
| 50 | 50 | ||
| 51 | DECLARE_TRACE(block_sleeprq, | 51 | DECLARE_TRACE(block_sleeprq, |
| 52 | TPPROTO(struct request_queue *q, struct bio *bio, int rw), | 52 | TP_PROTO(struct request_queue *q, struct bio *bio, int rw), |
| 53 | TPARGS(q, bio, rw)); | 53 | TP_ARGS(q, bio, rw)); |
| 54 | 54 | ||
| 55 | DECLARE_TRACE(block_plug, | 55 | DECLARE_TRACE(block_plug, |
| 56 | TPPROTO(struct request_queue *q), | 56 | TP_PROTO(struct request_queue *q), |
| 57 | TPARGS(q)); | 57 | TP_ARGS(q)); |
| 58 | 58 | ||
| 59 | DECLARE_TRACE(block_unplug_timer, | 59 | DECLARE_TRACE(block_unplug_timer, |
| 60 | TPPROTO(struct request_queue *q), | 60 | TP_PROTO(struct request_queue *q), |
| 61 | TPARGS(q)); | 61 | TP_ARGS(q)); |
| 62 | 62 | ||
| 63 | DECLARE_TRACE(block_unplug_io, | 63 | DECLARE_TRACE(block_unplug_io, |
| 64 | TPPROTO(struct request_queue *q), | 64 | TP_PROTO(struct request_queue *q), |
| 65 | TPARGS(q)); | 65 | TP_ARGS(q)); |
| 66 | 66 | ||
| 67 | DECLARE_TRACE(block_split, | 67 | DECLARE_TRACE(block_split, |
| 68 | TPPROTO(struct request_queue *q, struct bio *bio, unsigned int pdu), | 68 | TP_PROTO(struct request_queue *q, struct bio *bio, unsigned int pdu), |
| 69 | TPARGS(q, bio, pdu)); | 69 | TP_ARGS(q, bio, pdu)); |
| 70 | 70 | ||
| 71 | DECLARE_TRACE(block_remap, | 71 | DECLARE_TRACE(block_remap, |
| 72 | TPPROTO(struct request_queue *q, struct bio *bio, dev_t dev, | 72 | TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, |
| 73 | sector_t from, sector_t to), | 73 | sector_t from, sector_t to), |
| 74 | TPARGS(q, bio, dev, from, to)); | 74 | TP_ARGS(q, bio, dev, from, to)); |
| 75 | 75 | ||
| 76 | #endif | 76 | #endif |
diff --git a/include/trace/irq.h b/include/trace/irq.h new file mode 100644 index 000000000000..ff5d4495dc37 --- /dev/null +++ b/include/trace/irq.h | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #ifndef _TRACE_IRQ_H | ||
| 2 | #define _TRACE_IRQ_H | ||
| 3 | |||
| 4 | #include <linux/interrupt.h> | ||
| 5 | #include <linux/tracepoint.h> | ||
| 6 | |||
| 7 | #include <trace/irq_event_types.h> | ||
| 8 | |||
| 9 | #endif | ||
diff --git a/include/trace/irq_event_types.h b/include/trace/irq_event_types.h new file mode 100644 index 000000000000..43bcb74dd49f --- /dev/null +++ b/include/trace/irq_event_types.h | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | |||
| 2 | /* use <trace/irq.h> instead */ | ||
| 3 | #ifndef TRACE_FORMAT | ||
| 4 | # error Do not include this file directly. | ||
| 5 | # error Unless you know what you are doing. | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef TRACE_SYSTEM | ||
| 9 | #define TRACE_SYSTEM irq | ||
| 10 | |||
| 11 | /* | ||
| 12 | * Tracepoint for entry of interrupt handler: | ||
| 13 | */ | ||
| 14 | TRACE_FORMAT(irq_handler_entry, | ||
| 15 | TP_PROTO(int irq, struct irqaction *action), | ||
| 16 | TP_ARGS(irq, action), | ||
| 17 | TP_FMT("irq=%d handler=%s", irq, action->name) | ||
| 18 | ); | ||
| 19 | |||
| 20 | /* | ||
| 21 | * Tracepoint for return of an interrupt handler: | ||
| 22 | */ | ||
| 23 | TRACE_EVENT(irq_handler_exit, | ||
| 24 | |||
| 25 | TP_PROTO(int irq, struct irqaction *action, int ret), | ||
| 26 | |||
| 27 | TP_ARGS(irq, action, ret), | ||
| 28 | |||
| 29 | TP_STRUCT__entry( | ||
| 30 | __field( int, irq ) | ||
| 31 | __field( int, ret ) | ||
| 32 | ), | ||
| 33 | |||
| 34 | TP_printk("irq=%d return=%s", | ||
| 35 | __entry->irq, __entry->ret ? "handled" : "unhandled"), | ||
| 36 | |||
| 37 | TP_fast_assign( | ||
| 38 | __entry->irq = irq; | ||
| 39 | __entry->ret = ret; | ||
| 40 | ) | ||
| 41 | ); | ||
| 42 | |||
| 43 | #undef TRACE_SYSTEM | ||
diff --git a/include/trace/kmemtrace.h b/include/trace/kmemtrace.h new file mode 100644 index 000000000000..ad8b7857855a --- /dev/null +++ b/include/trace/kmemtrace.h | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2008 Eduard - Gabriel Munteanu | ||
| 3 | * | ||
| 4 | * This file is released under GPL version 2. | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef _LINUX_KMEMTRACE_H | ||
| 8 | #define _LINUX_KMEMTRACE_H | ||
| 9 | |||
| 10 | #ifdef __KERNEL__ | ||
| 11 | |||
| 12 | #include <linux/types.h> | ||
| 13 | #include <linux/marker.h> | ||
| 14 | |||
| 15 | enum kmemtrace_type_id { | ||
| 16 | KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */ | ||
| 17 | KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */ | ||
| 18 | KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */ | ||
| 19 | }; | ||
| 20 | |||
| 21 | #ifdef CONFIG_KMEMTRACE | ||
| 22 | |||
| 23 | extern void kmemtrace_init(void); | ||
| 24 | |||
| 25 | extern void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id, | ||
| 26 | unsigned long call_site, | ||
| 27 | const void *ptr, | ||
| 28 | size_t bytes_req, | ||
| 29 | size_t bytes_alloc, | ||
| 30 | gfp_t gfp_flags, | ||
| 31 | int node); | ||
| 32 | |||
| 33 | extern void kmemtrace_mark_free(enum kmemtrace_type_id type_id, | ||
| 34 | unsigned long call_site, | ||
| 35 | const void *ptr); | ||
| 36 | |||
| 37 | #else /* CONFIG_KMEMTRACE */ | ||
| 38 | |||
| 39 | static inline void kmemtrace_init(void) | ||
| 40 | { | ||
| 41 | } | ||
| 42 | |||
| 43 | static inline void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id, | ||
| 44 | unsigned long call_site, | ||
| 45 | const void *ptr, | ||
| 46 | size_t bytes_req, | ||
| 47 | size_t bytes_alloc, | ||
| 48 | gfp_t gfp_flags, | ||
| 49 | int node) | ||
| 50 | { | ||
| 51 | } | ||
| 52 | |||
| 53 | static inline void kmemtrace_mark_free(enum kmemtrace_type_id type_id, | ||
| 54 | unsigned long call_site, | ||
| 55 | const void *ptr) | ||
| 56 | { | ||
| 57 | } | ||
| 58 | |||
| 59 | #endif /* CONFIG_KMEMTRACE */ | ||
| 60 | |||
| 61 | static inline void kmemtrace_mark_alloc(enum kmemtrace_type_id type_id, | ||
| 62 | unsigned long call_site, | ||
| 63 | const void *ptr, | ||
| 64 | size_t bytes_req, | ||
| 65 | size_t bytes_alloc, | ||
| 66 | gfp_t gfp_flags) | ||
| 67 | { | ||
| 68 | kmemtrace_mark_alloc_node(type_id, call_site, ptr, | ||
| 69 | bytes_req, bytes_alloc, gfp_flags, -1); | ||
| 70 | } | ||
| 71 | |||
| 72 | #endif /* __KERNEL__ */ | ||
| 73 | |||
| 74 | #endif /* _LINUX_KMEMTRACE_H */ | ||
| 75 | |||
diff --git a/include/trace/lockdep.h b/include/trace/lockdep.h new file mode 100644 index 000000000000..5ca67df87f2a --- /dev/null +++ b/include/trace/lockdep.h | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #ifndef _TRACE_LOCKDEP_H | ||
| 2 | #define _TRACE_LOCKDEP_H | ||
| 3 | |||
| 4 | #include <linux/lockdep.h> | ||
| 5 | #include <linux/tracepoint.h> | ||
| 6 | |||
| 7 | #include <trace/lockdep_event_types.h> | ||
| 8 | |||
| 9 | #endif | ||
diff --git a/include/trace/lockdep_event_types.h b/include/trace/lockdep_event_types.h new file mode 100644 index 000000000000..adccfcd2ec8f --- /dev/null +++ b/include/trace/lockdep_event_types.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | |||
| 2 | #ifndef TRACE_FORMAT | ||
| 3 | # error Do not include this file directly. | ||
| 4 | # error Unless you know what you are doing. | ||
| 5 | #endif | ||
| 6 | |||
| 7 | #undef TRACE_SYSTEM | ||
| 8 | #define TRACE_SYSTEM lock | ||
| 9 | |||
| 10 | #ifdef CONFIG_LOCKDEP | ||
| 11 | |||
| 12 | TRACE_FORMAT(lock_acquire, | ||
| 13 | TP_PROTO(struct lockdep_map *lock, unsigned int subclass, | ||
| 14 | int trylock, int read, int check, | ||
| 15 | struct lockdep_map *next_lock, unsigned long ip), | ||
| 16 | TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip), | ||
| 17 | TP_FMT("%s%s%s", trylock ? "try " : "", | ||
| 18 | read ? "read " : "", lock->name) | ||
| 19 | ); | ||
| 20 | |||
| 21 | TRACE_FORMAT(lock_release, | ||
| 22 | TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip), | ||
| 23 | TP_ARGS(lock, nested, ip), | ||
| 24 | TP_FMT("%s", lock->name) | ||
| 25 | ); | ||
| 26 | |||
| 27 | #ifdef CONFIG_LOCK_STAT | ||
| 28 | |||
| 29 | TRACE_FORMAT(lock_contended, | ||
| 30 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | ||
| 31 | TP_ARGS(lock, ip), | ||
| 32 | TP_FMT("%s", lock->name) | ||
| 33 | ); | ||
| 34 | |||
| 35 | TRACE_FORMAT(lock_acquired, | ||
| 36 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | ||
| 37 | TP_ARGS(lock, ip), | ||
| 38 | TP_FMT("%s", lock->name) | ||
| 39 | ); | ||
| 40 | |||
| 41 | #endif | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #undef TRACE_SYSTEM | ||
diff --git a/include/trace/power.h b/include/trace/power.h new file mode 100644 index 000000000000..ef204666e983 --- /dev/null +++ b/include/trace/power.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | #ifndef _TRACE_POWER_H | ||
| 2 | #define _TRACE_POWER_H | ||
| 3 | |||
| 4 | #include <linux/ktime.h> | ||
| 5 | #include <linux/tracepoint.h> | ||
| 6 | |||
| 7 | enum { | ||
| 8 | POWER_NONE = 0, | ||
| 9 | POWER_CSTATE = 1, | ||
| 10 | POWER_PSTATE = 2, | ||
| 11 | }; | ||
| 12 | |||
| 13 | struct power_trace { | ||
| 14 | ktime_t stamp; | ||
| 15 | ktime_t end; | ||
| 16 | int type; | ||
| 17 | int state; | ||
| 18 | }; | ||
| 19 | |||
| 20 | DECLARE_TRACE(power_start, | ||
| 21 | TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state), | ||
| 22 | TP_ARGS(it, type, state)); | ||
| 23 | |||
| 24 | DECLARE_TRACE(power_mark, | ||
| 25 | TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state), | ||
| 26 | TP_ARGS(it, type, state)); | ||
| 27 | |||
| 28 | DECLARE_TRACE(power_end, | ||
| 29 | TP_PROTO(struct power_trace *it), | ||
| 30 | TP_ARGS(it)); | ||
| 31 | |||
| 32 | #endif /* _TRACE_POWER_H */ | ||
diff --git a/include/trace/sched.h b/include/trace/sched.h index 0d81098ee9fc..4e372a1a29bf 100644 --- a/include/trace/sched.h +++ b/include/trace/sched.h | |||
| @@ -4,53 +4,6 @@ | |||
| 4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
| 5 | #include <linux/tracepoint.h> | 5 | #include <linux/tracepoint.h> |
| 6 | 6 | ||
| 7 | DECLARE_TRACE(sched_kthread_stop, | 7 | #include <trace/sched_event_types.h> |
| 8 | TPPROTO(struct task_struct *t), | ||
| 9 | TPARGS(t)); | ||
| 10 | |||
| 11 | DECLARE_TRACE(sched_kthread_stop_ret, | ||
| 12 | TPPROTO(int ret), | ||
| 13 | TPARGS(ret)); | ||
| 14 | |||
| 15 | DECLARE_TRACE(sched_wait_task, | ||
| 16 | TPPROTO(struct rq *rq, struct task_struct *p), | ||
| 17 | TPARGS(rq, p)); | ||
| 18 | |||
| 19 | DECLARE_TRACE(sched_wakeup, | ||
| 20 | TPPROTO(struct rq *rq, struct task_struct *p, int success), | ||
| 21 | TPARGS(rq, p, success)); | ||
| 22 | |||
| 23 | DECLARE_TRACE(sched_wakeup_new, | ||
| 24 | TPPROTO(struct rq *rq, struct task_struct *p, int success), | ||
| 25 | TPARGS(rq, p, success)); | ||
| 26 | |||
| 27 | DECLARE_TRACE(sched_switch, | ||
| 28 | TPPROTO(struct rq *rq, struct task_struct *prev, | ||
| 29 | struct task_struct *next), | ||
| 30 | TPARGS(rq, prev, next)); | ||
| 31 | |||
| 32 | DECLARE_TRACE(sched_migrate_task, | ||
| 33 | TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu), | ||
| 34 | TPARGS(p, orig_cpu, dest_cpu)); | ||
| 35 | |||
| 36 | DECLARE_TRACE(sched_process_free, | ||
| 37 | TPPROTO(struct task_struct *p), | ||
| 38 | TPARGS(p)); | ||
| 39 | |||
| 40 | DECLARE_TRACE(sched_process_exit, | ||
| 41 | TPPROTO(struct task_struct *p), | ||
| 42 | TPARGS(p)); | ||
| 43 | |||
| 44 | DECLARE_TRACE(sched_process_wait, | ||
| 45 | TPPROTO(struct pid *pid), | ||
| 46 | TPARGS(pid)); | ||
| 47 | |||
| 48 | DECLARE_TRACE(sched_process_fork, | ||
| 49 | TPPROTO(struct task_struct *parent, struct task_struct *child), | ||
| 50 | TPARGS(parent, child)); | ||
| 51 | |||
| 52 | DECLARE_TRACE(sched_signal_send, | ||
| 53 | TPPROTO(int sig, struct task_struct *p), | ||
| 54 | TPARGS(sig, p)); | ||
| 55 | 8 | ||
| 56 | #endif | 9 | #endif |
diff --git a/include/trace/sched_event_types.h b/include/trace/sched_event_types.h new file mode 100644 index 000000000000..fb37af672c88 --- /dev/null +++ b/include/trace/sched_event_types.h | |||
| @@ -0,0 +1,337 @@ | |||
| 1 | |||
| 2 | /* use <trace/sched.h> instead */ | ||
| 3 | #ifndef TRACE_EVENT | ||
| 4 | # error Do not include this file directly. | ||
| 5 | # error Unless you know what you are doing. | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #undef TRACE_SYSTEM | ||
| 9 | #define TRACE_SYSTEM sched | ||
| 10 | |||
| 11 | /* | ||
| 12 | * Tracepoint for calling kthread_stop, performed to end a kthread: | ||
| 13 | */ | ||
| 14 | TRACE_EVENT(sched_kthread_stop, | ||
| 15 | |||
| 16 | TP_PROTO(struct task_struct *t), | ||
| 17 | |||
| 18 | TP_ARGS(t), | ||
| 19 | |||
| 20 | TP_STRUCT__entry( | ||
| 21 | __array( char, comm, TASK_COMM_LEN ) | ||
| 22 | __field( pid_t, pid ) | ||
| 23 | ), | ||
| 24 | |||
| 25 | TP_printk("task %s:%d", __entry->comm, __entry->pid), | ||
| 26 | |||
| 27 | TP_fast_assign( | ||
| 28 | memcpy(__entry->comm, t->comm, TASK_COMM_LEN); | ||
| 29 | __entry->pid = t->pid; | ||
| 30 | ) | ||
| 31 | ); | ||
| 32 | |||
| 33 | /* | ||
| 34 | * Tracepoint for the return value of the kthread stopping: | ||
| 35 | */ | ||
| 36 | TRACE_EVENT(sched_kthread_stop_ret, | ||
| 37 | |||
| 38 | TP_PROTO(int ret), | ||
| 39 | |||
| 40 | TP_ARGS(ret), | ||
| 41 | |||
| 42 | TP_STRUCT__entry( | ||
| 43 | __field( int, ret ) | ||
| 44 | ), | ||
| 45 | |||
| 46 | TP_printk("ret %d", __entry->ret), | ||
| 47 | |||
| 48 | TP_fast_assign( | ||
| 49 | __entry->ret = ret; | ||
| 50 | ) | ||
| 51 | ); | ||
| 52 | |||
| 53 | /* | ||
| 54 | * Tracepoint for waiting on task to unschedule: | ||
| 55 | * | ||
| 56 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
| 57 | * but used by the latency tracer plugin. ) | ||
| 58 | */ | ||
| 59 | TRACE_EVENT(sched_wait_task, | ||
| 60 | |||
| 61 | TP_PROTO(struct rq *rq, struct task_struct *p), | ||
| 62 | |||
| 63 | TP_ARGS(rq, p), | ||
| 64 | |||
| 65 | TP_STRUCT__entry( | ||
| 66 | __array( char, comm, TASK_COMM_LEN ) | ||
| 67 | __field( pid_t, pid ) | ||
| 68 | __field( int, prio ) | ||
| 69 | ), | ||
| 70 | |||
| 71 | TP_printk("task %s:%d [%d]", | ||
| 72 | __entry->comm, __entry->pid, __entry->prio), | ||
| 73 | |||
| 74 | TP_fast_assign( | ||
| 75 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
| 76 | __entry->pid = p->pid; | ||
| 77 | __entry->prio = p->prio; | ||
| 78 | ) | ||
| 79 | ); | ||
| 80 | |||
| 81 | /* | ||
| 82 | * Tracepoint for waking up a task: | ||
| 83 | * | ||
| 84 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
| 85 | * but used by the latency tracer plugin. ) | ||
| 86 | */ | ||
| 87 | TRACE_EVENT(sched_wakeup, | ||
| 88 | |||
| 89 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), | ||
| 90 | |||
| 91 | TP_ARGS(rq, p, success), | ||
| 92 | |||
| 93 | TP_STRUCT__entry( | ||
| 94 | __array( char, comm, TASK_COMM_LEN ) | ||
| 95 | __field( pid_t, pid ) | ||
| 96 | __field( int, prio ) | ||
| 97 | __field( int, success ) | ||
| 98 | ), | ||
| 99 | |||
| 100 | TP_printk("task %s:%d [%d] success=%d", | ||
| 101 | __entry->comm, __entry->pid, __entry->prio, | ||
| 102 | __entry->success), | ||
| 103 | |||
| 104 | TP_fast_assign( | ||
| 105 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
| 106 | __entry->pid = p->pid; | ||
| 107 | __entry->prio = p->prio; | ||
| 108 | __entry->success = success; | ||
| 109 | ) | ||
| 110 | ); | ||
| 111 | |||
| 112 | /* | ||
| 113 | * Tracepoint for waking up a new task: | ||
| 114 | * | ||
| 115 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
| 116 | * but used by the latency tracer plugin. ) | ||
| 117 | */ | ||
| 118 | TRACE_EVENT(sched_wakeup_new, | ||
| 119 | |||
| 120 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), | ||
| 121 | |||
| 122 | TP_ARGS(rq, p, success), | ||
| 123 | |||
| 124 | TP_STRUCT__entry( | ||
| 125 | __array( char, comm, TASK_COMM_LEN ) | ||
| 126 | __field( pid_t, pid ) | ||
| 127 | __field( int, prio ) | ||
| 128 | __field( int, success ) | ||
| 129 | ), | ||
| 130 | |||
| 131 | TP_printk("task %s:%d [%d] success=%d", | ||
| 132 | __entry->comm, __entry->pid, __entry->prio, | ||
| 133 | __entry->success), | ||
| 134 | |||
| 135 | TP_fast_assign( | ||
| 136 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
| 137 | __entry->pid = p->pid; | ||
| 138 | __entry->prio = p->prio; | ||
| 139 | __entry->success = success; | ||
| 140 | ) | ||
| 141 | ); | ||
| 142 | |||
| 143 | /* | ||
| 144 | * Tracepoint for task switches, performed by the scheduler: | ||
| 145 | * | ||
| 146 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
| 147 | * but used by the latency tracer plugin. ) | ||
| 148 | */ | ||
| 149 | TRACE_EVENT(sched_switch, | ||
| 150 | |||
| 151 | TP_PROTO(struct rq *rq, struct task_struct *prev, | ||
| 152 | struct task_struct *next), | ||
| 153 | |||
| 154 | TP_ARGS(rq, prev, next), | ||
| 155 | |||
| 156 | TP_STRUCT__entry( | ||
| 157 | __array( char, prev_comm, TASK_COMM_LEN ) | ||
| 158 | __field( pid_t, prev_pid ) | ||
| 159 | __field( int, prev_prio ) | ||
| 160 | __array( char, next_comm, TASK_COMM_LEN ) | ||
| 161 | __field( pid_t, next_pid ) | ||
| 162 | __field( int, next_prio ) | ||
| 163 | ), | ||
| 164 | |||
| 165 | TP_printk("task %s:%d [%d] ==> %s:%d [%d]", | ||
| 166 | __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, | ||
| 167 | __entry->next_comm, __entry->next_pid, __entry->next_prio), | ||
| 168 | |||
| 169 | TP_fast_assign( | ||
| 170 | memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); | ||
| 171 | __entry->prev_pid = prev->pid; | ||
| 172 | __entry->prev_prio = prev->prio; | ||
| 173 | memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); | ||
| 174 | __entry->next_pid = next->pid; | ||
| 175 | __entry->next_prio = next->prio; | ||
| 176 | ) | ||
| 177 | ); | ||
| 178 | |||
| 179 | /* | ||
| 180 | * Tracepoint for a task being migrated: | ||
| 181 | */ | ||
| 182 | TRACE_EVENT(sched_migrate_task, | ||
| 183 | |||
| 184 | TP_PROTO(struct task_struct *p, int orig_cpu, int dest_cpu), | ||
| 185 | |||
| 186 | TP_ARGS(p, orig_cpu, dest_cpu), | ||
| 187 | |||
| 188 | TP_STRUCT__entry( | ||
| 189 | __array( char, comm, TASK_COMM_LEN ) | ||
| 190 | __field( pid_t, pid ) | ||
| 191 | __field( int, prio ) | ||
| 192 | __field( int, orig_cpu ) | ||
| 193 | __field( int, dest_cpu ) | ||
| 194 | ), | ||
| 195 | |||
| 196 | TP_printk("task %s:%d [%d] from: %d to: %d", | ||
| 197 | __entry->comm, __entry->pid, __entry->prio, | ||
| 198 | __entry->orig_cpu, __entry->dest_cpu), | ||
| 199 | |||
| 200 | TP_fast_assign( | ||
| 201 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
| 202 | __entry->pid = p->pid; | ||
| 203 | __entry->prio = p->prio; | ||
| 204 | __entry->orig_cpu = orig_cpu; | ||
| 205 | __entry->dest_cpu = dest_cpu; | ||
| 206 | ) | ||
| 207 | ); | ||
| 208 | |||
| 209 | /* | ||
| 210 | * Tracepoint for freeing a task: | ||
| 211 | */ | ||
| 212 | TRACE_EVENT(sched_process_free, | ||
| 213 | |||
| 214 | TP_PROTO(struct task_struct *p), | ||
| 215 | |||
| 216 | TP_ARGS(p), | ||
| 217 | |||
| 218 | TP_STRUCT__entry( | ||
| 219 | __array( char, comm, TASK_COMM_LEN ) | ||
| 220 | __field( pid_t, pid ) | ||
| 221 | __field( int, prio ) | ||
| 222 | ), | ||
| 223 | |||
| 224 | TP_printk("task %s:%d [%d]", | ||
| 225 | __entry->comm, __entry->pid, __entry->prio), | ||
| 226 | |||
| 227 | TP_fast_assign( | ||
| 228 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
| 229 | __entry->pid = p->pid; | ||
| 230 | __entry->prio = p->prio; | ||
| 231 | ) | ||
| 232 | ); | ||
| 233 | |||
| 234 | /* | ||
| 235 | * Tracepoint for a task exiting: | ||
| 236 | */ | ||
| 237 | TRACE_EVENT(sched_process_exit, | ||
| 238 | |||
| 239 | TP_PROTO(struct task_struct *p), | ||
| 240 | |||
| 241 | TP_ARGS(p), | ||
| 242 | |||
| 243 | TP_STRUCT__entry( | ||
| 244 | __array( char, comm, TASK_COMM_LEN ) | ||
| 245 | __field( pid_t, pid ) | ||
| 246 | __field( int, prio ) | ||
| 247 | ), | ||
| 248 | |||
| 249 | TP_printk("task %s:%d [%d]", | ||
| 250 | __entry->comm, __entry->pid, __entry->prio), | ||
| 251 | |||
| 252 | TP_fast_assign( | ||
| 253 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
| 254 | __entry->pid = p->pid; | ||
| 255 | __entry->prio = p->prio; | ||
| 256 | ) | ||
| 257 | ); | ||
| 258 | |||
| 259 | /* | ||
| 260 | * Tracepoint for a waiting task: | ||
| 261 | */ | ||
| 262 | TRACE_EVENT(sched_process_wait, | ||
| 263 | |||
| 264 | TP_PROTO(struct pid *pid), | ||
| 265 | |||
| 266 | TP_ARGS(pid), | ||
| 267 | |||
| 268 | TP_STRUCT__entry( | ||
| 269 | __array( char, comm, TASK_COMM_LEN ) | ||
| 270 | __field( pid_t, pid ) | ||
| 271 | __field( int, prio ) | ||
| 272 | ), | ||
| 273 | |||
| 274 | TP_printk("task %s:%d [%d]", | ||
| 275 | __entry->comm, __entry->pid, __entry->prio), | ||
| 276 | |||
| 277 | TP_fast_assign( | ||
| 278 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
| 279 | __entry->pid = pid_nr(pid); | ||
| 280 | __entry->prio = current->prio; | ||
| 281 | ) | ||
| 282 | ); | ||
| 283 | |||
| 284 | /* | ||
| 285 | * Tracepoint for do_fork: | ||
| 286 | */ | ||
| 287 | TRACE_EVENT(sched_process_fork, | ||
| 288 | |||
| 289 | TP_PROTO(struct task_struct *parent, struct task_struct *child), | ||
| 290 | |||
| 291 | TP_ARGS(parent, child), | ||
| 292 | |||
| 293 | TP_STRUCT__entry( | ||
| 294 | __array( char, parent_comm, TASK_COMM_LEN ) | ||
| 295 | __field( pid_t, parent_pid ) | ||
| 296 | __array( char, child_comm, TASK_COMM_LEN ) | ||
| 297 | __field( pid_t, child_pid ) | ||
| 298 | ), | ||
| 299 | |||
| 300 | TP_printk("parent %s:%d child %s:%d", | ||
| 301 | __entry->parent_comm, __entry->parent_pid, | ||
| 302 | __entry->child_comm, __entry->child_pid), | ||
| 303 | |||
| 304 | TP_fast_assign( | ||
| 305 | memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN); | ||
| 306 | __entry->parent_pid = parent->pid; | ||
| 307 | memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN); | ||
| 308 | __entry->child_pid = child->pid; | ||
| 309 | ) | ||
| 310 | ); | ||
| 311 | |||
| 312 | /* | ||
| 313 | * Tracepoint for sending a signal: | ||
| 314 | */ | ||
| 315 | TRACE_EVENT(sched_signal_send, | ||
| 316 | |||
| 317 | TP_PROTO(int sig, struct task_struct *p), | ||
| 318 | |||
| 319 | TP_ARGS(sig, p), | ||
| 320 | |||
| 321 | TP_STRUCT__entry( | ||
| 322 | __field( int, sig ) | ||
| 323 | __array( char, comm, TASK_COMM_LEN ) | ||
| 324 | __field( pid_t, pid ) | ||
| 325 | ), | ||
| 326 | |||
| 327 | TP_printk("sig: %d task %s:%d", | ||
| 328 | __entry->sig, __entry->comm, __entry->pid), | ||
| 329 | |||
| 330 | TP_fast_assign( | ||
| 331 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
| 332 | __entry->pid = p->pid; | ||
| 333 | __entry->sig = sig; | ||
| 334 | ) | ||
| 335 | ); | ||
| 336 | |||
| 337 | #undef TRACE_SYSTEM | ||
diff --git a/include/trace/trace_event_types.h b/include/trace/trace_event_types.h new file mode 100644 index 000000000000..df56f5694be6 --- /dev/null +++ b/include/trace/trace_event_types.h | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | /* trace/<type>_event_types.h here */ | ||
| 2 | |||
| 3 | #include <trace/sched_event_types.h> | ||
| 4 | #include <trace/irq_event_types.h> | ||
| 5 | #include <trace/lockdep_event_types.h> | ||
diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h new file mode 100644 index 000000000000..fd13750ca4ba --- /dev/null +++ b/include/trace/trace_events.h | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | /* trace/<type>.h here */ | ||
| 2 | |||
| 3 | #include <trace/sched.h> | ||
| 4 | #include <trace/irq.h> | ||
| 5 | #include <trace/lockdep.h> | ||
diff --git a/include/trace/workqueue.h b/include/trace/workqueue.h new file mode 100644 index 000000000000..7626523deeba --- /dev/null +++ b/include/trace/workqueue.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #ifndef __TRACE_WORKQUEUE_H | ||
| 2 | #define __TRACE_WORKQUEUE_H | ||
| 3 | |||
| 4 | #include <linux/tracepoint.h> | ||
| 5 | #include <linux/workqueue.h> | ||
| 6 | #include <linux/sched.h> | ||
| 7 | |||
| 8 | DECLARE_TRACE(workqueue_insertion, | ||
| 9 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
| 10 | TP_ARGS(wq_thread, work)); | ||
| 11 | |||
| 12 | DECLARE_TRACE(workqueue_execution, | ||
| 13 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
| 14 | TP_ARGS(wq_thread, work)); | ||
| 15 | |||
| 16 | /* Trace the creation of one workqueue thread on a cpu */ | ||
| 17 | DECLARE_TRACE(workqueue_creation, | ||
| 18 | TP_PROTO(struct task_struct *wq_thread, int cpu), | ||
| 19 | TP_ARGS(wq_thread, cpu)); | ||
| 20 | |||
| 21 | DECLARE_TRACE(workqueue_destruction, | ||
| 22 | TP_PROTO(struct task_struct *wq_thread), | ||
| 23 | TP_ARGS(wq_thread)); | ||
| 24 | |||
| 25 | #endif /* __TRACE_WORKQUEUE_H */ | ||
