{"push_id":930984199,"size":529,"distinct_size":0,"ref":"refs/heads/master","head":"af345201ea948d0976d775958d8aa22fe5e5ba58","before":"ee9a7d2cb0cf1a1498478bc923d911f3d9c910ac","commits":[{"sha":"916d4092a1d2d7bb50630497be71ee4c4c2807fa","author":{"email":"293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com","name":"Arnaldo Carvalho de Melo"},"message":"perf test: Fix build of BPF and LLVM on older glibc libraries\n\n  $ rpm -q glibc\n  glibc-2.12-1.166.el6_7.1.x86_64\n\n<SNIP>\n    CC       /tmp/build/perf/tests/llvm.o\n  cc1: warnings being treated as errors\n  tests/llvm.c: In function ‘test_llvm__fetch_bpf_obj’:\n  tests/llvm.c:53: error: declaration of ‘index’ shadows a global declaration\n  /usr/include/string.h:489: error: shadowed declaration is here\n<SNIP>\n    CC       /tmp/build/perf/tests/bpf.o\n  cc1: warnings being treated as errors\n  tests/bpf.c: In function ‘__test__bpf’:\n  tests/bpf.c:149: error: declaration of ‘index’ shadows a global declaration\n  /usr/include/string.h:489: error: shadowed declaration is here\n<SNIP>\n\nCc: He Kuang <hekuang@huawei.com>\nCc: Jiri Olsa <jolsa@kernel.org>\nCc: Namhyung Kim <namhyung@kernel.org>\nCc: pi3orama@163.com\nCc: Wang Nan <wangnan0@huawei.com>\nCc: Zefan Li <lizefan@huawei.com>\nFixes: b31de018a628 (\"perf test: Enhance the LLVM test: update basic BPF test program\")\nFixes: ba1fae431e74 (\"perf test: Add 'perf test BPF'\")\nLink: http://lkml.kernel.org/n/tip-akpo4r750oya2phxoh9e3447@git.kernel.org\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/916d4092a1d2d7bb50630497be71ee4c4c2807fa"},{"sha":"9a13c6587e2f0d5e80ce02f5f9ef62788b48d163","author":{"email":"f9849b02abe18c1ece6bd40346458ed53f49d31b@linaro.org","name":"Kevin Hilman"},"message":"tools: Fix selftests_install Makefile rule\n\nFix copy/paste error in selftests_install rule which was copy-pasted\nfrom the clean rule but not properly changed.\n\nSigned-off-by: Kevin Hilman <khilman@linaro.org>\nCc: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>\nCc: Jiri Olsa <jolsa@kernel.org>\nCc: Jonathan Cameron <jic23@kernel.org>\nCc: Michael Ellerman <mpe@ellerman.id.au>\nCc: Pali Rohar <pali.rohar@gmail.com>\nCc: Pavel Machek <pavel@ucw.cz>\nCc: Roberta Dobrescu <roberta.dobrescu@gmail.com>\nCc: Shuah Khan <shuahkh@osg.samsung.com>\nCc: linaro-kernel@lists.linaro.org\nLink: http://lkml.kernel.org/r/1447797261-1775-1-git-send-email-khilman@kernel.org\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/9a13c6587e2f0d5e80ce02f5f9ef62788b48d163"},{"sha":"4ddd32741da87657113d964588ce13ee64b34820","author":{"email":"293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com","name":"Arnaldo Carvalho de Melo"},"message":"tools: Adopt memdup() from tools/perf, moving it to tools/lib/string.c\n\nThat will contain more string functions with counterparts, sometimes\nverbatim copies, in the kernel.\n\nAcked-by: Wang Nan <wangnan0@huawei.com>\nCc: Adrian Hunter <adrian.hunter@intel.com>\nCc: Alexey Dobriyan <adobriyan@gmail.com>\nCc: David Ahern <dsahern@gmail.com>\nCc: Jiri Olsa <jolsa@redhat.com>\nCc: Namhyung Kim <namhyung@kernel.org>\nLink: http://lkml.kernel.org/n/tip-rah6g97kn21vfgmlramorz6o@git.kernel.org\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/4ddd32741da87657113d964588ce13ee64b34820"},{"sha":"7d85c434214ea0b3416f7a62f76a0785b00d8797","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"tools: Clone the kernel's strtobool function\n\nCopying it to tools/lib/string.c, the counterpart to the kernel's\nlib/string.c.\n\nThis is preparation for enhancing BPF program configuration, which will\nallow config string like 'inlines=yes'.\n\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Jonathan Cameron <jic23@cam.ac.uk>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447675815-166222-6-git-send-email-wangnan0@huawei.com\n[ Copied it to tools/lib/string.c instead, to make it usable by other tools/ ]\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/7d85c434214ea0b3416f7a62f76a0785b00d8797"},{"sha":"b580563e38487d9db8e94080149644da71c533c1","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"bpf tools: Load a program with different instances using preprocessor\n\nThis patch is a preparation for BPF prologue support which allows\ngenerating a series of BPF bytecode for fetching kernel data before\ncalling program code. With the newly introduced multiple instances\nsupport, perf is able to create different prologues for different kprobe\npoints.\n\nBefore this patch, a bpf_program can be loaded into kernel only once,\nand get the only resulting fd. What this patch does is to allow creating\nand loading different variants of one bpf_program, then fetching their\nfds.\n\nHere we describe the basic idea in this patch. The detailed description\nof the newly introduced APIs can be found in comments in the patch body.\n\nThe key of this patch is the new mechanism in bpf_program__load().\nInstead of loading BPF program into kernel directly, it calls a\n'pre-processor' to generate program instances which would be finally\nloaded into the kernel based on the original code. To enable the\ngeneration of multiple instances, libbpf passes an index to the\npre-processor so it know which instance is being loaded.\n\nPre-processor should be called from libbpf's user (perf) using\nbpf_program__set_prep(). The number of instances and the relationship\nbetween indices and the target instance should be clear when calling\nbpf_program__set_prep().\n\nTo retrieve a fd for a specific instance of a program,\nbpf_program__nth_fd() is introduced. It returns the resulting fd\naccording to index.\n\nSigned-off-by: He Kuang <hekuang@huawei.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: He Kuang <hekuang@huawei.com>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447675815-166222-8-git-send-email-wangnan0@huawei.com\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\n[ Enclosed multi-line if/else blocks with {}, (*func_ptr)() -> func_ptr() ]\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/b580563e38487d9db8e94080149644da71c533c1"},{"sha":"1c0ed63239012aa881cc811f726b549dca7279e4","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf bpf: Add BPF_PROLOGUE config options for further patches\n\nIf both LIBBPF and DWARF are detected, it is possible to create prologue\nfor eBPF programs to help them access kernel data. HAVE_BPF_PROLOGUE and\nCONFIG_BPF_PROLOGUE are added as flags for this feature.\n\nPERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET is introduced in commit\n63ab024a5b6f295ca17a293ad81b7c728f49a89a (\"perf tools:\nregs_query_register_offset() infrastructure\"), which indicates that an\narchitecture supports converting name of a register to its offset in\n'struct pt_regs'. Without this support, BPF_PROLOGUE should be turned\noff.\n\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447675815-166222-9-git-send-email-wangnan0@huawei.com\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/1c0ed63239012aa881cc811f726b549dca7279e4"},{"sha":"30433a3a52b951faab95944e0f8b9d33a1e322ce","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf bpf: Compile dwarf-regs.c if CONFIG_BPF_PROLOGUE is on\n\nregs_query_register_offset() in dwarf-regs.c is required by BPF\nprologue.  This patch compiles it if CONFIG_BPF_PROLOGUE is on to avoid\nbuild failure when CONFIG_BPF_PROLOGUE is on but CONFIG_DWARF is not\nset.\n\nSigned-off-by: He Kuang <hekuang@huawei.com>\nAcked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: He Kuang <hekuang@huawei.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447675815-166222-10-git-send-email-wangnan0@huawei.com\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/30433a3a52b951faab95944e0f8b9d33a1e322ce"},{"sha":"361f2b1d1d7231b8685d990b886f599378a4d5a5","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf bpf: Allow BPF program attach to uprobe events\n\nThis patch adds a new syntax to the BPF object section name to support\nprobing at uprobe event. Now we can use BPF program like this:\n\n  SEC(\n  \"exec=/lib64/libc.so.6;\"\n  \"libcwrite=__write\"\n  )\n  int libcwrite(void *ctx)\n  {\n      return 1;\n  }\n\nWhere, in section name of a program, before the main config string, we\ncan use 'key=value' style options. Now the only option key is \"exec\",\nfor uprobes.\n\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447675815-166222-4-git-send-email-wangnan0@huawei.com\n[ Changed the separator from \\n to ; ]\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/361f2b1d1d7231b8685d990b886f599378a4d5a5"},{"sha":"5dbd16c0c9d17ab1ab2226a5926482c26c0287ed","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf bpf: Allow attaching BPF programs to modules symbols\n\nBy extending the syntax of BPF object section names, this patch allows\nusers to attach BPF programs to symbols in modules. For example:\n\n  SEC(\"module=i915;\"\n      \"parse_cmds=i915_parse_cmds\")\n  int parse_cmds(void *ctx)\n  {\n      return 1;\n  }\n\nThe implementation is very simple: like what 'perf probe' does, for module,\nfill 'uprobe' field in 'struct perf_probe_event'. Other parts will be done\nautomatically.\n\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Brendan Gregg <brendan.d.gregg@gmail.com>\nCc: Daniel Borkmann <daniel@iogearbox.net>\nCc: David Ahern <dsahern@gmail.com>\nCc: He Kuang <hekuang@huawei.com>\nCc: Jiri Olsa <jolsa@kernel.org>\nCc: Kaixu Xia <xiakaixu@huawei.com>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Namhyung Kim <namhyung@kernel.org>\nCc: Peter Zijlstra <a.p.zijlstra@chello.nl>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447675815-166222-5-git-send-email-wangnan0@huawei.com\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/5dbd16c0c9d17ab1ab2226a5926482c26c0287ed"},{"sha":"03e01f568759ddbfdaff892e299758e7771a3478","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf bpf: Allow BPF program config probing options\n\nBy extending the syntax of BPF object section names, this patch allows users to\nconfig probing options like what they can do in 'perf probe'.\n\nThe error message in 'perf probe' is also updated.\n\nTest result:\n\nFor following BPF file test_probe_glob.c:\n\n  # cat test_probe_glob.c\n  __attribute__((section(\"inlines=no;func=SyS_dup?\"), used))\n\n  int func(void *ctx)\n  {\n\t  return 1;\n  }\n\n  char _license[] __attribute__((section(\"license\"), used)) = \"GPL\";\n  int _version __attribute__((section(\"version\"), used)) = 0x40300;\n  #\n  # ./perf record  -e ./test_probe_glob.c ls /\n  ...\n  [ perf record: Woken up 1 times to write data ]\n  [ perf record: Captured and wrote 0.013 MB perf.data ]\n  # ./perf evlist\n  perf_bpf_probe:func_1\n  perf_bpf_probe:func\n\nAfter changing \"inlines=no\" to \"inlines=yes\":\n\n  # ./perf record  -e ./test_probe_glob.c ls /\n  ...\n  [ perf record: Woken up 2 times to write data ]\n  [ perf record: Captured and wrote 0.013 MB perf.data ]\n  # ./perf evlist\n  perf_bpf_probe:func_3\n  perf_bpf_probe:func_2\n  perf_bpf_probe:func_1\n  perf_bpf_probe:func\n\nThen test 'force':\n\nUse following program:\n\n  # cat test_probe_force.c\n  __attribute__((section(\"func=sys_write\"), used))\n\n  int funca(void *ctx)\n  {\n\t  return 1;\n  }\n\n  __attribute__((section(\"force=yes;func=sys_write\"), used))\n\n  int funcb(void *ctx)\n  {\n  \treturn 1;\n  }\n\n  char _license[] __attribute__((section(\"license\"), used)) = \"GPL\";\n  int _version __attribute__((section(\"version\"), used)) = 0x40300;\n  #\n\n  # perf record -e ./test_probe_force.c usleep 1\n  Error: event \"func\" already exists.\n   Hint: Remove existing event by 'perf probe -d'\n       or force duplicates by 'perf probe -f'\n       or set 'force=yes' in BPF source.\n  event syntax error: './test_probe_force.c'\n                       \\___ Probe point exist. Try 'perf probe -d \"*\"' and set 'force=yes'\n\n  (add -v to see detail)\n  ...\n\nThen replace 'force=no' to 'force=yes':\n\n  # vim test_probe_force.c\n  # perf record -e ./test_probe_force.c usleep 1\n  [ perf record: Woken up 1 times to write data ]\n  [ perf record: Captured and wrote 0.017 MB perf.data ]\n  # perf evlist\n  perf_bpf_probe:func_1\n  perf_bpf_probe:func\n  #\n\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nTested-by: Arnaldo Carvalho de Melo <acme@redhat.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447675815-166222-7-git-send-email-wangnan0@huawei.com\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/03e01f568759ddbfdaff892e299758e7771a3478"},{"sha":"bfc077b4cf106793b30bf942e426ee99f1f4ac44","author":{"email":"01189f839f5c53a9f0c5f5c6cb807be9767d9e1e@huawei.com","name":"He Kuang"},"message":"perf bpf: Add prologue for BPF programs for fetching arguments\n\nThis patch generates a prologue for a BPF program which fetches arguments for\nit.  With this patch, the program can have arguments as follow:\n\n  SEC(\"lock_page=__lock_page page->flags\")\n  int lock_page(struct pt_regs *ctx, int err, unsigned long flags)\n  {\n \t return 1;\n  }\n\nThis patch passes at most 3 arguments from r3, r4 and r5. r1 is still the ctx\npointer. r2 is used to indicate if dereferencing was done successfully.\n\nThis patch uses r6 to hold ctx (struct pt_regs) and r7 to hold stack pointer\nfor result. Result of each arguments first store on stack:\n\n low address\n BPF_REG_FP - 24  ARG3\n BPF_REG_FP - 16  ARG2\n BPF_REG_FP - 8   ARG1\n BPF_REG_FP\n high address\n\nThen loaded into r3, r4 and r5.\n\nThe output prologue for offn(...off2(off1(reg)))) should be:\n\n     r6 <- r1\t\t\t// save ctx into a callee saved register\n     r7 <- fp\n     r7 <- r7 - stack_offset\t// pointer to result slot\n     /* load r3 with the offset in pt_regs of 'reg' */\n     (r7) <- r3\t\t\t// make slot valid\n     r3 <- r3 + off1\t\t// prepare to read unsafe pointer\n     r2 <- 8\n     r1 <- r7\t\t\t// result put onto stack\n     call probe_read\t\t// read unsafe pointer\n     jnei r0, 0, err\t\t// error checking\n     r3 <- (r7)\t\t\t// read result\n     r3 <- r3 + off2\t\t// prepare to read unsafe pointer\n     r2 <- 8\n     r1 <- r7\n     call probe_read\n     jnei r0, 0, err\n     ...\n     /* load r2, r3, r4 from stack */\n     goto success\nerr:\n     r2 <- 1\n     /* load r3, r4, r5 with 0 */\n     goto usercode\nsuccess:\n     r2 <- 0\nusercode:\n     r1 <- r6\t// restore ctx\n     // original user code\n\nIf all of arguments reside in register (dereferencing is not\nrequired), gen_prologue_fastpath() will be used to create\nfast prologue:\n\n     r3 <- (r1 + offset of reg1)\n     r4 <- (r1 + offset of reg2)\n     r5 <- (r1 + offset of reg3)\n     r2 <- 0\n\nP.S.\n\neBPF calling convention is defined as:\n\n* r0\t\t- return value from in-kernel function, and exit value\n                  for eBPF program\n* r1 - r5\t- arguments from eBPF program to in-kernel function\n* r6 - r9\t- callee saved registers that in-kernel function will\n                  preserve\n* r10\t\t- read-only frame pointer to access stack\n\nCommitter note:\n\nAt least testing if it builds and loads:\n\n  # cat test_probe_arg.c\n  struct pt_regs;\n\n  __attribute__((section(\"lock_page=__lock_page page->flags\"), used))\n  int func(struct pt_regs *ctx, int err, unsigned long flags)\n  {\n  \treturn 1;\n  }\n\n  char _license[] __attribute__((section(\"license\"), used)) = \"GPL\";\n  int _version __attribute__((section(\"version\"), used)) = 0x40300;\n  # perf record -e ./test_probe_arg.c usleep 1\n  [ perf record: Woken up 1 times to write data ]\n  [ perf record: Captured and wrote 0.016 MB perf.data ]\n  # perf evlist\n  perf_bpf_probe:lock_page\n  #\n\nSigned-off-by: He Kuang <hekuang@huawei.com>\nTested-by: Arnaldo Carvalho de Melo <acme@redhat.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Wang Nan <wangnan0@huawei.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447675815-166222-11-git-send-email-wangnan0@huawei.com\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/bfc077b4cf106793b30bf942e426ee99f1f4ac44"},{"sha":"a08357d8dc7d3025d1094f727ad1f7e837766f93","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf bpf: Generate prologue for BPF programs\n\nThis patch generates a prologue for each 'struct probe_trace_event' for\nfetching arguments for BPF programs.\n\nAfter bpf__probe(), iterate over each program to check whether prologues are\nrequired. If none of the 'struct perf_probe_event' programs will attach to have\nat least one argument, simply skip preprocessor hooking. For those who a\nprologue is required, call bpf__gen_prologue() and paste the original\ninstruction after the prologue.\n\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447675815-166222-12-git-send-email-wangnan0@huawei.com\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/a08357d8dc7d3025d1094f727ad1f7e837766f93"},{"sha":"bbb7d4925a05ecd5bbfdbc1147d402b0db203a5a","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf test: Test the BPF prologue adding infrastructure\n\nThis patch introduces a new BPF script to test the BPF prologue adding\nroutines. The new script probes at null_lseek, which is the function pointer\nused when we try to lseek on '/dev/null'.\n\nThe null_lseek function is chosen because it is used by function pointers, so\nwe don't need to consider inlining and LTO.\n\nBy extracting file->f_mode, bpf-script-test-prologue.c should know whether the\nfile is writable or readonly. According to llseek_loop() and\nbpf-script-test-prologue.c, one fourth of total lseeks should be collected.\n\nCommitter note:\n\nTesting it:\n\n  # perf test -v BPF\n  <SNIP>\n  Kernel build dir is set to /lib/modules/4.3.0+/build\n  set env: KBUILD_DIR=/lib/modules/4.3.0+/build\n  unset env: KBUILD_OPTS\n  include option is set to  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.9.2/include -I/home/git/linux/arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated  -I/home/git/linux/include -Iinclude -I/home/git/linux/arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I/home/git/linux/include/uapi -Iinclude/generated/uapi -include /home/git/linux/include/linux/kconfig.h\n  set env: NR_CPUS=4\n  set env: LINUX_VERSION_CODE=0x40300\n  set env: CLANG_EXEC=/usr/libexec/icecc/bin/clang\n  set env: CLANG_OPTIONS=-xc\n  set env: KERNEL_INC_OPTIONS= -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.9.2/include -I/home/git/linux/arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated  -I/home/git/linux/include -Iinclude -I/home/git/linux/arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I/home/git/linux/include/uapi -Iinclude/generated/uapi -include /home/git/linux/include/linux/kconfig.h\n  set env: WORKING_DIR=/lib/modules/4.3.0+/build\n  set env: CLANG_SOURCE=-\n  llvm compiling command template: echo '/*\n   * bpf-script-test-prologue.c\n   * Test BPF prologue\n   */\n  #ifndef LINUX_VERSION_CODE\n  # error Need LINUX_VERSION_CODE\n  # error Example: for 4.2 kernel, put 'clang-opt=\"-DLINUX_VERSION_CODE=0x40200\" into llvm section of ~/.perfconfig'\n  #endif\n  #define SEC(NAME) __attribute__((section(NAME), used))\n\n  #include <uapi/linux/fs.h>\n\n  #define FMODE_READ\t\t0x1\n  #define FMODE_WRITE\t\t0x2\n\n  static void (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) =\n\t  (void *) 6;\n\n  SEC(\"func=null_lseek file->f_mode offset orig\")\n  int bpf_func__null_lseek(void *ctx, int err, unsigned long f_mode,\n\t\t\t   unsigned long offset, unsigned long orig)\n  {\n\t  if (err)\n\t\t  return 0;\n\t  if (f_mode & FMODE_WRITE)\n\t\t  return 0;\n\t  if (offset & 1)\n\t\t  return 0;\n\t  if (orig == SEEK_CUR)\n\t\t  return 0;\n\t  return 1;\n  }\n\n  char _license[] SEC(\"license\") = \"GPL\";\n  int _version SEC(\"version\") = LINUX_VERSION_CODE;\n  ' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c \"$CLANG_SOURCE\" -target bpf -O2 -o -\n  libbpf: loading object '[bpf_prologue_test]' from buffer\n  libbpf: section .strtab, size 135, link 0, flags 0, type=3\n  libbpf: section .text, size 0, link 0, flags 6, type=1\n  libbpf: section .data, size 0, link 0, flags 3, type=1\n  libbpf: section .bss, size 0, link 0, flags 3, type=8\n  libbpf: section func=null_lseek file->f_mode offset orig, size 112, link 0, flags 6, type=1\n  libbpf: found program func=null_lseek file->f_mode offset orig\n  libbpf: section license, size 4, link 0, flags 3, type=1\n  libbpf: license of [bpf_prologue_test] is GPL\n  libbpf: section version, size 4, link 0, flags 3, type=1\n  libbpf: kernel version of [bpf_prologue_test] is 40300\n  libbpf: section .symtab, size 168, link 1, flags 0, type=2\n  bpf: config program 'func=null_lseek file->f_mode offset orig'\n  symbol:null_lseek file:(null) line:0 offset:0 return:0 lazy:(null)\n  parsing arg: file->f_mode into file, f_mode(1)\n  parsing arg: offset into offset\n  parsing arg: orig into orig\n  bpf: config 'func=null_lseek file->f_mode offset orig' is ok\n  Looking at the vmlinux_path (7 entries long)\n  Using /lib/modules/4.3.0+/build/vmlinux for symbols\n  Open Debuginfo file: /lib/modules/4.3.0+/build/vmlinux\n  Try to find probe point from debuginfo.\n  Matched function: null_lseek\n  Probe point found: null_lseek+0\n  Searching 'file' variable in context.\n  Converting variable file into trace event.\n  converting f_mode in file\n  f_mode type is unsigned int.\n  Searching 'offset' variable in context.\n  Converting variable offset into trace event.\n  offset type is long long int.\n  Searching 'orig' variable in context.\n  Converting variable orig into trace event.\n  orig type is int.\n  Found 1 probe_trace_events.\n  Opening /sys/kernel/debug/tracing//kprobe_events write=1\n  Writing event: p:perf_bpf_probe/func _text+4840528 f_mode=+68(%di):u32 offset=%si:s64 orig=%dx:s32\n  libbpf: don't need create maps for [bpf_prologue_test]\n  prologue: pass validation\n  prologue: slow path\n  prologue: fetch arg 0, base reg is %di\n  prologue: arg 0: offset 68\n  prologue: fetch arg 1, base reg is %si\n  prologue: fetch arg 2, base reg is %dx\n  add bpf event perf_bpf_probe:func and attach bpf program 3\n  adding perf_bpf_probe:func\n  adding perf_bpf_probe:func to 0x51672c0\n  mmap size 1052672B\n  Opening /sys/kernel/debug/tracing//kprobe_events write=1\n  Opening /sys/kernel/debug/tracing//uprobe_events write=1\n  Parsing probe_events: p:perf_bpf_probe/func _text+4840528 f_mode=+68(%di):u32 offset=%si:s64 orig=%dx:s32\n  Group:perf_bpf_probe Event:func probe:p\n  Writing event: -:perf_bpf_probe/func\n  test child finished with 0\n  ---- end ----\n  Test BPF filter: Ok\n  #\n\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nTested-by: Arnaldo Carvalho de Melo <acme@redhat.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447675815-166222-13-git-send-email-wangnan0@huawei.com\n[ Added tools/perf/tests/llvm-src-prologue.c to .gitignore ]\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/bbb7d4925a05ecd5bbfdbc1147d402b0db203a5a"},{"sha":"ad0dd7aed5df8009b3ffa39bec73ad93283332c9","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf test: Fix 'perf test BPF' when it fails to find a suitable vmlinux\n\nTwo bugs in 'perf test BPF' are found when testing BPF prologue without\nvmlinux:\n\n # mv /lib/modules/4.3.0-rc4+/build/vmlinux{,.bak}\n # ./perf test BPF\n 37: Test BPF filter             :Failed to find the path for kernel: No such file or directory\n Ok\n\nTest BPF should fail in this case.\n\nAfter this patch:\n\n # ./perf test BPF\n 37: Test BPF filter             :Failed to find the path for kernel: No such file or directory\n  FAILED!\n # mv /lib/modules/4.3.0-rc4+/build/vmlinux{.bak,}\n # ./perf test BPF\n 37: Test BPF filter             : Ok\n\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447749170-175898-2-git-send-email-wangnan0@huawei.com\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/ad0dd7aed5df8009b3ffa39bec73ad93283332c9"},{"sha":"d35b32891a61f1d3909bdc5280badf309adc4693","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf bpf: Use same BPF program if arguments are identical\n\nThis patch allows creating only one BPF program for different\n'probe_trace_event'(tev) entries generated by one\n'perf_probe_event'(pev) if their prologues are identical.\n\nThis is done by comparing the argument list of different tev instances,\nand the maps type of prologue and tev using a mapping array. This patch\nutilizes qsort to sort the tevs. After sorting, tevs with identical\nargument lists will be grouped together.\n\nTest result:\n\nSample BPF program:\n\n  #define SEC(NAME) __attribute__((section(NAME), used))\n  SEC(\"inlines=no;\"\n      \"func=SyS_dup? oldfd\")\n  int func(void *ctx)\n  {\n      return 1;\n  }\n\nIt would probe at SyS_dup2 and SyS_dup3, obtaining oldfd as its\nargument.\n\nThe following cmdline shows a BPF program being loaded into the kernel\nby perf:\n\n # perf record -e ./test_bpf_arg.c sleep 4 & sleep 1 && ls /proc/$!/fd/ -l | grep bpf-prog\n\nBefore this patch:\n\n  # perf record -e ./test_bpf_arg.c sleep 4 & sleep 1 && ls /proc/$!/fd/ -l | grep bpf-prog\n  [1] 24858\n  lrwx------ 1 root root 64 Nov 14 04:09 3 -> anon_inode:bpf-prog\n  lrwx------ 1 root root 64 Nov 14 04:09 4 -> anon_inode:bpf-prog\n  ...\n\nAfter this patch:\n\n  # perf record -e ./test_bpf_arg.c sleep 4 & sleep 1 && ls /proc/$!/fd/ -l | grep bpf-prog\n  [1] 25699\n  lrwx------ 1 root root 64 Nov 14 04:10 3 -> anon_inode:bpf-prog\n  ...\n\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447749170-175898-3-git-send-email-wangnan0@huawei.com\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/d35b32891a61f1d3909bdc5280badf309adc4693"},{"sha":"721a1f53df6aad3ea941f5fe95519d0d8e02bd65","author":{"email":"293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com","name":"Arnaldo Carvalho de Melo"},"message":"perf tests: Pass the subtest index to each test routine\n\nSome tests have sub-tests we want to run, so allow passing this.\n\nWang tried to avoid having to touch all tests, but then, having the\ntest.func in an anonymous union makes the build fail on older compilers,\nlike the one in RHEL6, where:\n\n  test a = {\n\t.func = foo,\n  };\n\nfails.\n\nTo fix it leave the func pointer in the main structure and pass the subtest\nindex to all tests, end result function is the same, but we have just one\nfunction pointer, not two, with and without the subtest index as an argument.\n\nCc: Adrian Hunter <adrian.hunter@intel.com>\nCc: David Ahern <dsahern@gmail.com>\nCc: Jiri Olsa <jolsa@redhat.com>\nCc: Namhyung Kim <namhyung@kernel.org>\nCc: Wang Nan <wangnan0@huawei.com>\nLink: http://lkml.kernel.org/n/tip-5genj0ficwdmelpoqlds0u4y@git.kernel.org\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/721a1f53df6aad3ea941f5fe95519d0d8e02bd65"},{"sha":"e8c6d500447c577e669c24ec04cd4173fe9f9afb","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf test: Print result for each LLVM subtest\n\nCurrently 'perf test llvm' and 'perf test BPF' have multiple sub-tests,\nbut the result is provided in only one line:\n\n  # perf test LLVM\n  35: Test LLVM searching and compiling                        : Ok\n\nThis patch introduces sub-tests support, allowing 'perf test' to report\nresult for each sub-tests:\n\n  # perf test LLVM\n  35: Test LLVM searching and compiling                        :\n  35.1: Basic BPF llvm compiling test                          : Ok\n  35.2: Test kbuild searching                                  : Ok\n  35.3: Compile source for BPF prologue generation test        : Ok\n\nWhen a failure happens:\n\n  # cat ~/.perfconfig\n  [llvm]\n       clang-path = \"/bin/false\"\n  # perf test LLVM\n  35: Test LLVM searching and compiling                        :\n  35.1: Basic BPF llvm compiling test                          : FAILED!\n  35.2: Test kbuild searching                                  : Skip\n  35.3: Compile source for BPF prologue generation test        : Skip\n\nAnd:\n\n  # rm ~/.perfconfig\n  # ./perf test LLVM\n  35: Test LLVM searching and compiling                        :\n  35.1: Basic BPF llvm compiling test                          : Skip\n  35.2: Test kbuild searching                                  : Skip\n  35.3: Compile source for BPF prologue generation test        : Skip\n\nSkip by user:\n\n  # ./perf test -s 1,`seq -s , 3 42`\n   1: vmlinux symtab matches kallsyms                          : Skip (user override)\n   2: detect openat syscall event                              : Ok\n  ...\n  35: Test LLVM searching and compiling                        : Skip (user override)\n  ...\n\nSuggested-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447749170-175898-4-git-send-email-wangnan0@huawei.com\n[ Changed so that func is not on an anonymous union ]\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/e8c6d500447c577e669c24ec04cd4173fe9f9afb"},{"sha":"77a0cf682f7979554e10a6c605a1fef4f4197654","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf test: Print result for each BPF subtest\n\nThis patch prints each sub-tests results for BPF testcases.\n\nBefore:\n\n  # ./perf test BPF\n  37: Test BPF filter                                          : Ok\n\nAfter:\n\n  # ./perf test BPF\n  37: Test BPF filter                                          :\n  37.1: Test basic BPF filtering                               : Ok\n  37.2: Test BPF prologue generation                           : Ok\n\nWhen a failure happens:\n\n  # cat ~/.perfconfig\n  [llvm]\n      clang-path = \"/bin/false\"\n  # ./perf test BPF\n  37: Test BPF filter                                          :\n  37.1: Test basic BPF filtering                               : Skip\n  37.2: Test BPF prologue generation                           : Skip\n\nSuggested-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447749170-175898-5-git-send-email-wangnan0@huawei.com\n[ Fixed up not to use .func in an anonymous union ]\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/77a0cf682f7979554e10a6c605a1fef4f4197654"},{"sha":"5bcf2fe05318deb6fec209b4028d8a31f9f47221","author":{"email":"7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com","name":"Wang Nan"},"message":"perf test: Mute test cases error messages if verbose == 0\n\nSometimes error messages in breaks the pretty output of 'perf test'.\nFor example:\n\n  # mv /lib/modules/4.3.0-rc4+/build/vmlinux{,.bak}\n  # perf test LLVM BPF\n  35: Test LLVM searching and compiling                        :\n  35.1: Basic BPF llvm compiling test                          : Ok\n  35.2: Test kbuild searching                                  : Ok\n  35.3: Compile source for BPF prologue generation test        : Ok\n  37: Test BPF filter                                          :\n  37.1: Test basic BPF filtering                               : Ok\n  37.2: Test BPF prologue generation                           :Failed to find the path for kernel: No such file or directory FAILED!\n\nThis patch mute test cases thoroughly by redirect their stdout and\nstderr to /dev/null when verbose == 0. After applying this patch:\n\n  # ./perf test LLVM BPF\n  35: Test LLVM searching and compiling                        :\n  35.1: Basic BPF llvm compiling test                          : Ok\n  35.2: Test kbuild searching                                  : Ok\n  35.3: Compile source for BPF prologue generation test        : Ok\n  37: Test BPF filter                                          :\n  37.1: Test basic BPF filtering                               : Ok\n  37.2: Test BPF prologue generation                           : FAILED!\n\n  # ./perf test -v LLVM BPF\n  35: Test LLVM searching and compiling                        :\n  35.1: Basic BPF llvm compiling test                          :\n  --- start ---\n  test child forked, pid 13183\n  Kernel build dir is set to /lib/modules/4.3.0-rc4+/build\n  set env: KBUILD_DIR=/lib/modules/4.3.0-rc4+/build\n  ...\n  bpf: config 'func=null_lseek file->f_mode offset orig' is ok\n  Looking at the vmlinux_path (7 entries long)\n  Failed to find the path for kernel: No such file or directory\n  bpf_probe: failed to convert perf probe eventsFailed to add events selected by BPF\n  test child finished with -1\n  ---- end ----\n  Test BPF filter subtest 1: FAILED!\n\nSigned-off-by: Wang Nan <wangnan0@huawei.com>\nTested-by: Arnaldo Carvalho de Melo <acme@redhat.com>\nCc: Alexei Starovoitov <ast@kernel.org>\nCc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Zefan Li <lizefan@huawei.com>\nCc: pi3orama@163.com\nLink: http://lkml.kernel.org/r/1447749170-175898-6-git-send-email-wangnan0@huawei.com\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/5bcf2fe05318deb6fec209b4028d8a31f9f47221"},{"sha":"05c8d802fa52ef17dbcce21c38b72b4a313eb036","author":{"email":"60fcdccfd958d359debfe6e6e7417cd7f1aaa9e3@hitachi.com","name":"Masami Hiramatsu"},"message":"perf probe: Fix to free temporal Dwarf_Frame\n\nSince dwarf_cfi_addrframe returns malloc'd Dwarf_Frame object, it has to\nbe freed after it is used.\n\nSigned-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>\nCc: Adrian Hunter <adrian.hunter@intel.com>\nCc: Jiri Olsa <jolsa@redhat.com>\nCc: Namhyung Kim <namhyung@kernel.org>\nCc: Peter Zijlstra <a.p.zijlstra@chello.nl>\nLink: http://lkml.kernel.org/r/20151118064011.30709.65674.stgit@localhost.localdomain\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>","distinct":false,"url":"https://api.github.com/repos/masahir0y/linux-yamada/commits/05c8d802fa52ef17dbcce21c38b72b4a313eb036"}]}