From: David Marchand <david.marchand@6wind.com>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] log: do not drop debug logs at compile time
Date: Tue, 4 Oct 2016 10:26:37 +0200 [thread overview]
Message-ID: <CALwxeUv-_mV7e9mtXpNf+Ns9HLYPQYsXa59M7zriF1VQBGdYEw@mail.gmail.com> (raw)
In-Reply-To: <1474011832-29987-1-git-send-email-olivier.matz@6wind.com>
On Fri, Sep 16, 2016 at 9:43 AM, Olivier Matz <olivier.matz@6wind.com> wrote:
> Today, all logs whose level is lower than INFO are dropped at
> compile-time. This prevents from enabling debug logs at runtime using
> --log-level=8.
>
> The rationale was to remove debug logs from the data path at
> compile-time, avoiding a test at run-time.
>
> This patch changes the behavior of RTE_LOG() to avoid the compile-time
> optimization, and introduces the RTE_LOG_DP() macro that has the same
> behavior than the previous RTE_LOG(), for the rare cases where debug
> logs are in the data path.
>
> So it is now possible to enable debug logs at run-time by just
> specifying --log-level=8. Some drivers still have special compile-time
> options to enable more debug log. Maintainers may consider to
> remove/reduce them.
>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> ---
> config/common_base | 1 +
> doc/guides/faq/faq.rst | 2 +-
> drivers/net/bnxt/bnxt_txr.c | 2 +-
> drivers/net/nfp/nfp_net.c | 8 +++---
> examples/distributor/main.c | 4 +--
> examples/ipsec-secgw/esp.c | 2 +-
> examples/ipsec-secgw/ipsec.c | 4 +--
> examples/packet_ordering/main.c | 6 ++--
> examples/quota_watermark/qw/main.c | 2 +-
> examples/tep_termination/main.c | 4 +--
> examples/vhost/main.c | 14 +++++-----
> examples/vhost_xen/main.c | 20 +++++++-------
> lib/librte_eal/common/include/rte_log.h | 49 +++++++++++++++++++++------------
> 13 files changed, 67 insertions(+), 51 deletions(-)
>
> diff --git a/config/common_base b/config/common_base
> index 7830535..04b71e9 100644
> --- a/config/common_base
> +++ b/config/common_base
> @@ -89,6 +89,7 @@ CONFIG_RTE_MAX_MEMSEG=256
> CONFIG_RTE_MAX_MEMZONE=2560
> CONFIG_RTE_MAX_TAILQ=32
> CONFIG_RTE_LOG_LEVEL=RTE_LOG_INFO
> +CONFIG_RTE_LOG_DP_LEVEL=RTE_LOG_INFO
> CONFIG_RTE_LOG_HISTORY=256
> CONFIG_RTE_LIBEAL_USE_HPET=n
> CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
[snip]
> diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
> index 919563c..76b198f 100644
> --- a/lib/librte_eal/common/include/rte_log.h
> +++ b/lib/librte_eal/common/include/rte_log.h
[snip]
> @@ -266,6 +257,30 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
> * - Negative on error.
> */
> #define RTE_LOG(l, t, ...) \
> + rte_log(RTE_LOG_ ## l, \
> + RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__)
> +
> +/**
> + * Generates a log message for data path.
> + *
> + * Similar to RTE_LOG(), except that it is removed at compilation time
> + * if the RTE_LOG_DP_LEVEL configuration option is lower than the log
> + * level argument.
> + *
> + * @param l
> + * Log level. A value between EMERG (1) and DEBUG (8). The short name is
> + * expanded by the macro, so it cannot be an integer value.
> + * @param t
> + * The log type, for example, EAL. The short name is expanded by the
> + * macro, so it cannot be an integer value.
> + * @param ...
> + * The fmt string, as in printf(3), followed by the variable arguments
> + * required by the format.
> + * @return
> + * - 0: Success.
> + * - Negative on error.
> + */
> +#define RTE_LOG_DP(l, t, ...) \
> (void)((RTE_LOG_ ## l <= RTE_LOG_LEVEL) ? \
> rte_log(RTE_LOG_ ## l, \
> RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) : \
> --
> 2.8.1
Hum, I suppose RTE_LOG_DP should look at RTE_LOG_DP_LEVEL.
--
David Marchand
next prev parent reply other threads:[~2016-10-04 8:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-16 7:43 Olivier Matz
2016-09-30 9:33 ` Thomas Monjalon
2016-09-30 15:48 ` Wiles, Keith
2016-10-03 15:02 ` Olivier Matz
2016-10-03 15:27 ` Wiles, Keith
2016-10-03 15:37 ` Olivier Matz
2016-10-03 16:27 ` Wiles, Keith
2016-10-04 8:28 ` David Marchand
2016-10-05 12:01 ` Olivier Matz
2016-10-04 8:26 ` David Marchand [this message]
2016-10-05 11:57 ` Olivier Matz
2016-11-23 15:34 ` [dpdk-dev] [PATCH v2] " Olivier Matz
2016-12-05 14:08 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALwxeUv-_mV7e9mtXpNf+Ns9HLYPQYsXa59M7zriF1VQBGdYEw@mail.gmail.com \
--to=david.marchand@6wind.com \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).