Search Linux Wireless

Re: [RFC PATCH v2 1/4] tracing: add __print_sym() to replace __print_symbolic()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 26, 2024 at 08:15:56PM +0100, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@xxxxxxxxx>
> 
> The way __print_symbolic() works is limited and inefficient
> in multiple ways:
>  - you can only use it with a static list of symbols, but
>    e.g. the SKB dropreasons are now a dynamic list
> 
>  - it builds the list in memory _three_ times, so it takes
>    a lot of memory:
>    - The print_fmt contains the list (since it's passed to
>      the macro there). This actually contains the names
>      _twice_, which is fixed up at runtime.
>    - TRACE_DEFINE_ENUM() puts a 24-byte struct trace_eval_map
>      for every entry, plus the string pointed to by it, which
>      cannot be deduplicated with the strings in the print_fmt
>    - The in-kernel symbolic printing creates yet another list
>      of struct trace_print_flags for trace_print_symbols_seq()
> 
>  - it also requires runtime fixup during init, which is a lot
>    of string parsing due to the print_fmt fixup
> 
> Introduce __print_sym() to - over time - replace the old one.
> We can easily extend this also to __print_flags later, but I
> cared only about the SKB dropreasons for now, which has only
> __print_symbolic().
> 
> This new __print_sym() requires only a single list of items,
> created by TRACE_DEFINE_SYM_LIST(), or can even use another
> already existing list by using TRACE_DEFINE_SYM_FNS() with
> lookup and show methods.
> 
> Then, instead of doing an init-time fixup, just do this at the
> time when userspace reads the print_fmt. This way, dynamically
> updated lists are possible.
> 
> For userspace, nothing actually changes, because the print_fmt
> is shown exactly the same way the old __print_symbolic() was.
> 
> This adds about 4k .text in my test builds, but that'll be
> more than paid for by the actual conversions.
> 
> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>

Hi Johannes,

I'm seeing some allmodconfig build problems with this applied on top of
net-next.

In file included from ./include/trace/trace_events.h:27,
                 from ./include/trace/define_trace.h:102,
                 from ./include/trace/events/module.h:134,
                 from kernel/module/main.c:64:
./include/trace/stages/init.h:30: warning: "TRACE_DEFINE_SYM_FNS" redefined
   30 | #define TRACE_DEFINE_SYM_FNS(_symbol_id, _lookup, _show)                \
      |
In file included from ./include/linux/trace_events.h:11,
                 from kernel/module/main.c:14:
./include/linux/tracepoint.h:130: note: this is the location of the previous definition
  130 | #define TRACE_DEFINE_SYM_FNS(...)
      |
./include/trace/stages/init.h:54: warning: "TRACE_DEFINE_SYM_LIST" redefined
   54 | #define TRACE_DEFINE_SYM_LIST(_symbol_id, ...)                          \
      |
./include/linux/tracepoint.h:131: note: this is the location of the previous definition
  131 | #define TRACE_DEFINE_SYM_LIST(...)
      |





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux