Skip to content
Snippets Groups Projects
  1. Feb 05, 2020
  2. Feb 04, 2020
  3. Feb 03, 2020
    • Masahiro Yamada's avatar
      kbuild: rename hostprogs-y/always to hostprogs/always-y · 5f2fb52f
      Masahiro Yamada authored
      
      In old days, the "host-progs" syntax was used for specifying host
      programs. It was renamed to the current "hostprogs-y" in 2004.
      
      It is typically useful in scripts/Makefile because it allows Kbuild to
      selectively compile host programs based on the kernel configuration.
      
      This commit renames like follows:
      
        always       ->  always-y
        hostprogs-y  ->  hostprogs
      
      So, scripts/Makefile will look like this:
      
        always-$(CONFIG_BUILD_BIN2C) += ...
        always-$(CONFIG_KALLSYMS)    += ...
            ...
        hostprogs := $(always-y) $(always-m)
      
      I think this makes more sense because a host program is always a host
      program, irrespective of the kernel configuration. We want to specify
      which ones to compile by CONFIG options, so always-y will be handier.
      
      The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
      compatibility for a while.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5f2fb52f
  4. Jan 22, 2020
  5. Jan 21, 2020
  6. Jan 17, 2020
  7. Jan 02, 2020
  8. Dec 21, 2019
  9. Dec 16, 2019
  10. Dec 11, 2019
  11. Dec 10, 2019
  12. Dec 05, 2019
    • Jesper Dangaard Brouer's avatar
      samples/bpf: Fix broken xdp_rxq_info due to map order assumptions · edbca120
      Jesper Dangaard Brouer authored
      
      In the days of using bpf_load.c the order in which the 'maps' sections
      were defines in BPF side (*_kern.c) file, were used by userspace side
      to identify the map via using the map order as an index. In effect the
      order-index is created based on the order the maps sections are stored
      in the ELF-object file, by the LLVM compiler.
      
      This have also carried over in libbpf via API bpf_map__next(NULL, obj)
      to extract maps in the order libbpf parsed the ELF-object file.
      
      When BTF based maps were introduced a new section type ".maps" were
      created. I found that the LLVM compiler doesn't create the ".maps"
      sections in the order they are defined in the C-file. The order in the
      ELF file is based on the order the map pointer is referenced in the code.
      
      This combination of changes lead to xdp_rxq_info mixing up the map
      file-descriptors in userspace, resulting in very broken behaviour, but
      without warning the user.
      
      This patch fix issue by instead using bpf_object__find_map_by_name()
      to find maps via their names. (Note, this is the ELF name, which can
      be longer than the name the kernel retains).
      
      Fixes: be5bca44 ("samples: bpf: convert some XDP samples from bpf_load to libbpf")
      Fixes: 451d1dc8 ("samples: bpf: update map definition to new syntax BTF-defined map")
      Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/157529025128.29832.5953245340679936909.stgit@firesoul
      edbca120
  13. Nov 25, 2019
  14. Nov 23, 2019
    • Divya Indi's avatar
      tracing: Sample module to demonstrate kernel access to Ftrace instances. · 89ed4249
      Divya Indi authored
      This is a sample module to demonstrate the use of the newly introduced and
      exported APIs to access Ftrace instances from within the kernel.
      
      Newly introduced APIs used here -
      
      1. Create/Lookup a trace array with the given name.
      struct trace_array *trace_array_get_by_name(const char *name)
      
      2. Destroy/Remove a trace array.
      int trace_array_destroy(struct trace_array *tr)
      
      4. Enable/Disable trace events:
      int trace_array_set_clr_event(struct trace_array *tr, const char *system,
              const char *event, bool enable);
      
      Exported APIs -
      1. trace_printk equivalent for instances.
      int trace_array_printk(struct trace_array *tr,
                     unsigned long ip, const char *fmt, ...);
      
      2. Helper function.
      void trace_printk_init_buffers(void);
      
      3. To decrement the reference counter.
      void trace_array_put(struct trace_array *tr)
      
      Sample output(contents of /sys/kernel/tracing/instances/sample-instance)
      NOTE: Tracing disabled after ~5 sec)
      
                                    _-----=> irqs-off
                                   / _----=> need-resched
                                  | / _---=> hardirq/softirq
                                  || / _--=> preempt-depth
                                  ||| /     delay
                 TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
                    | |       |   ||||       |         |
      sample-instance-1452  [002] ....    49.430948: simple_thread: trace_array_printk: count=0
      sample-instance-1452  [002] ....    49.430951: sample_event: count value=0 at jiffies=4294716608
      sample-instance-1452  [002] ....    50.454847: simple_thread: trace_array_printk: count=1
      sample-instance-1452  [002] ....    50.454849: sample_event: count value=1 at jiffies=4294717632
      sample-instance-1452  [002] ....    51.478748: simple_thread: trace_array_printk: count=2
      sample-instance-1452  [002] ....    51.478750: sample_event: count value=2 at jiffies=4294718656
      sample-instance-1452  [002] ....    52.502652: simple_thread: trace_array_printk: count=3
      sample-instance-1452  [002] ....    52.502655: sample_event: count value=3 at jiffies=4294719680
      sample-instance-1452  [002] ....    53.526533: simple_thread: trace_array_printk: count=4
      sample-instance-1452  [002] ....    53.526535: sample_event: count value=4 at jiffies=4294720704
      sample-instance-1452  [002] ....    54.550438: simple_thread: trace_array_printk: count=5
      sample-instance-1452  [002] ....    55.574336: simple_thread: trace_array_printk: count=6
      
      Link: http://lkml.kernel.org/r/1574276919-11119-3-git-send-email-divya.indi@oracle.com
      
      
      
      Reviewed-by: default avatarAruna Ramakrishna <aruna.ramakrishna@oracle.com>
      Signed-off-by: default avatarDivya Indi <divya.indi@oracle.com>
      [ Moved to samples/ftrace ]
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      89ed4249
  15. Nov 15, 2019
  16. Nov 13, 2019
  17. Nov 12, 2019
  18. Nov 11, 2019
  19. Nov 09, 2019
    • Daniel T. Lee's avatar
      samples: bpf: update map definition to new syntax BTF-defined map · 451d1dc8
      Daniel T. Lee authored
      
      Since, the new syntax of BTF-defined map has been introduced,
      the syntax for using maps under samples directory are mixed up.
      For example, some are already using the new syntax, and some are using
      existing syntax by calling them as 'legacy'.
      
      As stated at commit abd29c93 ("libbpf: allow specifying map
      definitions using BTF"), the BTF-defined map has more compatablility
      with extending supported map definition features.
      
      The commit doesn't replace all of the map to new BTF-defined map,
      because some of the samples still use bpf_load instead of libbpf, which
      can't properly create BTF-defined map.
      
      This will only updates the samples which uses libbpf API for loading bpf
      program. (ex. bpf_prog_load_xattr)
      
      Signed-off-by: default avatarDaniel T. Lee <danieltimlee@gmail.com>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      451d1dc8
Loading