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

2017-11-15 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song <y...@fb.com> --- arch/x86/include/asm/uprobes.h | 4 ++ arch/x86/kernel/uprobes.c | 107 +

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

2017-11-14 Thread Yonghong Song
On 11/14/17 7:51 AM, Oleg Nesterov wrote: On 11/13, Yonghong Song wrote: +static int push_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) +{ + u8 opc1 = OPCODE1(insn), reg_offset = 0; + + if (opc1 < 0x50 || opc1 > 0x57) + return -

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

2017-11-14 Thread Yonghong Song
On 11/14/17 7:34 AM, Oleg Nesterov wrote: On 11/13, Yonghong Song wrote: On 11/13/17 4:59 AM, Oleg Nesterov wrote: + switch (opc1) { + case 0x50: + reg_offset = offsetof(struct pt_regs, r8); + break

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

2017-11-14 Thread Yonghong Song
On 11/14/17 8:03 AM, Oleg Nesterov wrote: On 11/14, Oleg Nesterov wrote: +#ifdef CONFIG_X86_64 + if (test_thread_flag(TIF_ADDR32)) + return -ENOSYS; +#endif No, this doesn't look right, see my previous email. You should do this check in the "if (insn->length == 2)"

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

2017-11-27 Thread Yonghong Song
Hi, Ingo and Peter, This patch has been reviewed by Oleg Nesterov. Could you take a look and help merge it upstream? Thanks! Yonghong On 11/20/17 10:25 AM, Yonghong Song wrote: On 11/20/17 8:41 AM, Oleg Nesterov wrote: On 11/17, Yonghong Song wrote: On 11/17/17 9:25 AM, Oleg Nesterov

Re: perf test LLVM & clang 6 failing

2017-11-27 Thread Yonghong Song
On 11/27/17 9:04 AM, Arnaldo Carvalho de Melo wrote: Em Fri, Nov 24, 2017 at 04:16:52PM +0100, Daniel Borkmann escreveu: [ +Yonghong ] + Josh On 11/24/2017 03:47 PM, Arnaldo Carvalho de Melo wrote: FYI, just noticed, recently updated clang to version 6, from its upstream git repo. Do

Re: perf test LLVM & clang 6 failing

2017-11-25 Thread Yonghong Song
On 11/24/17 11:09 AM, Arnaldo Carvalho de Melo wrote: Em Fri, Nov 24, 2017 at 04:16:52PM +0100, Daniel Borkmann escreveu: [ +Yonghong ] On 11/24/2017 03:47 PM, Arnaldo Carvalho de Melo wrote: FYI, just noticed, recently updated clang to version 6, from its upstream git repo. Do you recall

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

2017-11-30 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song <y...@fb.com> Reviewed-by: Oleg Nesterov <o...@redhat.com> ---

Re: perf test LLVM & clang 6 failing

2017-11-27 Thread Yonghong Song
On 11/27/17 1:45 PM, Matthias Kaehlcke wrote: El Mon, Nov 27, 2017 at 01:57:56PM -0600 Josh Poimboeuf ha dit: On Mon, Nov 27, 2017 at 04:34:25PM -0300, Arnaldo Carvalho de Melo wrote: Em Mon, Nov 27, 2017 at 11:11:56AM -0800, Yonghong Song escreveu: On 11/27/17 9:04 AM, Arnaldo Carvalho de

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

2017-11-17 Thread Yonghong Song
On 11/17/17 9:25 AM, Oleg Nesterov wrote: On 11/15, Yonghong Song wrote: v3 -> v4: . Revert most of v3 change as 32bit emulation is not really working on x86_64 platform as among other issues, function emulate_push_stack() needs to account for 32bit app on 64bit platf

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

2017-11-10 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song <y...@fb.com> --- arch/x86/include/asm/uprobes.h | 4 ++ arch/x86/kernel/uprobes.c | 108 +

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

2017-11-20 Thread Yonghong Song
On 11/20/17 8:41 AM, Oleg Nesterov wrote: On 11/17, Yonghong Song wrote: On 11/17/17 9:25 AM, Oleg Nesterov wrote: On 11/15, Yonghong Song wrote: v3 -> v4: . Revert most of v3 change as 32bit emulation is not really working on x86_64 platform as among other issues, funct

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

2017-11-15 Thread Yonghong Song
On 11/15/17 9:07 AM, Oleg Nesterov wrote: On 11/15, Oleg Nesterov wrote: So please, check if uprobe_init_insn() fails or not in this case. After that we will know whether your patch needs the additional is_64bit_mm() check in push_setup_xol_ops() or not. OK, I did the check for you.

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

2017-11-13 Thread Yonghong Song
On 11/13/17 4:59 AM, Oleg Nesterov wrote: The patch looks good to me, but I have a question because I know nothing about insn encoding, On 11/10, Yonghong Song wrote: +static int push_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) +{ + u8 opc1 = OPCODE1(insn

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

2017-11-13 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song <y...@fb.com> --- arch/x86/include/asm/uprobes.h | 4 ++ arch/x86/kernel/uprobes.c | 111 +

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

2017-11-09 Thread Yonghong Song
On 11/9/17 3:26 AM, David Laight wrote: From: Yonghong Song Sent: 09 November 2017 00:55 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

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, dete

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

2017-11-09 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song <y...@fb.com> --- arch/x86/include/asm/uprobes.h | 4 ++ arch/x86/kernel/uprobes.c | 110 +

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

2017-11-08 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song <y...@fb.com> --- arch/x86/include/asm/uprobes.h | 10 arch/x86/kernel/uprobes.c | 115 +++

[PATCH x86 v2] uprobe: emulate push insns for uprobe on x86

2017-11-08 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song <y...@fb.com> --- arch/x86/include/asm/uprobes.h | 10 arch/x86/kernel/uprobes.c | 115 +++

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

2017-11-08 Thread Yonghong Song
On 11/8/17 4:06 PM, David Miller wrote: From: Yonghong Song <y...@fb.com> Date: Wed, 8 Nov 2017 13:37:12 -0800 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 e

[RESEND PATCH tip] x86/idt: Remove X86_TRAP_BP initialization in idt_setup_traps()

2017-11-08 Thread Yonghong Song
ts. Tested on both x86_64 and x86_32, uprobe works fine. Fixes: b70543a0b2b6("x86/idt: Move regular trap init to tables") Reported-and-tested-by: Yonghong Song <y...@fb.com> Signed-off-by: Yonghong Song <y...@fb.com> --- arch/x86/kernel/idt.c | 2 -- 1 file changed, 2 deletio

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

2017-11-08 Thread Yonghong Song
On 11/8/17 10:53 PM, Thomas Gleixner wrote: On Wed, 8 Nov 2017, Yonghong Song wrote: On 11/8/17 4:06 PM, David Miller wrote: From: Yonghong Song <y...@fb.com> Date: Wed, 8 Nov 2017 13:37:12 -0800 Uprobe is a tracing mechanism for userspace programs. Typical uprobe will incur ov

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

2017-11-09 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song <y...@fb.com> --- arch/x86/include/asm/uprobes.h | 10 arch/x86/kernel/uprobes.c | 115 +++

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

2017-12-05 Thread Yonghong Song
Hi, Ingo and Peter, Could you take a look at this patch and if no objection merge it into tip? This patch has been reviewed by Oleg Nesterov. Thanks! Yonghong On 11/30/17 4:12 PM, Yonghong Song wrote: Uprobe is a tracing mechanism for userspace programs. Typical uprobe will incur overhead

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-04-27 Thread Yonghong Song
Hi, Peter, Just wanted to ping again so that you did not miss the email below. Please let me know your opinion. Thanks! Yonghong On 4/23/18 9:50 AM, Yonghong Song wrote: Hi, Peter, Please see comments below. On 4/23/18 3:52 AM, Peter Zijlstra wrote: On Fri, Apr 20, 2018 at 11:06:03AM

Re: perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6

2018-06-16 Thread Yonghong Song
On 6/16/18 5:26 AM, Arnaldo Carvalho de Melo wrote: Hi Wang, Yogong, While reviewing the BTF patches for pahole, I updated llvm/clang to HEAD and then building perf with clang embedded I noticed this, will investigate, posting here to document the regression, maybe this is something

[PATCH] tools/perf: fix a clang 7.0 compilation error

2018-06-16 Thread Yonghong Song
This patch fixed the issue with using proper function signatures under different compiler versions. Reported-by: Arnaldo Carvalho de Melo Signed-off-by: Yonghong Song --- tools/perf/util/c++/clang.cpp | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/c++/

Re: perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6

2018-06-18 Thread Yonghong Song
On 6/18/18 7:31 AM, Arnaldo Carvalho de Melo wrote: Em Sat, Jun 16, 2018 at 10:20:21AM -0700, Yonghong Song escreveu: On 6/16/18 5:26 AM, Arnaldo Carvalho de Melo wrote: Hi Wang, Yogong, While reviewing the BTF patches for pahole, I updated llvm/clang to HEAD and then building

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-05-02 Thread Yonghong Song
Hi, Peter, Ping again. Did you get chances to think about this issue again? Thanks! Yonghong On 4/27/18 9:34 AM, Yonghong Song wrote: Hi, Peter, Just wanted to ping again so that you did not miss the email below. Please let me know your opinion. Thanks! Yonghong On 4/23/18 9:50 AM

[PATCH bpf v3] x86/cpufeature: bpf hack for clang not supporting asm goto

2018-05-03 Thread Yonghong Song
Remove FAST_FEATURE_TESTS") Suggested-by: Alexei Starovoitov <a...@kernel.org> Signed-off-by: Yonghong Song <y...@fb.com> --- Makefile | 1 + arch/x86/include/asm/cpufeature.h | 5 + 2 files changed, 6 insertions(+) Changelog: v2 -> v3: . Changed macr

Re: [lkp-robot] [tools/bpf] 8c417dc15f: BUG:sleeping_function_called_from_invalid_context_at_mm/slab.h

2018-01-27 Thread Yonghong Song
Thanks for reporting. This issue has been fixed by the below commit in bpf-next repo, which is waiting to be pulled into net-next. = commit 2310035fa03f651dd5b03f19a26a97512aa8842c Author: Yonghong Song <y...@fb.com> Date: Mon Jan 22 22:53:51 2018 -0800 bpf: fix incorrect k

Re: [kmemleak] unreferenced object 0xcd9c1a80 (size 192):

2018-02-12 Thread Yonghong Song
On 2/12/18 7:55 AM, Alexei Starovoitov wrote: On Mon, Feb 12, 2018 at 09:28:33AM +0100, Daniel Borkmann wrote: On 02/12/2018 06:47 AM, Yonghong Song wrote: On 2/11/18 11:18 AM, Mathieu Malaterre wrote: On Sun, Feb 11, 2018 at 5:54 PM, Alexei Starovoitov <alexei.starovoi...@gmail.com>

Re: [kmemleak] unreferenced object 0xcd9c1a80 (size 192):

2018-02-11 Thread Yonghong Song
On 2/11/18 11:18 AM, Mathieu Malaterre wrote: Hi, On Sun, Feb 11, 2018 at 5:54 PM, Alexei Starovoitov wrote: On Sun, Feb 11, 2018 at 7:24 AM, Mathieu Malaterre wrote: Alexei, Could you please comment on why I am seeing those memleaks being

Re: [RFC PATCH net-next] tools/bpftool: use version from the kernel source tree

2017-12-20 Thread Yonghong Song
On 12/20/17 12:19 PM, Roman Gushchin wrote: Bpftool determines it's own version based on the kernel version, which is picked from the linux/version.h header. It's strange to use the version of the installed kernel headers, and makes much more sense to use the version of the actual source

Re: [PATCH] bpf: whitelist syscalls for error injection

2018-03-13 Thread Yonghong Song
On 3/13/18 4:45 PM, Omar Sandoval wrote: On Tue, Mar 13, 2018 at 04:16:27PM -0700, Howard McLauchlan wrote: Error injection is a useful mechanism to fail arbitrary kernel functions. However, it is often hard to guarantee an error propagates appropriately to user space programs. By injecting

[PATCH] x86/cpufeature: guard asm_volatile_goto usage with CC_HAVE_ASM_GOTO

2018-04-10 Thread Yonghong Song
ear. If later clang compiler starts to support asm_volatile_goto, the change in this patch can be reverted and there should be no impact on BPF compilation. Fixes: d0266046ad54 ("x86: Remove FAST_FEATURE_TESTS") Signed-off-by: Yonghong Song <y...@fb.com> --- arch/x86/include/asm/cpuf

bpf: handling non BPF register names in inline assembly with -target bpf

2018-04-11 Thread Yonghong Song
Hi, Arnaldo, When I studied the bpf compilation issue with latest linus/net-next kernel (https://patchwork.kernel.org/patch/10333829/), an alternative approach I tried is to use __BPF__ macro. The following patch introduced "#ifndef __BPF__" in arch/x86/include/asm/asm.h for some inline

Re: bpf: handling non BPF register names in inline assembly with -target bpf

2018-04-11 Thread Yonghong Song
On 4/11/18 11:39 AM, Arnaldo Carvalho de Melo wrote: Em Wed, Apr 11, 2018 at 09:37:46AM -0700, Yonghong Song escreveu: Hi, Arnaldo, When I studied the bpf compilation issue with latest linus/net-next kernel (https://patchwork.kernel.org/patch/10333829/), an alternative approach I tried

Re: bpf: handling non BPF register names in inline assembly with -target bpf

2018-04-11 Thread Yonghong Song
On 4/11/18 4:17 PM, Arnaldo Carvalho de Melo wrote: Em Wed, Apr 11, 2018 at 04:47:29PM -0300, Arnaldo Carvalho de Melo escreveu: Em Wed, Apr 11, 2018 at 12:22:37PM -0700, Yonghong Song escreveu: Look at test bpf-script-test-kbuild.c, I think you can drop uapi/asm/ptrace.h from include file

Re: [PATCH] x86/cpufeature: guard asm_volatile_goto usage with CC_HAVE_ASM_GOTO

2018-04-14 Thread Yonghong Song
On 4/14/18 3:11 AM, Peter Zijlstra wrote: On Fri, Apr 13, 2018 at 01:42:14PM -0700, Alexei Starovoitov wrote: On 4/13/18 11:19 AM, Peter Zijlstra wrote: On Tue, Apr 10, 2018 at 02:28:04PM -0700, Alexei Starovoitov wrote: Instead of #ifdef CC_HAVE_ASM_GOTO we can replace it with #ifndef

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-04-20 Thread Yonghong Song
On 4/20/18 1:19 AM, Peter Zijlstra wrote: On Sat, Apr 14, 2018 at 09:27:38PM -0700, Yonghong Song wrote: This patch adds a preprocessor guard NO_BPF_WORKAROUND around the asm_volatile_goto based static_cpu_has(). NO_BPF_WORKAROUND is set at toplevel Makefile when compiler supports asm-goto

[PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-04-14 Thread Yonghong Song
4 ("x86: Remove FAST_FEATURE_TESTS") Suggested-by: Alexei Starovoitov <a...@kernel.org> Signed-off-by: Yonghong Song <y...@fb.com> --- Makefile | 1 + arch/x86/include/asm/cpufeature.h | 5 + 2 files changed, 6 insertions(+) Changelog: v1 -> v2

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-04-19 Thread Yonghong Song
Hi, Peter, Just pinging. Did you get chances to look at this? [ cc netdev as well so folks are aware of the issue. ] Thanks! Yonghong On 4/14/18 9:27 PM, Yonghong Song wrote: Commit d0266046ad54 ("x86: Remove FAST_FEATURE_TESTS") removed X86_FAST_FEATURE_TESTS and make macro stat

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-04-23 Thread Yonghong Song
Hi, Peter, Please see comments below. On 4/23/18 3:52 AM, Peter Zijlstra wrote: On Fri, Apr 20, 2018 at 11:06:03AM -0700, Yonghong Song wrote: On 4/20/18 1:19 AM, Peter Zijlstra wrote: Hurm, so adding __BPF__ for BPF compiles isn't an option? It seems to me having a CPP flag to identify

Re: [PATCH] test_bpf: Fix testing with CONFIG_BPF_JIT_ALWAYS_ON=y on other arches

2018-03-20 Thread Yonghong Song
On 3/20/18 5:58 AM, Thadeu Lima de Souza Cascardo wrote: Function bpf_fill_maxinsns11 is designed to not be able to be JITed on x86_64. So, it fails when CONFIG_BPF_JIT_ALWAYS_ON=y, and commit 09584b406742 ("bpf: fix selftests/bpf test_kmod.sh failure when CONFIG_BPF_JIT_ALWAYS_ON=y") makes

Re: [PATCH] test_bpf: Fix testing with CONFIG_BPF_JIT_ALWAYS_ON=y on other arches

2018-03-20 Thread Yonghong Song
On 3/20/18 10:00 AM, Thadeu Lima de Souza Cascardo wrote: On Tue, Mar 20, 2018 at 09:05:15AM -0700, Yonghong Song wrote: On 3/20/18 5:58 AM, Thadeu Lima de Souza Cascardo wrote: Function bpf_fill_maxinsns11 is designed to not be able to be JITed on x86_64. So, it fails when

Re: [LKP] [tools/bpf] f6f3bac08f: stderr.failed_to_prepare_for_bpf

2018-11-05 Thread Yonghong Song
I cannot reproduce in my local fc28 system with the attached steps. The netlink_dumper.c file, could you confirm whether the following header files are missing form you rhel-7.2 host? #include #include I suspect you probably miss linux/tc_act/tc_bpf.h. But could you confirm it? If this is

Re: [LKP] [tools/bpf] f6f3bac08f: stderr.failed_to_prepare_for_bpf

2018-11-06 Thread Yonghong Song
On 11/6/18 2:04 AM, Li Zhijian wrote: > > On 11/6/2018 9:47 AM, Yonghong Song wrote: >> I cannot reproduce in my local fc28 system with the attached steps. >> >> The netlink_dumper.c file, could you confirm whether the following >> header files are missing form you

Re: [PATCH] bpf: whitelist syscalls for error injection

2018-03-13 Thread Yonghong Song
On 3/13/18 4:45 PM, Omar Sandoval wrote: On Tue, Mar 13, 2018 at 04:16:27PM -0700, Howard McLauchlan wrote: Error injection is a useful mechanism to fail arbitrary kernel functions. However, it is often hard to guarantee an error propagates appropriately to user space programs. By injecting

Re: [PATCH] test_bpf: Fix testing with CONFIG_BPF_JIT_ALWAYS_ON=y on other arches

2018-03-20 Thread Yonghong Song
On 3/20/18 5:58 AM, Thadeu Lima de Souza Cascardo wrote: Function bpf_fill_maxinsns11 is designed to not be able to be JITed on x86_64. So, it fails when CONFIG_BPF_JIT_ALWAYS_ON=y, and commit 09584b406742 ("bpf: fix selftests/bpf test_kmod.sh failure when CONFIG_BPF_JIT_ALWAYS_ON=y") makes

Re: [PATCH] test_bpf: Fix testing with CONFIG_BPF_JIT_ALWAYS_ON=y on other arches

2018-03-20 Thread Yonghong Song
On 3/20/18 10:00 AM, Thadeu Lima de Souza Cascardo wrote: On Tue, Mar 20, 2018 at 09:05:15AM -0700, Yonghong Song wrote: On 3/20/18 5:58 AM, Thadeu Lima de Souza Cascardo wrote: Function bpf_fill_maxinsns11 is designed to not be able to be JITed on x86_64. So, it fails when

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-04-27 Thread Yonghong Song
Hi, Peter, Just wanted to ping again so that you did not miss the email below. Please let me know your opinion. Thanks! Yonghong On 4/23/18 9:50 AM, Yonghong Song wrote: Hi, Peter, Please see comments below. On 4/23/18 3:52 AM, Peter Zijlstra wrote: On Fri, Apr 20, 2018 at 11:06:03AM

[PATCH bpf v3] x86/cpufeature: bpf hack for clang not supporting asm goto

2018-05-03 Thread Yonghong Song
Remove FAST_FEATURE_TESTS") Suggested-by: Alexei Starovoitov Signed-off-by: Yonghong Song --- Makefile | 1 + arch/x86/include/asm/cpufeature.h | 5 + 2 files changed, 6 insertions(+) Changelog: v2 -> v3: . Changed macro name from NO_BPF_WORKAROUND to __NO_C

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-05-02 Thread Yonghong Song
Hi, Peter, Ping again. Did you get chances to think about this issue again? Thanks! Yonghong On 4/27/18 9:34 AM, Yonghong Song wrote: Hi, Peter, Just wanted to ping again so that you did not miss the email below. Please let me know your opinion. Thanks! Yonghong On 4/23/18 9:50 AM

Re: [RFC PATCH net-next] tools/bpftool: use version from the kernel source tree

2017-12-20 Thread Yonghong Song
On 12/20/17 12:19 PM, Roman Gushchin wrote: Bpftool determines it's own version based on the kernel version, which is picked from the linux/version.h header. It's strange to use the version of the installed kernel headers, and makes much more sense to use the version of the actual source

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

2017-11-27 Thread Yonghong Song
Hi, Ingo and Peter, This patch has been reviewed by Oleg Nesterov. Could you take a look and help merge it upstream? Thanks! Yonghong On 11/20/17 10:25 AM, Yonghong Song wrote: On 11/20/17 8:41 AM, Oleg Nesterov wrote: On 11/17, Yonghong Song wrote: On 11/17/17 9:25 AM, Oleg Nesterov

Re: perf test LLVM & clang 6 failing

2017-11-27 Thread Yonghong Song
On 11/27/17 9:04 AM, Arnaldo Carvalho de Melo wrote: Em Fri, Nov 24, 2017 at 04:16:52PM +0100, Daniel Borkmann escreveu: [ +Yonghong ] + Josh On 11/24/2017 03:47 PM, Arnaldo Carvalho de Melo wrote: FYI, just noticed, recently updated clang to version 6, from its upstream git repo. Do

Re: perf test LLVM & clang 6 failing

2017-11-27 Thread Yonghong Song
On 11/27/17 1:45 PM, Matthias Kaehlcke wrote: El Mon, Nov 27, 2017 at 01:57:56PM -0600 Josh Poimboeuf ha dit: On Mon, Nov 27, 2017 at 04:34:25PM -0300, Arnaldo Carvalho de Melo wrote: Em Mon, Nov 27, 2017 at 11:11:56AM -0800, Yonghong Song escreveu: On 11/27/17 9:04 AM, Arnaldo Carvalho de

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

2017-12-05 Thread Yonghong Song
Hi, Ingo and Peter, Could you take a look at this patch and if no objection merge it into tip? This patch has been reviewed by Oleg Nesterov. Thanks! Yonghong On 11/30/17 4:12 PM, Yonghong Song wrote: Uprobe is a tracing mechanism for userspace programs. Typical uprobe will incur overhead

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

2017-11-13 Thread Yonghong Song
On 11/13/17 4:59 AM, Oleg Nesterov wrote: The patch looks good to me, but I have a question because I know nothing about insn encoding, On 11/10, Yonghong Song wrote: +static int push_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) +{ + u8 opc1 = OPCODE1(insn

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

2017-11-13 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song --- arch/x86/include/asm/uprobes.h | 4 ++ arch/x86/kernel/uprobes.c | 111 +

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

2017-11-14 Thread Yonghong Song
On 11/14/17 7:34 AM, Oleg Nesterov wrote: On 11/13, Yonghong Song wrote: On 11/13/17 4:59 AM, Oleg Nesterov wrote: + switch (opc1) { + case 0x50: + reg_offset = offsetof(struct pt_regs, r8); + break

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

2017-11-14 Thread Yonghong Song
On 11/14/17 7:51 AM, Oleg Nesterov wrote: On 11/13, Yonghong Song wrote: +static int push_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) +{ + u8 opc1 = OPCODE1(insn), reg_offset = 0; + + if (opc1 < 0x50 || opc1 > 0x57) + return -

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

2017-11-14 Thread Yonghong Song
On 11/14/17 8:03 AM, Oleg Nesterov wrote: On 11/14, Oleg Nesterov wrote: +#ifdef CONFIG_X86_64 + if (test_thread_flag(TIF_ADDR32)) + return -ENOSYS; +#endif No, this doesn't look right, see my previous email. You should do this check in the "if (insn->length == 2)"

[RESEND PATCH tip] x86/idt: Remove X86_TRAP_BP initialization in idt_setup_traps()

2017-11-08 Thread Yonghong Song
ts. Tested on both x86_64 and x86_32, uprobe works fine. Fixes: b70543a0b2b6("x86/idt: Move regular trap init to tables") Reported-and-tested-by: Yonghong Song Signed-off-by: Yonghong Song --- arch/x86/kernel/idt.c | 2 -- 1 file changed, 2 deletions(-) [RESEND with adding linux-ke

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

2017-11-08 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song --- arch/x86/include/asm/uprobes.h | 10 arch/x86/kernel/uprobes.c | 115 ++

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

2017-11-08 Thread Yonghong Song
On 11/8/17 4:06 PM, David Miller wrote: From: Yonghong Song Date: Wed, 8 Nov 2017 13:37:12 -0800 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

[PATCH x86 v2] uprobe: emulate push insns for uprobe on x86

2017-11-08 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song --- arch/x86/include/asm/uprobes.h | 10 arch/x86/kernel/uprobes.c | 115 ++

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

2017-11-08 Thread Yonghong Song
On 11/8/17 10:53 PM, Thomas Gleixner wrote: On Wed, 8 Nov 2017, Yonghong Song wrote: On 11/8/17 4:06 PM, David Miller wrote: From: Yonghong Song Date: Wed, 8 Nov 2017 13:37:12 -0800 Uprobe is a tracing mechanism for userspace programs. Typical uprobe will incur overhead of two traps

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

2017-11-09 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song --- arch/x86/include/asm/uprobes.h | 10 arch/x86/kernel/uprobes.c | 115

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

2017-11-09 Thread Yonghong Song
On 11/9/17 3:26 AM, David Laight wrote: From: Yonghong Song Sent: 09 November 2017 00:55 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

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, dete

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

2017-11-09 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song --- arch/x86/include/asm/uprobes.h | 4 ++ arch/x86/kernel/uprobes.c | 110 +

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

2017-11-10 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song --- arch/x86/include/asm/uprobes.h | 4 ++ arch/x86/kernel/uprobes.c | 108 +

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

2017-11-17 Thread Yonghong Song
On 11/17/17 9:25 AM, Oleg Nesterov wrote: On 11/15, Yonghong Song wrote: v3 -> v4: . Revert most of v3 change as 32bit emulation is not really working on x86_64 platform as among other issues, function emulate_push_stack() needs to account for 32bit app on 64bit platf

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

2017-11-20 Thread Yonghong Song
On 11/20/17 8:41 AM, Oleg Nesterov wrote: On 11/17, Yonghong Song wrote: On 11/17/17 9:25 AM, Oleg Nesterov wrote: On 11/15, Yonghong Song wrote: v3 -> v4: . Revert most of v3 change as 32bit emulation is not really working on x86_64 platform as among other issues, funct

Re: bpf: handling non BPF register names in inline assembly with -target bpf

2018-04-11 Thread Yonghong Song
On 4/11/18 11:39 AM, Arnaldo Carvalho de Melo wrote: Em Wed, Apr 11, 2018 at 09:37:46AM -0700, Yonghong Song escreveu: Hi, Arnaldo, When I studied the bpf compilation issue with latest linus/net-next kernel (https://patchwork.kernel.org/patch/10333829/), an alternative approach I tried

Re: bpf: handling non BPF register names in inline assembly with -target bpf

2018-04-11 Thread Yonghong Song
On 4/11/18 4:17 PM, Arnaldo Carvalho de Melo wrote: Em Wed, Apr 11, 2018 at 04:47:29PM -0300, Arnaldo Carvalho de Melo escreveu: Em Wed, Apr 11, 2018 at 12:22:37PM -0700, Yonghong Song escreveu: Look at test bpf-script-test-kbuild.c, I think you can drop uapi/asm/ptrace.h from include file

Re: [PATCH] x86/cpufeature: guard asm_volatile_goto usage with CC_HAVE_ASM_GOTO

2018-04-14 Thread Yonghong Song
On 4/14/18 3:11 AM, Peter Zijlstra wrote: On Fri, Apr 13, 2018 at 01:42:14PM -0700, Alexei Starovoitov wrote: On 4/13/18 11:19 AM, Peter Zijlstra wrote: On Tue, Apr 10, 2018 at 02:28:04PM -0700, Alexei Starovoitov wrote: Instead of #ifdef CC_HAVE_ASM_GOTO we can replace it with #ifndef

[PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-04-14 Thread Yonghong Song
4 ("x86: Remove FAST_FEATURE_TESTS") Suggested-by: Alexei Starovoitov Signed-off-by: Yonghong Song --- Makefile | 1 + arch/x86/include/asm/cpufeature.h | 5 + 2 files changed, 6 insertions(+) Changelog: v1 -> v2: Use NO_BPF_WORKAROUND macro instead of CC_HAV

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-04-20 Thread Yonghong Song
On 4/20/18 1:19 AM, Peter Zijlstra wrote: On Sat, Apr 14, 2018 at 09:27:38PM -0700, Yonghong Song wrote: This patch adds a preprocessor guard NO_BPF_WORKAROUND around the asm_volatile_goto based static_cpu_has(). NO_BPF_WORKAROUND is set at toplevel Makefile when compiler supports asm-goto

[PATCH] x86/cpufeature: guard asm_volatile_goto usage with CC_HAVE_ASM_GOTO

2018-04-10 Thread Yonghong Song
ear. If later clang compiler starts to support asm_volatile_goto, the change in this patch can be reverted and there should be no impact on BPF compilation. Fixes: d0266046ad54 ("x86: Remove FAST_FEATURE_TESTS") Signed-off-by: Yonghong Song --- arch/x86/include/asm/cpufeature.h | 4 1 file

bpf: handling non BPF register names in inline assembly with -target bpf

2018-04-11 Thread Yonghong Song
Hi, Arnaldo, When I studied the bpf compilation issue with latest linus/net-next kernel (https://patchwork.kernel.org/patch/10333829/), an alternative approach I tried is to use __BPF__ macro. The following patch introduced "#ifndef __BPF__" in arch/x86/include/asm/asm.h for some inline

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-04-23 Thread Yonghong Song
Hi, Peter, Please see comments below. On 4/23/18 3:52 AM, Peter Zijlstra wrote: On Fri, Apr 20, 2018 at 11:06:03AM -0700, Yonghong Song wrote: On 4/20/18 1:19 AM, Peter Zijlstra wrote: Hurm, so adding __BPF__ for BPF compiles isn't an option? It seems to me having a CPP flag to identify

Re: [PATCH v2] x86/cpufeature: guard asm_volatile_goto usage with NO_BPF_WORKAROUND

2018-04-19 Thread Yonghong Song
Hi, Peter, Just pinging. Did you get chances to look at this? [ cc netdev as well so folks are aware of the issue. ] Thanks! Yonghong On 4/14/18 9:27 PM, Yonghong Song wrote: Commit d0266046ad54 ("x86: Remove FAST_FEATURE_TESTS") removed X86_FAST_FEATURE_TESTS and make macro stat

Re: [kmemleak] unreferenced object 0xcd9c1a80 (size 192):

2018-02-12 Thread Yonghong Song
On 2/12/18 7:55 AM, Alexei Starovoitov wrote: On Mon, Feb 12, 2018 at 09:28:33AM +0100, Daniel Borkmann wrote: On 02/12/2018 06:47 AM, Yonghong Song wrote: On 2/11/18 11:18 AM, Mathieu Malaterre wrote: On Sun, Feb 11, 2018 at 5:54 PM, Alexei Starovoitov wrote: On Sun, Feb 11, 2018 at 7:24

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

2017-11-30 Thread Yonghong Song
1.754.0 You can see that this patch significantly reduced the overhead, 50% for uprobe and 44% for uretprobe on x86_64, and even more on x86_32. Signed-off-by: Yonghong Song Reviewed-by: Oleg Nesterov --- arch/x86/include/asm/uprobes.h | 4 ++ arch/x86/kernel/uprobes.c | 10

Re: perf test LLVM & clang 6 failing

2017-11-25 Thread Yonghong Song
On 11/24/17 11:09 AM, Arnaldo Carvalho de Melo wrote: Em Fri, Nov 24, 2017 at 04:16:52PM +0100, Daniel Borkmann escreveu: [ +Yonghong ] On 11/24/2017 03:47 PM, Arnaldo Carvalho de Melo wrote: FYI, just noticed, recently updated clang to version 6, from its upstream git repo. Do you recall

Re: [PATCH v3 bpf-next 2/2] selftests: bpf: Add a new test for bare tracepoints

2021-01-19 Thread Yonghong Song
On 1/19/21 4:22 AM, Qais Yousef wrote: Reuse module_attach infrastructure to add a new bare tracepoint to check we can attach to it as a raw tracepoint. Signed-off-by: Qais Yousef Acked-by: Yonghong Song

Re: [PATCH bpf-next v3] samples/bpf: Update build procedure for manually compiling LLVM and Clang

2021-01-21 Thread Yonghong Song
-project/llvm/build/install is not used, BUILD_SHARED_LIBS=OFF is the default option [2], so also change Documentation/bpf/bpf_devel_QA.rst together. [1] https://clang.llvm.org/get_started.html [2] https://www.llvm.org/docs/CMake.html Signed-off-by: Tiezhu Yang Acked-by: Yonghong Song Reviewed

Re: [PATCH bpf-next 1/4] bpf: enable task local storage for tracing programs

2021-01-15 Thread Yonghong Song
On 1/15/21 3:34 PM, Song Liu wrote: On Jan 12, 2021, at 8:53 AM, KP Singh wrote: On Tue, Jan 12, 2021 at 5:32 PM Yonghong Song wrote: On 1/11/21 3:45 PM, Song Liu wrote: On Jan 11, 2021, at 1:58 PM, Martin Lau wrote: On Mon, Jan 11, 2021 at 10:35:43PM +0100, KP Singh wrote

Re: [PATCH v5 0/3] Kbuild: DWARF v5 support

2021-01-15 Thread Yonghong Song
On 1/15/21 3:34 PM, Nick Desaulniers wrote: On Fri, Jan 15, 2021 at 3:24 PM Yonghong Song wrote: On 1/15/21 1:53 PM, Sedat Dilek wrote: En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and CONFIG_DEBUG_INFO_DWARF4. So might be good to add a "depends on !DEBUG_INF

Re: [PATCH v5 0/3] Kbuild: DWARF v5 support

2021-01-15 Thread Yonghong Song
On 1/15/21 1:53 PM, Sedat Dilek wrote: On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers wrote: DWARF v5 is the latest standard of the DWARF debug info format. DWARF5 wins significantly in terms of size when mixed with compression (CONFIG_DEBUG_INFO_COMPRESSED). Link:

Re: [PATCH bpf-next 1/4] bpf: enable task local storage for tracing programs

2021-01-15 Thread Yonghong Song
On 1/15/21 5:12 PM, Song Liu wrote: On Jan 15, 2021, at 4:55 PM, Yonghong Song wrote: On 1/15/21 3:34 PM, Song Liu wrote: On Jan 12, 2021, at 8:53 AM, KP Singh wrote: On Tue, Jan 12, 2021 at 5:32 PM Yonghong Song wrote: On 1/11/21 3:45 PM, Song Liu wrote: On Jan 11, 2021

Re: [PATCH v2 bpf-next 2/2] selftests: bpf: Add a new test for bare tracepoints

2021-01-16 Thread Yonghong Song
On 1/16/21 10:21 AM, Qais Yousef wrote: Reuse module_attach infrastructure to add a new bare tracepoint to check we can attach to it as a raw tracepoint. Signed-off-by: Qais Yousef --- .../bpf/bpf_testmod/bpf_testmod-events.h | 6 + .../selftests/bpf/bpf_testmod/bpf_testmod.c

Re: [PATCH v2 bpf-next 1/2] trace: bpf: Allow bpf to attach to bare tracepoints

2021-01-16 Thread Yonghong Song
about any ABI. Update Documentation/bpf/bpf_design_QA.rst to document this contract. Signed-off-by: Qais Yousef Acked-by: Yonghong Song

Re: [PATCH bpf-next v2 2/2] docs: bpf: Clarify -mcpu=v3 requirement for atomic ops

2021-01-18 Thread Yonghong Song
/#m07264fc18fdc43af02fc1320968afefcc73d96f4 Signed-off-by: Brendan Jackman Thanks for better description! Acked-by: Yonghong Song

Re: [PATCH v2 bpf-next 2/2] selftests: bpf: Add a new test for bare tracepoints

2021-01-18 Thread Yonghong Song
On 1/18/21 4:18 AM, Qais Yousef wrote: On 01/16/21 18:11, Yonghong Song wrote: On 1/16/21 10:21 AM, Qais Yousef wrote: Reuse module_attach infrastructure to add a new bare tracepoint to check we can attach to it as a raw tracepoint. Signed-off-by: Qais Yousef --- .../bpf/bpf_testmod

Re: [PATCH bpf] samples/bpf: Update README.rst for manually compiling LLVM and clang

2021-01-18 Thread Yonghong Song
On 1/18/21 12:53 AM, Tiezhu Yang wrote: In the current samples/bpf/README.rst, the url of llvm and clang git may be out of date, they are unable to access: $ git clone http://llvm.org/git/llvm.git Cloning into 'llvm'... fatal: unable to access 'http://llvm.org/git/llvm.git/ ': Maximum (20)

  1   2   3   4   >