[RFC 0/3] Detect superfluous newline in logs

David Marchand david.marchand at redhat.com
Fri Nov 17 14:18:21 CET 2023


Getting readable and consistent logs is important when running a DPDK
application, especially when troubleshooting.
A common issue with logs is when a DPDK change do not add (or on the
contrary add too many \n) in the format string.

This issue would only get noticed when actually hitting this log (which
may be something difficult to do).

This series proposes to introduce a new RTE_LOG helper that is
responsible for logging a one line message and spews a build error (with
gcc) if any \n is part of the format string.


Note:
- the first patch is intentionnally sent as a single block: splitting it
  into per library commits with correct Fixes: tags is a tedious work.
  I would split it for a non RFC series. For now, it is enough to show
  case the idea.
- the last patch shows how an existing log macro is converted,


-- 
David Marchand

David Marchand (3):
  lib: remove redundant newline from logs
  log: add a per line log helper
  lib: use per line logging

 drivers/crypto/ipsec_mb/ipsec_mb_ops.c     |   2 +-
 lib/bbdev/rte_bbdev.c                      |   9 +-
 lib/cfgfile/rte_cfgfile.c                  |  18 ++--
 lib/compressdev/rte_compressdev_internal.h |   5 +-
 lib/compressdev/rte_compressdev_pmd.c      |   4 +-
 lib/cryptodev/rte_cryptodev.c              |   5 +-
 lib/cryptodev/rte_cryptodev.h              |  16 ++--
 lib/dispatcher/rte_dispatcher.c            |  12 +--
 lib/dmadev/rte_dmadev.c                    |   8 +-
 lib/eventdev/eventdev_pmd.h                |  14 +--
 lib/eventdev/rte_event_crypto_adapter.c    |  12 +--
 lib/eventdev/rte_event_dma_adapter.c       |  18 ++--
 lib/eventdev/rte_event_eth_rx_adapter.c    |  30 +++---
 lib/eventdev/rte_event_eth_tx_adapter.c    |   2 +-
 lib/eventdev/rte_event_timer_adapter.c     |  21 +++--
 lib/eventdev/rte_eventdev.c                |  10 +-
 lib/gpudev/gpudev.c                        |   6 +-
 lib/graph/graph_private.h                  |   5 +-
 lib/log/rte_log.h                          |  21 +++++
 lib/metrics/rte_metrics_telemetry.c        |   6 +-
 lib/mldev/rte_mldev.c                      | 102 ++++++++++-----------
 lib/mldev/rte_mldev.h                      |   5 +-
 lib/net/rte_net_crc.c                      |  14 +--
 lib/node/ethdev_rx.c                       |   4 +-
 lib/node/ip4_lookup.c                      |   2 +-
 lib/node/ip6_lookup.c                      |   2 +-
 lib/node/kernel_rx.c                       |   8 +-
 lib/node/kernel_tx.c                       |   4 +-
 lib/node/node_private.h                    |   6 +-
 lib/rawdev/rte_rawdev_pmd.h                |   4 +-
 lib/rcu/rte_rcu_qsbr.c                     |   4 +-
 lib/rcu/rte_rcu_qsbr.h                     |  17 ++--
 lib/stack/rte_stack.c                      |   8 +-
 lib/stack/stack_pvt.h                      |   4 +-
 34 files changed, 220 insertions(+), 188 deletions(-)

-- 
2.41.0



More information about the dev mailing list