1. 11 Aug, 2017 2 commits
  2. 01 Aug, 2017 2 commits
  3. 31 Jul, 2017 2 commits
  4. 28 Jul, 2017 1 commit
  5. 27 Jul, 2017 2 commits
    • Brenden Blanco's avatar
      Merge pull request #1263 from iovisor/yhs_dev · 2cc96a8c
      Brenden Blanco authored
      permit multiple pids attaching to the same probe
      2cc96a8c
    • Yonghong Song's avatar
      permit multiple pids attaching to the same probe · 0ba15075
      Yonghong Song authored
      Currently, if more than one pid-associated USDT attaching to
      the same probe, usdt readarg code will be generated twice and
      the compiler will complain.
      
      This patch solves issue by preventing code duplication if
      a previous context with the same mnt point and exec binary
      has generated the code for the same probe. The event name is
      also changed to have pid embedded so different pid-associated
      uprobe event will have different names.
      
      This patch introduces an internal uprobe event name
      discrepency. It is a good idea to have event name
      generation in libbpf so that both C++ API and Python API
      will have consistent name conventions. This will be
      addressed in a subsequent commit as it is largely
      a different issue.
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      0ba15075
  6. 19 Jul, 2017 1 commit
  7. 18 Jul, 2017 4 commits
    • Yonghong Song's avatar
      generate proper usdt code to prevent llvm meddling with ctx->#fields · 8206f547
      Yonghong Song authored
      Qin reported a test case where llvm still messes up with ctx->#fields.
      For code like below:
        switch(ctx->ip) {
          case 0x7fdf2ede9820ULL: *((int64_t *)dest) = *(volatile int64_t *)&ctx->r12; return 0;
          case 0x7fdf2edecd9cULL: *((int64_t *)dest) = *(volatile int64_t *)&ctx->bx; return 0;
        }
      The compiler still generates:
          # r1 is the pointer to the ctx
          r1 += 24
          goto LBB0_4
        LBB0_3:
          r1 += 40
        LBB0_4:
          r3 = *(u64 *)(r1 + 0)
      The verifier will reject the above code since the last load is not "ctx + field_offset"
      format.
      
      The responsible llvm optimization pass is CFGSimplifyPass. Its main implementation
      in llvm/lib/Transforms/Utils/SimplifyCFG.cpp. The main routine to do the optimization
      is SinkThenElseCodeToEnd. The routine canSinkInstructions is used to determine whether
      an insn is a candidate for sinking.
      
      Unfortunately, volatile load/store is not a condition to prevent the optimization.
      But inline assembly is a condition which can prevent further optimization.
      
      In this patch, instead of using volatile to annotate ctx->#field access, we do
      normal ctx->#field access but put a compiler inline assembly memory barrier
         __asm__ __volatile__(\"\": : :\"memory\");
      after the field access.
      
      Tested with usdt unit test case, usdt_samples example, a couple of usdt unit tests
      developed in the past.
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      8206f547
    • Igor Mazur's avatar
      MySQL tracing without USDT (#1239) · 5f7035e4
      Igor Mazur authored
      Support tracing MySQL queries even when MySQL is built
      without USDT support, by using uprobes on internal functions
      responsible for command (query) dispatching.
      5f7035e4
    • 4ast's avatar
      Merge pull request #1259 from iovisor/yhs_dev · 87abe2a3
      4ast authored
      Fix a clang memory leak
      87abe2a3
    • Yonghong Song's avatar
      Fix a clang memory leak · 6ed2229d
      Yonghong Song authored
      In clang frontend actions, several compiler invocations are called
      for rewriter and transforming source code to IR. During the invocation
      to transform source code to IR, CodeGenOpts.DisableFree is used
      to control whether the top target machine structure should be
      freed or not for a particular clang invocation,
      and its default value is TRUE.
      
      See clang:lib/CodeGen/BackendUtil.cpp:
        ~EmitAssemblyHelper() {
          if (CodeGenOpts.DisableFree)
            BuryPointer(std::move(TM));
        }
      
      So by default, the memory held by TM will not freed, even if
      BPF module itself is freed. This is even more problematic
      when continuous building/loading/unloading happens for long
      live service.
      
      This patch explicitly sets CodeGenOpts.DisableFree to FALSE
      so memory can be properly freed. I did a simple experiment
      to compile/load/unload an empty BPF program and the saving
      is roughly 0.5MB.
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      6ed2229d
  8. 17 Jul, 2017 2 commits
  9. 14 Jul, 2017 2 commits
  10. 11 Jul, 2017 3 commits
    • Romain's avatar
      cc: Add open_perf_event to the C/C++ API (#1232) · 4180333c
      Romain authored
      4180333c
    • Rinat Ibragimov's avatar
      memleak: expand allocator coverage (#1214) · 2c1799c9
      Rinat Ibragimov authored
      * memleak: handle libc allocation functions other than malloc
      
      * memleak: use tracepoints to track kernel allocations
      
      * memleak: add combined-only mode
      
      With large number of outstanding allocations, amount of data passed from
      kernel becomes large, which slows everything down.
      
      This patch calculates allocation statistics inside kernel, allowing user-
      space part to pull combined statistics data only, thus significantly
      reducing amount of passed data.
      
      * memleak: increase hashtable capacities
      
      There are a lot of allocations happen in kernel. Default values are not
      enough to keep up.
      
      * test: add a test for the memleak tool
      2c1799c9
    • bveldhoen's avatar
      Add USDT sample (#1229) · b4691fba
      bveldhoen authored
      This sample contains:
          - A library with an operation that uses usdt probes.
          - A console application that calls the operation.
          - Scripts to trace the latency of the operation.
          - Corresponding cmake files.
      b4691fba
  11. 07 Jul, 2017 1 commit
  12. 06 Jul, 2017 1 commit
  13. 01 Jul, 2017 1 commit
  14. 30 Jun, 2017 4 commits
    • Vicent Marti's avatar
      usdt: Use ProcMountNS · 96c1b8e0
      Vicent Marti authored
      96c1b8e0
    • Vicent Marti's avatar
      proc: Enhance bcc_mapping_is_file_backed · 8600ffcb
      Vicent Marti authored
      Cleanup the `strncmp` code and add a few more ignored map names
      8600ffcb
    • Yonghong Song's avatar
      Fix bcc.lua build issue in Ubuntu 17.04 · 08c82535
      Yonghong Song authored
      In fc25 box, gcc6.3.1 is configured with pie default off.
      Here, pie stands for position independent execution.
      
      In ubuntu 17.04, gcc6.3.0, however, is configured with
      pie default on. The gcc driver automatically adds -pie
      to the linker options.
      
      Since bcc.lua build needs pie off, previously, -fno-pie
      is passed to the compiler. -fno-pie is a gcc option
      impacting the code generation and it didn't
      negate the -pie option in the linker. The correct way
      seems to use gcc linker option -no-pie which can
      successfully cancel the default -pie in the linker.
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      08c82535
    • Nan Xiao's avatar
      Update LINKS.md · e0d99edf
      Nan Xiao authored
      e0d99edf
  15. 29 Jun, 2017 2 commits
  16. 23 Jun, 2017 1 commit
  17. 22 Jun, 2017 1 commit
  18. 19 Jun, 2017 1 commit
    • Yonghong Song's avatar
      Change clang frontend optimization level from 0 to 2 · 42c00adb
      Yonghong Song authored
      The issue is caused by the following clang change on 5.0:
      https://reviews.llvm.org/D28404
      
      Basically, at -O0, unless always inlining is specified, a
      function will be marked as optnone and noinline.
      
      This causes two kinds of issues: (1). optnone will generate
      suboptimal code with heavy stack use and this high likely can
      cause verifier failure; and (2). even if user mark all his/her
      defined functions in bpf program as always inlining, some
      functions in linux header files are not marked as always inline
      and hence will be marked as noinline instead, ultimately
      causing llvm complaining about global function reference.
      
      This patch bumps the clang optimization level to -O2.
      This should work with older versions of llvm as well.
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      42c00adb
  19. 14 Jun, 2017 3 commits
  20. 12 Jun, 2017 1 commit
  21. 10 Jun, 2017 1 commit
    • Carlos Neira's avatar
      fix cc: error: unrecognized command line option -no-pie · 9da21f9e
      Carlos Neira authored
      
      
      cnb@ubuntu-14:~/iovisor/bcc/build$ make
      [  6%] Built target clang_frontend
      [  9%] Built target bpf-static
      [ 16%] Built target bcc-loader-static
      [ 30%] Built target b_frontend
      [ 47%] Built target bcc-static
      [ 48%] Built target CPUDistribution
      [ 50%] Built target FollyRequestContextSwitch
      [ 51%] Built target HelloWorld
      [ 52%] Built target LLCStat
      [ 54%] Built target RandomRead
      [ 55%] Built target RecordMySQLQuery
      [ 56%] Built target TCPSendStack
      [ 80%] Built target bcc-shared
      [ 83%] Built target bpf-shared
      [ 84%] Built target bcc_py
      Linking C executable bcc-lua
      cc: error: unrecognized command line option â-no-pieâ
      make[2]: *** [src/lua/bcc-lua] Error 1
      make[1]: *** [src/lua/CMakeFiles/bcc-lua.dir/all] Error
      
      option is called -fno-pie
      9da21f9e
  22. 08 Jun, 2017 1 commit
  23. 07 Jun, 2017 1 commit