perf fixes
Subsystems (5)
Linus,
Please pull the latest perf-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus
HEAD: ef8ff74ed8dd9d4b3ba8cb9f2fc927a27c697a8b Merge branch 'tip/perf/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/urgent
Most of these are uprobes race fixes from Oleg, and their preparatory cleanups. (It's larger than what I'd normally send for an -rc kernel, but they looked significant enough to not delay them.)
There's also an oprofile fix and an uncore PMU fix.
Thanks,
Ingo
------------------>
Dan Carpenter (1):
oprofile, x86: Fix wrapping bug in op_x86_get_ctrl()
Oleg Nesterov (19):
uprobes: Do not leak UTASK_BP_HIT if find_active_uprobe() fails
uprobes: Do not setup ->active_uprobe/state prematurely
uprobes: Fix UPROBE_SKIP_SSTEP checks in handle_swbp()
uprobes: Kill UTASK_BP_HIT state
uprobes: Move clear_thread_flag(TIF_UPROBE) to uprobe_notify_resume()
uprobes: Change write_opcode() to use FOLL_FORCE
uprobes: Change valid_vma() to demand VM_MAYEXEC rather than VM_EXEC
uprobes: Restrict valid_vma(false) to skip VM_SHARED vmas
uprobes: Kill set_swbp()->is_swbp_at_addr()
uprobes: Introduce copy_opcode(), kill read_opcode()
uprobes: Kill set_orig_insn()->is_swbp_at_addr()
uprobes: Simplify is_swbp_at_addr(), remove stale comments uprobes/x86: Only rep+nop can be emulated correctly
uprobes: Don't return success if alloc_uprobe() fails
uprobes: Do not delete uprobe if uprobe_unregister() fails
uprobes: Fix handle_swbp() vs unregister() + register() race
uprobes: Introduce prepare_uprobe()
uprobes: Fix prepare_uprobe() race with itself
uprobes: Fix the racy uprobe->flags manipulation
Vaibhav Nagarnaik (1):
ring-buffer: Check for uninitialized cpu buffer before resizing
Yan, Zheng (1):
perf/x86: Disable uncore on virtualized CPUs
arch/x86/kernel/cpu/perf_event_intel_uncore.c | 3 + arch/x86/kernel/signal.c | 4 +- arch/x86/kernel/uprobes.c | 16 +- arch/x86/oprofile/nmi_int.c | 2 +- include/linux/uprobes.h | 11 - kernel/events/uprobes.c | 345 ++++++++++++-------------- kernel/trace/ring_buffer.c | 4 + 7 files changed, 173 insertions(+), 212 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +3 -0
@@ -2926,6 +2926,9 @@ static int __init intel_uncore_init(void)if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL )return -ENODEV ; +if (cpu_has_hypervisor) +return -ENODEV ; + ret =uncore_pci_init ();if (ret) goto fail;
arch/x86/kernel/signal.c +1 -3
@@ -824,10 +824,8 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)mce_notify_process ();#endif /* CONFIG_X86_64 && CONFIG_X86_MCE */ -if (thread_info_flags & _TIF_UPROBE) { -clear_thread_flag (TIF_UPROBE ); +if (thread_info_flags & _TIF_UPROBE)uprobe_notify_resume (regs); - }/* deal with pending signal delivery */ if (thread_info_flags & _TIF_SIGPENDING)
arch/x86/kernel/uprobes.c +2 -14
@@ -651,31 +651,19 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)/* * Skip these instructions as per the currently known x86 ISA. -* 0x66* { 0x90 | 0x0f 0x1f | 0x0f 0x19 | 0x87 0xc0 } +* rep=0x66*; nop=0x90 */ static bool __skip_sstep (struct arch_uprobe *auprobe,struct pt_regs *regs) {int i;for (i =0 ; i <MAX_UINSN_BYTES ; i++) { -if ((auprobe->insn[i] ==0x66 )) +if (auprobe->insn[i] ==0x66 )continue ;if (auprobe->insn[i] ==0x90 )return true; -if (i == (MAX_UINSN_BYTES -1 )) -break ; - -if ((auprobe->insn[i] ==0x0f ) && (auprobe->insn[i+1 ] ==0x1f )) -return true; - -if ((auprobe->insn[i] ==0x0f ) && (auprobe->insn[i+1 ] ==0x19 )) -return true; - -if ((auprobe->insn[i] ==0x87 ) && (auprobe->insn[i+1 ] ==0xc0 )) -return true; -break ; }return false;
arch/x86/oprofile/nmi_int.c +1 -1
@@ -55,7 +55,7 @@ u64 op_x86_get_ctrl(struct op_x86_model_spec const *model, val |= counter_config->extra; event &= model->event_mask ? model->event_mask :0xFF ; val |= event &0xFF ; - val |= (event &0x0F00 ) <<24 ; + val |= (u64)(event &0x0F00 ) <<24 ;return val; }
include/linux/uprobes.h +0 -11
@@ -35,16 +35,6 @@ struct inode;# include <asm/uprobes.h> #endif -/* flags that denote/change uprobes behaviour */ - -/* Have a copy of original instruction */ -#define UPROBE_COPY_INSN 0x1 - -/* Dont run handlers when first register/ last unregister in progress*/ -#define UPROBE_RUN_HANDLER 0x2 -/* Can skip singlestep */ -#define UPROBE_SKIP_SSTEP 0x4 -struct uprobe_consumer {int (*handler)(struct uprobe_consumer *self,struct pt_regs *regs);/*
@@ -59,7 +49,6 @@ struct uprobe_consumer {#ifdef CONFIG_UPROBES enum uprobe_task_state {UTASK_RUNNING , -UTASK_BP_HIT ,UTASK_SSTEP ,UTASK_SSTEP_ACK , UTASK_SSTEP_TRAPPED,
kernel/events/uprobes.c +162 -183
545 lines not on this page · raw message
kernel/trace/ring_buffer.c +4 -0
@@ -1567,6 +1567,10 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,put_online_cpus (); }else { +/* Make sure this CPU has been intitialized */ +if (!cpumask_test_cpu (cpu_id, buffer->cpumask)) + goto out; + cpu_buffer = buffer->buffers[cpu_id];if (nr_pages == cpu_buffer->nr_pages)