diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-08 15:17:25 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-08 15:17:25 -0400 |
| commit | 09b56d5a418b7ced4ca427c7cf8faf11df72364c (patch) | |
| tree | 88ad1fe20f8fd7df89131cef5c7f8ef96f15406d | |
| parent | fe1b518075d86976db3a93e7e8b640d24d477519 (diff) | |
| parent | 98becb781e3e27d74efe5f3653b948d39f694cfb (diff) | |
Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM updates from Russell King:
- add support for ftrace-with-registers, which is needed for kgraft and
other ftrace tools
- support for mremap() for the sigpage/vDSO so that checkpoint/restore
can work
- add timestamps to each line of the register dump output
- remove the unused KTHREAD_SIZE from nommu
- align the ARM bitops APIs with the generic API (using unsigned long
pointers rather than void pointers)
- make the configuration of userspace Thumb support an expert option so
that we can default it on, and avoid some hard to debug userspace
crashes
* 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
ARM: 8684/1: NOMMU: Remove unused KTHREAD_SIZE definition
ARM: 8683/1: ARM32: Support mremap() for sigpage/vDSO
ARM: 8679/1: bitops: Align prototypes to generic API
ARM: 8678/1: ftrace: Adds support for CONFIG_DYNAMIC_FTRACE_WITH_REGS
ARM: make configuration of userspace Thumb support an expert option
ARM: 8673/1: Fix __show_regs output timestamps
| -rw-r--r-- | arch/arm/Kconfig | 1 | ||||
| -rw-r--r-- | arch/arm/include/asm/bitops.h | 8 | ||||
| -rw-r--r-- | arch/arm/include/asm/ftrace.h | 4 | ||||
| -rw-r--r-- | arch/arm/include/asm/page-nommu.h | 6 | ||||
| -rw-r--r-- | arch/arm/kernel/entry-ftrace.S | 100 | ||||
| -rw-r--r-- | arch/arm/kernel/ftrace.c | 37 | ||||
| -rw-r--r-- | arch/arm/kernel/process.c | 16 | ||||
| -rw-r--r-- | arch/arm/kernel/vdso.c | 18 | ||||
| -rw-r--r-- | arch/arm/mm/Kconfig | 6 | ||||
| -rw-r--r-- | arch/x86/entry/vdso/vma.c | 3 | ||||
| -rw-r--r-- | mm/mmap.c | 4 |
11 files changed, 185 insertions, 18 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 0b731e8ab17e..a208bfe367b5 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -58,6 +58,7 @@ config ARM | |||
| 58 | select HAVE_DMA_API_DEBUG | 58 | select HAVE_DMA_API_DEBUG |
| 59 | select HAVE_DMA_CONTIGUOUS if MMU | 59 | select HAVE_DMA_CONTIGUOUS if MMU |
| 60 | select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL) && !CPU_ENDIAN_BE32 && MMU | 60 | select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL) && !CPU_ENDIAN_BE32 && MMU |
| 61 | select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE | ||
| 61 | select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU | 62 | select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU |
| 62 | select HAVE_EXIT_THREAD | 63 | select HAVE_EXIT_THREAD |
| 63 | select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL) | 64 | select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL) |
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index e943e6cee254..f308c8c40cb9 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h | |||
| @@ -159,16 +159,16 @@ extern int _test_and_change_bit(int nr, volatile unsigned long * p); | |||
| 159 | /* | 159 | /* |
| 160 | * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. | 160 | * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. |
| 161 | */ | 161 | */ |
| 162 | extern int _find_first_zero_bit_le(const void * p, unsigned size); | 162 | extern int _find_first_zero_bit_le(const unsigned long *p, unsigned size); |
| 163 | extern int _find_next_zero_bit_le(const void * p, int size, int offset); | 163 | extern int _find_next_zero_bit_le(const unsigned long *p, int size, int offset); |
| 164 | extern int _find_first_bit_le(const unsigned long *p, unsigned size); | 164 | extern int _find_first_bit_le(const unsigned long *p, unsigned size); |
| 165 | extern int _find_next_bit_le(const unsigned long *p, int size, int offset); | 165 | extern int _find_next_bit_le(const unsigned long *p, int size, int offset); |
| 166 | 166 | ||
| 167 | /* | 167 | /* |
| 168 | * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. | 168 | * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. |
| 169 | */ | 169 | */ |
| 170 | extern int _find_first_zero_bit_be(const void * p, unsigned size); | 170 | extern int _find_first_zero_bit_be(const unsigned long *p, unsigned size); |
| 171 | extern int _find_next_zero_bit_be(const void * p, int size, int offset); | 171 | extern int _find_next_zero_bit_be(const unsigned long *p, int size, int offset); |
| 172 | extern int _find_first_bit_be(const unsigned long *p, unsigned size); | 172 | extern int _find_first_bit_be(const unsigned long *p, unsigned size); |
| 173 | extern int _find_next_bit_be(const unsigned long *p, int size, int offset); | 173 | extern int _find_next_bit_be(const unsigned long *p, int size, int offset); |
| 174 | 174 | ||
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h index 22b73112b75f..f379881d5cc3 100644 --- a/arch/arm/include/asm/ftrace.h +++ b/arch/arm/include/asm/ftrace.h | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | #ifndef _ASM_ARM_FTRACE | 1 | #ifndef _ASM_ARM_FTRACE |
| 2 | #define _ASM_ARM_FTRACE | 2 | #define _ASM_ARM_FTRACE |
| 3 | 3 | ||
| 4 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS | ||
| 5 | #define ARCH_SUPPORTS_FTRACE_OPS 1 | ||
| 6 | #endif | ||
| 7 | |||
| 4 | #ifdef CONFIG_FUNCTION_TRACER | 8 | #ifdef CONFIG_FUNCTION_TRACER |
| 5 | #define MCOUNT_ADDR ((unsigned long)(__gnu_mcount_nc)) | 9 | #define MCOUNT_ADDR ((unsigned long)(__gnu_mcount_nc)) |
| 6 | #define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ | 10 | #define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ |
diff --git a/arch/arm/include/asm/page-nommu.h b/arch/arm/include/asm/page-nommu.h index 503f488053de..8f2c47bec375 100644 --- a/arch/arm/include/asm/page-nommu.h +++ b/arch/arm/include/asm/page-nommu.h | |||
| @@ -11,12 +11,6 @@ | |||
| 11 | #ifndef _ASMARM_PAGE_NOMMU_H | 11 | #ifndef _ASMARM_PAGE_NOMMU_H |
| 12 | #define _ASMARM_PAGE_NOMMU_H | 12 | #define _ASMARM_PAGE_NOMMU_H |
| 13 | 13 | ||
| 14 | #if !defined(CONFIG_SMALL_TASKS) && PAGE_SHIFT < 13 | ||
| 15 | #define KTHREAD_SIZE (8192) | ||
| 16 | #else | ||
| 17 | #define KTHREAD_SIZE PAGE_SIZE | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #define clear_page(page) memset((page), 0, PAGE_SIZE) | 14 | #define clear_page(page) memset((page), 0, PAGE_SIZE) |
| 21 | #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE) | 15 | #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE) |
| 22 | 16 | ||
diff --git a/arch/arm/kernel/entry-ftrace.S b/arch/arm/kernel/entry-ftrace.S index c73c4030ca5d..efcd9f25a14b 100644 --- a/arch/arm/kernel/entry-ftrace.S +++ b/arch/arm/kernel/entry-ftrace.S | |||
| @@ -92,12 +92,95 @@ | |||
| 92 | 2: mcount_exit | 92 | 2: mcount_exit |
| 93 | .endm | 93 | .endm |
| 94 | 94 | ||
| 95 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS | ||
| 96 | |||
| 97 | .macro __ftrace_regs_caller | ||
| 98 | |||
| 99 | sub sp, sp, #8 @ space for PC and CPSR OLD_R0, | ||
| 100 | @ OLD_R0 will overwrite previous LR | ||
| 101 | |||
| 102 | add ip, sp, #12 @ move in IP the value of SP as it was | ||
| 103 | @ before the push {lr} of the mcount mechanism | ||
| 104 | |||
| 105 | str lr, [sp, #0] @ store LR instead of PC | ||
| 106 | |||
| 107 | ldr lr, [sp, #8] @ get previous LR | ||
| 108 | |||
| 109 | str r0, [sp, #8] @ write r0 as OLD_R0 over previous LR | ||
| 110 | |||
| 111 | stmdb sp!, {ip, lr} | ||
| 112 | stmdb sp!, {r0-r11, lr} | ||
| 113 | |||
| 114 | @ stack content at this point: | ||
| 115 | @ 0 4 48 52 56 60 64 68 72 | ||
| 116 | @ R0 | R1 | ... | LR | SP + 4 | previous LR | LR | PSR | OLD_R0 | | ||
| 117 | |||
| 118 | mov r3, sp @ struct pt_regs* | ||
| 119 | |||
| 120 | ldr r2, =function_trace_op | ||
| 121 | ldr r2, [r2] @ pointer to the current | ||
| 122 | @ function tracing op | ||
| 123 | |||
| 124 | ldr r1, [sp, #S_LR] @ lr of instrumented func | ||
| 125 | |||
| 126 | ldr lr, [sp, #S_PC] @ get LR | ||
| 127 | |||
| 128 | mcount_adjust_addr r0, lr @ instrumented function | ||
| 129 | |||
| 130 | .globl ftrace_regs_call | ||
| 131 | ftrace_regs_call: | ||
| 132 | bl ftrace_stub | ||
| 133 | |||
| 134 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
| 135 | .globl ftrace_graph_regs_call | ||
| 136 | ftrace_graph_regs_call: | ||
| 137 | mov r0, r0 | ||
| 138 | #endif | ||
| 139 | |||
| 140 | @ pop saved regs | ||
| 141 | ldmia sp!, {r0-r12} @ restore r0 through r12 | ||
| 142 | ldr ip, [sp, #8] @ restore PC | ||
| 143 | ldr lr, [sp, #4] @ restore LR | ||
| 144 | ldr sp, [sp, #0] @ restore SP | ||
| 145 | mov pc, ip @ return | ||
| 146 | .endm | ||
| 147 | |||
| 148 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
| 149 | .macro __ftrace_graph_regs_caller | ||
| 150 | |||
| 151 | sub r0, fp, #4 @ lr of instrumented routine (parent) | ||
| 152 | |||
| 153 | @ called from __ftrace_regs_caller | ||
| 154 | ldr r1, [sp, #S_PC] @ instrumented routine (func) | ||
| 155 | mcount_adjust_addr r1, r1 | ||
| 156 | |||
| 157 | mov r2, fp @ frame pointer | ||
| 158 | bl prepare_ftrace_return | ||
| 159 | |||
| 160 | @ pop registers saved in ftrace_regs_caller | ||
| 161 | ldmia sp!, {r0-r12} @ restore r0 through r12 | ||
| 162 | ldr ip, [sp, #8] @ restore PC | ||
| 163 | ldr lr, [sp, #4] @ restore LR | ||
| 164 | ldr sp, [sp, #0] @ restore SP | ||
| 165 | mov pc, ip @ return | ||
| 166 | |||
| 167 | .endm | ||
| 168 | #endif | ||
| 169 | #endif | ||
| 170 | |||
| 95 | .macro __ftrace_caller suffix | 171 | .macro __ftrace_caller suffix |
| 96 | mcount_enter | 172 | mcount_enter |
| 97 | 173 | ||
| 98 | mcount_get_lr r1 @ lr of instrumented func | 174 | mcount_get_lr r1 @ lr of instrumented func |
| 99 | mcount_adjust_addr r0, lr @ instrumented function | 175 | mcount_adjust_addr r0, lr @ instrumented function |
| 100 | 176 | ||
| 177 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS | ||
| 178 | ldr r2, =function_trace_op | ||
| 179 | ldr r2, [r2] @ pointer to the current | ||
| 180 | @ function tracing op | ||
| 181 | mov r3, #0 @ regs is NULL | ||
| 182 | #endif | ||
| 183 | |||
| 101 | .globl ftrace_call\suffix | 184 | .globl ftrace_call\suffix |
| 102 | ftrace_call\suffix: | 185 | ftrace_call\suffix: |
| 103 | bl ftrace_stub | 186 | bl ftrace_stub |
| @@ -212,6 +295,15 @@ UNWIND(.fnstart) | |||
| 212 | __ftrace_caller | 295 | __ftrace_caller |
| 213 | UNWIND(.fnend) | 296 | UNWIND(.fnend) |
| 214 | ENDPROC(ftrace_caller) | 297 | ENDPROC(ftrace_caller) |
| 298 | |||
| 299 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS | ||
| 300 | ENTRY(ftrace_regs_caller) | ||
| 301< | |||
