Skip to content

Commit

Permalink
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "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."

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (22 commits)
  perf/x86: Disable uncore on virtualized CPUs
  oprofile, x86: Fix wrapping bug in op_x86_get_ctrl()
  ring-buffer: Check for uninitialized cpu buffer before resizing
  uprobes: Fix the racy uprobe->flags manipulation
  uprobes: Fix prepare_uprobe() race with itself
  uprobes: Introduce prepare_uprobe()
  uprobes: Fix handle_swbp() vs unregister() + register() race
  uprobes: Do not delete uprobe if uprobe_unregister() fails
  uprobes: Don't return success if alloc_uprobe() fails
  uprobes/x86: Only rep+nop can be emulated correctly
  uprobes: Simplify is_swbp_at_addr(), remove stale comments
  uprobes: Kill set_orig_insn()->is_swbp_at_addr()
  uprobes: Introduce copy_opcode(), kill read_opcode()
  uprobes: Kill set_swbp()->is_swbp_at_addr()
  uprobes: Restrict valid_vma(false) to skip VM_SHARED vmas
  uprobes: Change valid_vma() to demand VM_MAYEXEC rather than VM_EXEC
  uprobes: Change write_opcode() to use FOLL_FORCE
  uprobes: Move clear_thread_flag(TIF_UPROBE) to uprobe_notify_resume()
  uprobes: Kill UTASK_BP_HIT state
  uprobes: Fix UPROBE_SKIP_SSTEP checks in handle_swbp()
  ...
  • Loading branch information
torvalds committed Oct 24, 2012
2 parents 684baeb + ef8ff74 commit e17b131
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 212 deletions.
3 changes: 3 additions & 0 deletions arch/x86/kernel/cpu/perf_event_intel_uncore.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2926,6 +2926,9 @@ static int __init intel_uncore_init(void)
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
return -ENODEV; return -ENODEV;


if (cpu_has_hypervisor)
return -ENODEV;

ret = uncore_pci_init(); ret = uncore_pci_init();
if (ret) if (ret)
goto fail; goto fail;
Expand Down
4 changes: 1 addition & 3 deletions arch/x86/kernel/signal.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -824,10 +824,8 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
mce_notify_process(); mce_notify_process();
#endif /* CONFIG_X86_64 && CONFIG_X86_MCE */ #endif /* CONFIG_X86_64 && CONFIG_X86_MCE */


if (thread_info_flags & _TIF_UPROBE) { if (thread_info_flags & _TIF_UPROBE)
clear_thread_flag(TIF_UPROBE);
uprobe_notify_resume(regs); uprobe_notify_resume(regs);
}


/* deal with pending signal delivery */ /* deal with pending signal delivery */
if (thread_info_flags & _TIF_SIGPENDING) if (thread_info_flags & _TIF_SIGPENDING)
Expand Down
16 changes: 2 additions & 14 deletions arch/x86/kernel/uprobes.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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. * 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) static bool __skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
{ {
int i; int i;


for (i = 0; i < MAX_UINSN_BYTES; i++) { for (i = 0; i < MAX_UINSN_BYTES; i++) {
if ((auprobe->insn[i] == 0x66)) if (auprobe->insn[i] == 0x66)
continue; continue;


if (auprobe->insn[i] == 0x90) if (auprobe->insn[i] == 0x90)
return true; 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; break;
} }
return false; return false;
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/oprofile/nmi_int.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
val |= counter_config->extra; val |= counter_config->extra;
event &= model->event_mask ? model->event_mask : 0xFF; event &= model->event_mask ? model->event_mask : 0xFF;
val |= event & 0xFF; val |= event & 0xFF;
val |= (event & 0x0F00) << 24; val |= (u64)(event & 0x0F00) << 24;


return val; return val;
} }
Expand Down
11 changes: 0 additions & 11 deletions include/linux/uprobes.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ struct inode;
# include <asm/uprobes.h> # include <asm/uprobes.h>
#endif #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 { struct uprobe_consumer {
int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs);
/* /*
Expand All @@ -59,7 +49,6 @@ struct uprobe_consumer {
#ifdef CONFIG_UPROBES #ifdef CONFIG_UPROBES
enum uprobe_task_state { enum uprobe_task_state {
UTASK_RUNNING, UTASK_RUNNING,
UTASK_BP_HIT,
UTASK_SSTEP, UTASK_SSTEP,
UTASK_SSTEP_ACK, UTASK_SSTEP_ACK,
UTASK_SSTEP_TRAPPED, UTASK_SSTEP_TRAPPED,
Expand Down
Loading

0 comments on commit e17b131

Please sign in to comment.