Re: [PATCH] uprobes/x86: emulate push insns for uprobe on x86

2017-11-10 Thread Oleg Nesterov
Yonghong, The patch looks good to me, but I'll try to read it carefully later. Just a couple of cosmetic nits for now. On 11/09, Yonghong Song wrote: > > --- a/arch/x86/include/asm/uprobes.h > +++ b/arch/x86/include/asm/uprobes.h > @@ -53,6 +53,10 @@ struct arch_uprobe { > u

[PATCH] uprobes/x86: emulate push insns for uprobe on x86

2017-11-09 Thread Yonghong Song
Uprobe is a tracing mechanism for userspace programs. Typical uprobe will incur overhead of two traps. First trap is caused by replaced trap insn, and the second trap is to execute the original displaced insn in user space. To reduce the overhead, kernel provides hooks for architectures to emulate

Re: [PATCH] uprobes/x86: emulate push insns for uprobe on x86

2017-11-09 Thread Yonghong Song
On 11/9/17 5:44 AM, Oleg Nesterov wrote: On 11/09, Yonghong Song wrote: This patch extends the emulation to "push " insns. These insns are typical in the beginning of the function. For example, bcc in https://github.com/iovisor/bcc repo provides tools to measure funclantency, detect memleak,

Re: [PATCH] uprobes/x86: emulate push insns for uprobe on x86

2017-11-09 Thread Oleg Nesterov
On 11/09, Yonghong Song wrote: > > + if (insn_class == UPROBE_PUSH_INSN) { > + src_ptr = get_push_reg_ptr(auprobe, regs); > + reg_width = sizeof_long(); > + sp = regs->sp; > + if (copy_to_user((void __user *)(sp - reg_width), src_ptr, > reg_width

Re: [PATCH] uprobes/x86: emulate push insns for uprobe on x86

2017-11-09 Thread Oleg Nesterov
On 11/09, Oleg Nesterov wrote: > > And. Do you really need ->post_xol() method to emulate "push"? Why we can't > simply execute it out-of-line if copy_to_user() fails? > > branch_post_xol_op() is needed because we can't execute "call" out-of-line, > we need to restart and try again if copy_to_user(

Re: [PATCH] uprobes/x86: emulate push insns for uprobe on x86

2017-11-09 Thread Oleg Nesterov
On 11/09, Yonghong Song wrote: > > This patch extends the emulation to "push " > insns. These insns are typical in the beginning > of the function. For example, bcc > in https://github.com/iovisor/bcc repo provides > tools to measure funclantency, detect memleak, etc. > The tools will place uprobes

[PATCH] uprobes/x86: emulate push insns for uprobe on x86

2017-11-09 Thread Yonghong Song
Uprobe is a tracing mechanism for userspace programs. Typical uprobe will incur overhead of two traps. First trap is caused by replaced trap insn, and the second trap is to execute the original displaced insn in user space. To reduce the overhead, kernel provides hooks for architectures to emulate