Skip to content
  • Sven Eckelmann's avatar
    batman-adv: Provide debug messages as trace events · d331a739
    Sven Eckelmann authored
    
    
    A private debug logging infrastructure is currently provided via
    $debug_fs/batman_adv/*/log when CONFIG_BATMAN_ADV_DEBUG is enabled. This is
    not well integrated in the rest of the tracing infrastructure of the
    kernel.
    
    Other components (like mac80211 or ath10k) allow to gather the debug
    messages using generic trace events which are better integrated. This makes
    it possible to interact with them using the existing userspace tools.
    
    The tracepoint batadv:batadv_dbg will now be available when
    CONFIG_BATMAN_ADV_DEBUG and CONFIG_BATMAN_ADV_TRACING is activated. The log
    level mask is still used for filtering as usual.
    
    A full system trace for offline parsing can be created (and read) using:
    
      $ batctl ll all
      $ trace-cmd record -e batadv:batadv_dbg
      $ trace-cmd report
    
    The same can also be done without recording to a file
    
      $ batctl ll all
      $ trace-cmd stream -e batadv:batadv_dbg
    
    The trace infrastructure is especially helpful when tracing processes:
    
      $ batctl ll all
      $ ./tools/perf/perf trace --event "batadv:*" batctl p 10.204.32.1
         0.000 batadv:batadv_dbg:batman_adv bat0 Parsing outgoing ARP REQUEST
         0.045 batadv:batadv_dbg:batman_adv bat0 ARP MSG = [src: a2:64:14:53:f8:22-10.204.32.185 dst: 00:00:00:00:00:00-10.204.32.1]
         0.067 batadv:batadv_dbg:batman_adv bat0 Entry updated: 10.204.32.185 a2:64:14:53:f8:22 (vid: -1)
         0.099 batadv:batadv_dbg:batman_adv bat0 batadv_dat_select_candidates(): IP=10.204.32.1 hash(IP)=48902
         0.757 batadv:batadv_dbg:batman_adv bat0 dat_select_candidates() 0: selected fe:2c:91:68:29:2b addr=48977 dist=65460
         1.178 batadv:batadv_dbg:batman_adv bat0 dat_select_candidates() 1: selected fe:81:ab:c5:e3:03 addr=49181 dist=65256
         1.809 batadv:batadv_dbg:batman_adv bat0 dat_select_candidates() 2: selected 66:25:a7:48:37:fb addr=49328 dist=65109
         1.828 batadv:batadv_dbg:batman_adv bat0 DHT_SEND for 10.204.32.1
    
    Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
    Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
    d331a739