Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf update from Thomas Gleixner: "The perf crowd presents: Kernel updates: - Removal of jprobes - Cleanup and consolidatation the handling of kprobes - Cleanup and consolidation of hardware breakpoints - The usual pile of fixes and updates to PMUs and event descriptors Tooling updates: - Updates and improvements all over the place. Nothing outstanding, just the (good) boring incremental grump work" * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (103 commits) perf trace: Do not require --no-syscalls to suppress strace like output perf bpf: Include uapi/linux/bpf.h from the 'perf trace' script's bpf.h perf tools: Allow overriding MAX_NR_CPUS at compile time perf bpf: Show better message when failing to load an object perf list: Unify metric group description format with PMU event description perf vendor events arm64: Update ThunderX2 implementation defined pmu core events perf cs-etm: Generate branch sample for CS_ETM_TRACE_ON packet perf cs-etm: Generate branch sample when receiving a CS_ETM_TRACE_ON packet perf cs-etm: Support dummy address value for CS_ETM_TRACE_ON packet perf cs-etm: Fix start tracing packet handling perf build: Fix installation directory for eBPF perf c2c report: Fix crash for empty browser perf tests: Fix indexing when invoking subtests perf trace: Beautify the AF_INET & AF_INET6 'socket' syscall 'protocol' args perf trace beauty: Add beautifiers for 'socket''s 'protocol' arg perf trace beauty: Do not print NULL strarray entries perf beauty: Add a generator for IPPROTO_ socket's protocol constants tools include uapi: Grab a copy of linux/in.h perf tests: Fix complex event name parsing perf evlist: Fix error out while applying initial delay and LBR ...
This commit is contained in:
@@ -68,16 +68,6 @@ struct prev_kprobe {
|
||||
unsigned long saved_epc;
|
||||
};
|
||||
|
||||
#define MAX_JPROBES_STACK_SIZE 128
|
||||
#define MAX_JPROBES_STACK_ADDR \
|
||||
(((unsigned long)current_thread_info()) + THREAD_SIZE - 32 - sizeof(struct pt_regs))
|
||||
|
||||
#define MIN_JPROBES_STACK_SIZE(ADDR) \
|
||||
((((ADDR) + MAX_JPROBES_STACK_SIZE) > MAX_JPROBES_STACK_ADDR) \
|
||||
? MAX_JPROBES_STACK_ADDR - (ADDR) \
|
||||
: MAX_JPROBES_STACK_SIZE)
|
||||
|
||||
|
||||
#define SKIP_DELAYSLOT 0x0001
|
||||
|
||||
/* per-cpu kprobe control block */
|
||||
@@ -86,12 +76,9 @@ struct kprobe_ctlblk {
|
||||
unsigned long kprobe_old_SR;
|
||||
unsigned long kprobe_saved_SR;
|
||||
unsigned long kprobe_saved_epc;
|
||||
unsigned long jprobe_saved_sp;
|
||||
struct pt_regs jprobe_saved_regs;
|
||||
/* Per-thread fields, used while emulating branches */
|
||||
unsigned long flags;
|
||||
unsigned long target_epc;
|
||||
u8 jprobes_stack[MAX_JPROBES_STACK_SIZE];
|
||||
struct prev_kprobe prev_kprobe;
|
||||
};
|
||||
|
||||
|
@@ -326,19 +326,13 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
|
||||
preempt_enable_no_resched();
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
if (addr->word != breakpoint_insn.word) {
|
||||
/*
|
||||
* The breakpoint instruction was removed by
|
||||
* another cpu right after we hit, no further
|
||||
* handling of this interrupt is appropriate
|
||||
*/
|
||||
ret = 1;
|
||||
goto no_kprobe;
|
||||
}
|
||||
p = __this_cpu_read(current_kprobe);
|
||||
if (p->break_handler && p->break_handler(p, regs))
|
||||
goto ss_probe;
|
||||
} else if (addr->word != breakpoint_insn.word) {
|
||||
/*
|
||||
* The breakpoint instruction was removed by
|
||||
* another cpu right after we hit, no further
|
||||
* handling of this interrupt is appropriate
|
||||
*/
|
||||
ret = 1;
|
||||
}
|
||||
goto no_kprobe;
|
||||
}
|
||||
@@ -364,10 +358,11 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
|
||||
|
||||
if (p->pre_handler && p->pre_handler(p, regs)) {
|
||||
/* handler has already set things up, so skip ss setup */
|
||||
reset_current_kprobe();
|
||||
preempt_enable_no_resched();
|
||||
return 1;
|
||||
}
|
||||
|
||||
ss_probe:
|
||||
prepare_singlestep(p, regs, kcb);
|
||||
if (kcb->flags & SKIP_DELAYSLOT) {
|
||||
kcb->kprobe_status = KPROBE_HIT_SSDONE;
|
||||
@@ -468,51 +463,6 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
|
||||
{
|
||||
struct jprobe *jp = container_of(p, struct jprobe, kp);
|
||||
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
|
||||
|
||||
kcb->jprobe_saved_regs = *regs;
|
||||
kcb->jprobe_saved_sp = regs->regs[29];
|
||||
|
||||
memcpy(kcb->jprobes_stack, (void *)kcb->jprobe_saved_sp,
|
||||
MIN_JPROBES_STACK_SIZE(kcb->jprobe_saved_sp));
|
||||
|
||||
regs->cp0_epc = (unsigned long)(jp->entry);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Defined in the inline asm below. */
|
||||
void jprobe_return_end(void);
|
||||
|
||||
void __kprobes jprobe_return(void)
|
||||
{
|
||||
/* Assembler quirk necessitates this '0,code' business. */
|
||||
asm volatile(
|
||||
"break 0,%0\n\t"
|
||||
".globl jprobe_return_end\n"
|
||||
"jprobe_return_end:\n"
|
||||
: : "n" (BRK_KPROBE_BP) : "memory");
|
||||
}
|
||||
|
||||
int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
|
||||
{
|
||||
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
|
||||
|
||||
if (regs->cp0_epc >= (unsigned long)jprobe_return &&
|
||||
regs->cp0_epc <= (unsigned long)jprobe_return_end) {
|
||||
*regs = kcb->jprobe_saved_regs;
|
||||
memcpy((void *)kcb->jprobe_saved_sp, kcb->jprobes_stack,
|
||||
MIN_JPROBES_STACK_SIZE(kcb->jprobe_saved_sp));
|
||||
preempt_enable_no_resched();
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function return probe trampoline:
|
||||
* - init_kprobes() establishes a probepoint here
|
||||
@@ -595,9 +545,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
|
||||
kretprobe_assert(ri, orig_ret_address, trampoline_address);
|
||||
instruction_pointer(regs) = orig_ret_address;
|
||||
|
||||
reset_current_kprobe();
|
||||
kretprobe_hash_unlock(current, &flags);
|
||||
preempt_enable_no_resched();
|
||||
|
||||
hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
|
||||
hlist_del(&ri->hlist);
|
||||
|
Reference in New Issue
Block a user