Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf/x86/64: Simplify regs_user->abi setting code in get_regs_user()

user_64bit_mode(regs) basically checks regs->cs to point to a
64-bit segment. This check used to be unreliable here because
regs->cs was not always correct in syscalls.

Now regs->cs is always correct: in syscalls, in interrupts, in
exceptions. No need to emply heuristics here.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1428671219-29341-3-git-send-email-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Denys Vlasenko and committed by
Ingo Molnar
32caa060 5df71b39

+2 -16
+2 -16
arch/x86/kernel/perf_regs.c
··· 166 166 * be careful not to look at any other percpu variables that might 167 167 * change during context switches. 168 168 */ 169 - if (IS_ENABLED(CONFIG_IA32_EMULATION) && 170 - task_thread_info(current)->status & TS_COMPAT) { 171 - /* Easy case: we're in a compat syscall. */ 172 - regs_user->abi = PERF_SAMPLE_REGS_ABI_32; 173 - } else if (user_regs->orig_ax != -1) { 174 - /* 175 - * We're probably in a 64-bit syscall. 176 - * Warning: this code is severely racy. At least it's better 177 - * than just blindly copying user_regs. 178 - */ 179 - regs_user->abi = PERF_SAMPLE_REGS_ABI_64; 180 - } else { 181 - /* We're probably in an interrupt or exception. */ 182 - regs_user->abi = user_64bit_mode(user_regs) ? 183 - PERF_SAMPLE_REGS_ABI_64 : PERF_SAMPLE_REGS_ABI_32; 184 - } 169 + regs_user->abi = user_64bit_mode(user_regs) ? 170 + PERF_SAMPLE_REGS_ABI_64 : PERF_SAMPLE_REGS_ABI_32; 185 171 186 172 regs_user->regs = regs_user_copy; 187 173 }