Skip to content
Snippets Groups Projects
  1. Apr 29, 2021
    • Yonghong Song's avatar
      Revert "add macros offsetof and container_of" · 356ab6c0
      Yonghong Song authored
      
      This reverts commit cda7acdb.
      
      This will tigger ugly compilation macro redefined warnings:
        $ sudo ./biolatency.py
        In file included from /virtual/main.c:3:
        In file included from include/linux/blkdev.h:5:
        In file included from include/linux/sched.h:12:
        In file included from arch/x86/include/asm/current.h:6:
        In file included from arch/x86/include/asm/percpu.h:45:
        include/linux/kernel.h:992:9: warning: 'container_of' macro redefined [-Wmacro-redefined]
        #define container_of(ptr, type, member) ({                              \
                ^
        /virtual/include/bcc/helpers.h:48:9: note: previous definition is here
        #define container_of(ptr, type, member)                         \
                ^
        1 warning generated.
        Tracing block device I/O... Hit Ctrl-C to end.
      Revert now and let us design how to support it better. For example, may
      create a different header file to put common kernel macros there to be
      used by the program.
      
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      356ab6c0
    • Simone Magnani's avatar
      enhanced items_delete_batch() in Python to avoid double list creation · 071f1ec5
      Simone Magnani authored
      
      This commit enhances the items_delete_batch() function by accepting a ct.Array instead of a Python list.
      This way, the array does not need to be re-created, allowing to directly perform the requested operation.
      
      Signed-off-by: default avatarSimone Magnani <simonemagnani.96@gmail.com>
      071f1ec5
    • Simone Magnani's avatar
      added bpf_update_batch() API support for Python Maps · 19df7ee6
      Simone Magnani authored
      
      This commit aims at introducing items_update_batch, batch operation to update multiple key-value pairs at the same time.
      Doc has been updated accordingly, and a test is provided.
      
      Signed-off-by: default avatarSimone Magnani <simonemagnani.96@gmail.com>
      19df7ee6
    • Simone Magnani's avatar
      modified self.max_entries to be available from all the MAP types · 8034be61
      Simone Magnani authored
      
      This commit introduces the self.max_entries attribute both into Queue/Stack maps and to all those whwqo extend TableBase
      
      Signed-off-by: default avatarSimone Magnani <simonemagnani.96@gmail.com>
      8034be61
    • Simone Magnani's avatar
      introduced Queue/Stack itervalues · 226816d0
      Simone Magnani authored
      
      This commit introduces the possibility to iterate over all elements of a Queue/Stack.
      To avoid infinite loop, a maximum of MAX_ENTRIES pop() are performed
      
      Signed-off-by: default avatarSimone Magnani <simonemagnani.96@gmail.com>
      226816d0
    • edwardwu's avatar
      tools/biolatency: Extend average/total value · f41f3789
      edwardwu authored
      
      Sometimes log2 range is not enough for throughput tuning.
      Especially a little difference in performance downgrade.
      
      Also, this extension uses two bpf helper bpf_map_lookup_elem().
      It's a cost on embedded system, therefore it's better to be an option.
      
      Signed-off-by: default avatarEdward Wu <edwardwu@realtek.com>
      f41f3789
    • Jerome Marchand's avatar
      Fix BPF(src_file="foo") · 09dc278d
      Jerome Marchand authored
      Since commit 75f20a15 ("Use string type for comparison to PATH
      elements"), src_file isn't working anymore. Somehow, two wrongs
      (ArgString __str__() returning a bytes object and joining a bytes and
      what was supposed to be a string) did make a right.
      
      It fixes the following error in netqtop and deadlock:
      Traceback (most recent call last):
        File "/usr/share/bcc/tools/netqtop", line 207, in <module>
          b = BPF(src_file = EBPF_FILE)
        File "/usr/lib/python3.6/site-packages/bcc/__init__.py", line 335, in __init__
          src_file = BPF._find_file(src_file)
        File "/usr/lib/python3.6/site-packages/bcc/__init__.py", line 255, in _find_file
          t = b"/".join([os.path.abspath(os.path.dirname(argv0.__str__())), filename])
      TypeError: sequence item 0: expected a bytes-like object, str found
      09dc278d
  2. Apr 28, 2021
    • netedwardwu's avatar
      tools/funclatency: Should clear() after display that is what we want (#3380) · e0c8c10c
      netedwardwu authored
      
      BUG:
      funclatency memcpy -i 2
           nsecs               : count     distribution
               0 -> 1          : 0        |                                        |
               2 -> 3          : 0        |                                        |
               4 -> 7          : 0        |                                        |
               8 -> 15         : 0        |                                        |
              16 -> 31         : 0        |                                        |
              32 -> 63         : 0        |                                        |
              64 -> 127        : 0        |                                        |
             128 -> 255        : 0        |                                        |
             256 -> 511        : 0        |                                        |
             512 -> 1023       : 0        |                                        |
            1024 -> 2047       : 0        |                                        |
            2048 -> 4095       : 28       |************                            |
            4096 -> 8191       : 92       |****************************************|
      
      avg = 4265 nsecs, total: 9413985 nsecs, count: 2207
      
           nsecs               : count     distribution
               0 -> 1          : 0        |                                        |
               2 -> 3          : 0        |                                        |
               4 -> 7          : 0        |                                        |
               8 -> 15         : 0        |                                        |
              16 -> 31         : 0        |                                        |
              32 -> 63         : 0        |                                        |
              64 -> 127        : 0        |                                        |
             128 -> 255        : 0        |                                        |
             256 -> 511        : 0        |                                        |
             512 -> 1023       : 0        |                                        |
            1024 -> 2047       : 0        |                                        |
            2048 -> 4095       : 38       |******                                  |
            4096 -> 8191       : 248      |****************************************|
      
      avg = 4304 nsecs, total: 11066321 nsecs, count: 2571
      
      After long-run, you can see the count above is totally wrong.
      
      Also, display together before together clearing is important for better accuracy.
      
      Signed-off-by: default avatarEdward Wu <edwardwu@realtek.com>
      e0c8c10c
    • yzhao's avatar
      Add BPFStackTable::free_symcache() to free the symbol cache for an PID (#3371) · 23447d29
      yzhao authored
      This is useful when BPFStackTable is used by a long running program to
      limit the memory usage, by removing the cached symbols of an exited
      process.
      23447d29
  3. Apr 26, 2021
  4. Apr 25, 2021
  5. Apr 16, 2021
  6. Apr 10, 2021
  7. Apr 06, 2021
  8. Apr 05, 2021
  9. Apr 01, 2021
  10. Mar 22, 2021
  11. Mar 20, 2021
    • Jerome Marchand's avatar
      tools: handle renamed lookup_fast function in dcache tools · cdfddc4a
      Jerome Marchand authored
      The lookup_fast function can be rename lookup_fast.constprop.x by gcc
      constant propagation optimization and that breaks dcstat and
      dcsnoop. Let's look for both name using a regular expression.
      cdfddc4a
    • Tiezhu Yang's avatar
      bcc: Add some basic support for MIPS · 31d8bdf1
      Tiezhu Yang authored
      
      In order to fix the following errors when running bpf program
      on the MIPS Loongson64 platform, add some basic support, with
      this patch, running hello_world.py can get the expected result.
      
       root@linux:/home/loongson/bcc# python examples/hello_world.py
       In file included from <built-in>:3:
       In file included from /virtual/include/bcc/helpers.h:51:
       In file included from include/uapi/linux/if_packet.h:5:
       arch/mips/include/uapi/asm/byteorder.h:17:3: error: "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
       # error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
         ^
       In file included from <built-in>:3:
       In file included from /virtual/include/bcc/helpers.h:53:
       In file included from include/linux/log2.h:12:
       In file included from include/linux/bitops.h:32:
       In file included from arch/mips/include/asm/bitops.h:19:
       In file included from arch/mips/include/asm/barrier.h:11:
       arch/mips/include/asm/addrspace.h:13:10: fatal error: 'spaces.h' file not found
       #include <spaces.h>
               ^~~~~~~~~~
       2 errors generated.
       Traceback (most recent call last):
         File "examples/hello_world.py", line 12, in <module>
           BPF(text='int kprobe__sys_clone(void *ctx) { bpf_trace_printk("Hello, World!\\n"); return 0; }').trace_print()
         File "/usr/lib/python2.7/site-packages/bcc/__init__.py", line 364, in __init__
           raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
       Exception: Failed to compile BPF module <text>
      
       root@linux:/home/loongson/bcc# python examples/hello_world.py
       In file included from <built-in>:3:
       In file included from /virtual/include/bcc/helpers.h:53:
       In file included from include/linux/log2.h:12:
       In file included from include/linux/bitops.h:32:
       arch/mips/include/asm/bitops.h:101:3: error: invalid output constraint '+ZC' in asm
                       __bit_op(*m, __INS "%0, %3, %2, 1", "i"(bit), "r"(~0));
                       ^
       arch/mips/include/asm/bitops.h:40:19: note: expanded from macro '__bit_op'
               : "=&r"(__temp), "+" GCC_OFF_SMALL_ASM()(mem)           \
                                ^
       [...]
       arch/mips/include/asm/atomic.h:154:1: error: invalid output constraint '+ZC' in asm
       arch/mips/include/asm/atomic.h:151:2: note: expanded from macro 'ATOMIC_OPS'
               ATOMIC_FETCH_OP(pfx, op, type, c_op, asm_op, ll, sc)
               ^
       arch/mips/include/asm/atomic.h:141:4: note: expanded from macro 'ATOMIC_FETCH_OP'
                 "+" GCC_OFF_SMALL_ASM() (v->counter)                          \
                 ^
       fatal error: too many errors emitted, stopping now [-ferror-limit=]
       20 errors generated.
       Traceback (most recent call last):
         File "examples/hello_world.py", line 12, in <module>
           BPF(text='int kprobe__sys_clone(void *ctx) { bpf_trace_printk("Hello, World!\\n"); return 0; }').trace_print()
         File "/usr/lib/python2.7/site-packages/bcc/__init__.py", line 364, in __init__
           raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
       Exception: Failed to compile BPF module <text>
      
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      31d8bdf1
    • Yonghong Song's avatar
      update debian changelog for release v0.19.0 · 4c561d03
      Yonghong Song authored
      
        * Support for kernel up to 5.11
        * allow BCC as a cmake subproject
        * add LPORT support in tcpconnlat and tcpconnect
        * added bpf_map_lookup_and_delete_batch support
        * new tools: virtiostat
        * new libbpf-tools: cpufreq, funclatency, cachestat
        * add install target to libbpf-tools
        * a few lua fixes
        * doc update and bug fixes
      
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      4c561d03
    • Yonghong Song's avatar
      sync with latest libbpf · 887e05ab
      Yonghong Song authored
      
      sync with latest libbpf with top commit:
        092a60685625 Makefile: fix install flags order
      
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      887e05ab
  12. Mar 19, 2021
    • Gary Lin's avatar
      cmake: make "-no-pie" optional · 24eeae24
      Gary Lin authored
      
      The recent linux distros already support PIE so it shouldn't be a
      problem to remove "-no-pie". To avoid issue#782, we make "-no-pie"
      optional and enable it by default. For the distro with PIE luajit,
      just add the following build option:
      
         -DENABLE_NO_PIE=OFF
      
      Then, bcc-lua will be built with PIE support.
      
      Signed-off-by: default avatarGary Lin <glin@suse.com>
      24eeae24
  13. Mar 17, 2021
Loading