DPDK patches and discussions
 help / color / mirror / Atom feed
From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
To: David Marchand <david.marchand@redhat.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "thomas@monjalon.net" <thomas@monjalon.net>,
	"ferruh.yigit@amd.com" <ferruh.yigit@amd.com>,
	"bruce.richardson@intel.com" <bruce.richardson@intel.com>,
	"stephen@networkplumber.org" <stephen@networkplumber.org>,
	"mb@smartsharesystems.com" <mb@smartsharesystems.com>,
	nd <nd@arm.com>, nd <nd@arm.com>
Subject: RE: [RFC v2 09/14] rcu: introduce a logging helper
Date: Fri, 8 Dec 2023 18:26:08 +0000	[thread overview]
Message-ID: <DBAPR08MB58147FEA894D12031B581EC3988AA@DBAPR08MB5814.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20231208145950.2184940-10-david.marchand@redhat.com>



> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Friday, December 8, 2023 9:00 AM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; ferruh.yigit@amd.com;
> bruce.richardson@intel.com; stephen@networkplumber.org;
> mb@smartsharesystems.com; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>
> Subject: [RFC v2 09/14] rcu: introduce a logging helper
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Thank you, looks good
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> ---
>  lib/rcu/rte_rcu_qsbr.c | 62 ++++++++++++++++--------------------------
>  lib/rcu/rte_rcu_qsbr.h |  1 +
>  2 files changed, 24 insertions(+), 39 deletions(-)
> 
> diff --git a/lib/rcu/rte_rcu_qsbr.c b/lib/rcu/rte_rcu_qsbr.c index
> 41a44be4b9..5b6530788a 100644
> --- a/lib/rcu/rte_rcu_qsbr.c
> +++ b/lib/rcu/rte_rcu_qsbr.c
> @@ -19,6 +19,9 @@
>  #include "rte_rcu_qsbr.h"
>  #include "rcu_qsbr_pvt.h"
> 
> +#define RCU_LOG(level, fmt, args...) \
> +	RTE_LOG(level, RCU, "%s(): " fmt "\n", __func__, ## args)
> +
>  /* Get the memory size of QSBR variable */  size_t
> rte_rcu_qsbr_get_memsize(uint32_t max_threads) @@ -26,9 +29,7 @@
> rte_rcu_qsbr_get_memsize(uint32_t max_threads)
>  	size_t sz;
> 
>  	if (max_threads == 0) {
> -		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
> -			"%s(): Invalid max_threads %u\n",
> -			__func__, max_threads);
> +		RCU_LOG(ERR, "Invalid max_threads %u", max_threads);
>  		rte_errno = EINVAL;
> 
>  		return 1;
> @@ -52,8 +53,7 @@ rte_rcu_qsbr_init(struct rte_rcu_qsbr *v, uint32_t
> max_threads)
>  	size_t sz;
> 
>  	if (v == NULL) {
> -		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
> -			"%s(): Invalid input parameter\n", __func__);
> +		RCU_LOG(ERR, "Invalid input parameter");
>  		rte_errno = EINVAL;
> 
>  		return 1;
> @@ -85,8 +85,7 @@ rte_rcu_qsbr_thread_register(struct rte_rcu_qsbr *v,
> unsigned int thread_id)
>  	uint64_t old_bmap, new_bmap;
> 
>  	if (v == NULL || thread_id >= v->max_threads) {
> -		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
> -			"%s(): Invalid input parameter\n", __func__);
> +		RCU_LOG(ERR, "Invalid input parameter");
>  		rte_errno = EINVAL;
> 
>  		return 1;
> @@ -137,8 +136,7 @@ rte_rcu_qsbr_thread_unregister(struct rte_rcu_qsbr
> *v, unsigned int thread_id)
>  	uint64_t old_bmap, new_bmap;
> 
>  	if (v == NULL || thread_id >= v->max_threads) {
> -		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
> -			"%s(): Invalid input parameter\n", __func__);
> +		RCU_LOG(ERR, "Invalid input parameter");
>  		rte_errno = EINVAL;
> 
>  		return 1;
> @@ -211,8 +209,7 @@ rte_rcu_qsbr_dump(FILE *f, struct rte_rcu_qsbr *v)
>  	uint32_t i, t, id;
> 
>  	if (v == NULL || f == NULL) {
> -		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
> -			"%s(): Invalid input parameter\n", __func__);
> +		RCU_LOG(ERR, "Invalid input parameter");
>  		rte_errno = EINVAL;
> 
>  		return 1;
> @@ -282,8 +279,7 @@ rte_rcu_qsbr_dq_create(const struct
> rte_rcu_qsbr_dq_parameters *params)
>  		params->v == NULL || params->name == NULL ||
>  		params->size == 0 || params->esize == 0 ||
>  		(params->esize % 4 != 0)) {
> -		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
> -			"%s(): Invalid input parameter\n", __func__);
> +		RCU_LOG(ERR, "Invalid input parameter");
>  		rte_errno = EINVAL;
> 
>  		return NULL;
> @@ -293,9 +289,10 @@ rte_rcu_qsbr_dq_create(const struct
> rte_rcu_qsbr_dq_parameters *params)
>  	 */
>  	if ((params->trigger_reclaim_limit <= params->size) &&
>  	    (params->max_reclaim_size == 0)) {
> -		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
> -			"%s(): Invalid input parameter, size = %u,
> trigger_reclaim_limit = %u, max_reclaim_size = %u\n",
> -			__func__, params->size, params-
> >trigger_reclaim_limit,
> +		RCU_LOG(ERR,
> +			"Invalid input parameter, size = %u,
> trigger_reclaim_limit = %u, "
> +			"max_reclaim_size = %u",
> +			params->size, params->trigger_reclaim_limit,
>  			params->max_reclaim_size);
>  		rte_errno = EINVAL;
> 
> @@ -328,8 +325,7 @@ rte_rcu_qsbr_dq_create(const struct
> rte_rcu_qsbr_dq_parameters *params)
>  			__RTE_QSBR_TOKEN_SIZE + params->esize,
>  			qs_fifo_size, SOCKET_ID_ANY, flags);
>  	if (dq->r == NULL) {
> -		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
> -			"%s(): defer queue create failed\n", __func__);
> +		RCU_LOG(ERR, "defer queue create failed");
>  		rte_free(dq);
>  		return NULL;
>  	}
> @@ -354,8 +350,7 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq
> *dq, void *e)
>  	uint32_t cur_size;
> 
>  	if (dq == NULL || e == NULL) {
> -		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
> -			"%s(): Invalid input parameter\n", __func__);
> +		RCU_LOG(ERR, "Invalid input parameter");
>  		rte_errno = EINVAL;
> 
>  		return 1;
> @@ -372,8 +367,7 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq
> *dq, void *e)
>  	 */
>  	cur_size = rte_ring_count(dq->r);
>  	if (cur_size > dq->trigger_reclaim_limit) {
> -		rte_log(RTE_LOG_INFO, rte_rcu_log_type,
> -			"%s(): Triggering reclamation\n", __func__);
> +		RCU_LOG(INFO, "Triggering reclamation");
>  		rte_rcu_qsbr_dq_reclaim(dq, dq->max_reclaim_size,
>  						NULL, NULL, NULL);
>  	}
> @@ -391,23 +385,18 @@ int rte_rcu_qsbr_dq_enqueue(struct
> rte_rcu_qsbr_dq *dq, void *e)
>  	 * Enqueue uses the configured flags when the DQ was created.
>  	 */
>  	if (rte_ring_enqueue_elem(dq->r, data, dq->esize) != 0) {
> -		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
> -			"%s(): Enqueue failed\n", __func__);
> +		RCU_LOG(ERR, "Enqueue failed");
>  		/* Note that the token generated above is not used.
>  		 * Other than wasting tokens, it should not cause any
>  		 * other issues.
>  		 */
> -		rte_log(RTE_LOG_INFO, rte_rcu_log_type,
> -			"%s(): Skipped enqueuing token = %" PRIu64 "\n",
> -			__func__, dq_elem->token);
> +		RCU_LOG(INFO, "Skipped enqueuing token = %" PRIu64,
> dq_elem->token);
> 
>  		rte_errno = ENOSPC;
>  		return 1;
>  	}
> 
> -	rte_log(RTE_LOG_INFO, rte_rcu_log_type,
> -		"%s(): Enqueued token = %" PRIu64 "\n",
> -		__func__, dq_elem->token);
> +	RCU_LOG(INFO, "Enqueued token = %" PRIu64, dq_elem->token);
> 
>  	return 0;
>  }
> @@ -422,8 +411,7 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq,
> unsigned int n,
>  	__rte_rcu_qsbr_dq_elem_t *dq_elem;
> 
>  	if (dq == NULL || n == 0) {
> -		rte_log(RTE_LOG_ERR, rte_rcu_log_type,
> -			"%s(): Invalid input parameter\n", __func__);
> +		RCU_LOG(ERR, "Invalid input parameter");
>  		rte_errno = EINVAL;
> 
>  		return 1;
> @@ -445,17 +433,14 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq
> *dq, unsigned int n,
>  		}
>  		rte_ring_dequeue_elem_finish(dq->r, 1);
> 
> -		rte_log(RTE_LOG_INFO, rte_rcu_log_type,
> -			"%s(): Reclaimed token = %" PRIu64 "\n",
> -			__func__, dq_elem->token);
> +		RCU_LOG(INFO, "Reclaimed token = %" PRIu64, dq_elem-
> >token);
> 
>  		dq->free_fn(dq->p, dq_elem->elem, 1);
> 
>  		cnt++;
>  	}
> 
> -	rte_log(RTE_LOG_INFO, rte_rcu_log_type,
> -		"%s(): Reclaimed %u resources\n", __func__, cnt);
> +	RCU_LOG(INFO, "Reclaimed %u resources", cnt);
> 
>  	if (freed != NULL)
>  		*freed = cnt;
> @@ -472,8 +457,7 @@ rte_rcu_qsbr_dq_delete(struct rte_rcu_qsbr_dq *dq)
>  	unsigned int pending;
> 
>  	if (dq == NULL) {
> -		rte_log(RTE_LOG_DEBUG, rte_rcu_log_type,
> -			"%s(): Invalid input parameter\n", __func__);
> +		RCU_LOG(DEBUG, "Invalid input parameter");
> 
>  		return 0;
>  	}
> diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h index
> 6b908e7ee0..0dca8310c0 100644
> --- a/lib/rcu/rte_rcu_qsbr.h
> +++ b/lib/rcu/rte_rcu_qsbr.h
> @@ -36,6 +36,7 @@ extern "C" {
>  #include <rte_ring.h>
> 
>  extern int rte_rcu_log_type;
> +#define RTE_LOGTYPE_RCU rte_rcu_log_type
> 
>  #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
>  #define __RTE_RCU_DP_LOG(level, fmt, args...) \
> --
> 2.43.0


  parent reply	other threads:[~2023-12-08 18:26 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 13:18 [RFC 0/3] Detect superfluous newline in logs David Marchand
2023-11-17 13:18 ` [RFC 1/3] lib: remove redundant newline from logs David Marchand
2023-11-17 13:18 ` [RFC 2/3] log: add a per line log helper David Marchand
2023-11-17 13:18 ` [RFC 3/3] lib: use per line logging David Marchand
2023-11-17 13:27 ` [RFC 0/3] Detect superfluous newline in logs Bruce Richardson
2023-11-17 13:48   ` David Marchand
2023-11-17 14:11     ` Bruce Richardson
2023-11-17 14:21       ` David Marchand
2023-11-17 13:47 ` Morten Brørup
2023-11-17 14:09   ` David Marchand
2023-11-17 14:17     ` Morten Brørup
2023-12-08 14:59 ` [RFC v2 00/14] " David Marchand
2023-12-08 14:59   ` [RFC v2 01/14] hash: remove some dead code David Marchand
2023-12-08 16:53     ` Stephen Hemminger
2023-12-08 20:46     ` Tyler Retzlaff
2023-12-08 14:59   ` [RFC v2 02/14] regexdev: fix logtype register David Marchand
2023-12-08 16:58     ` Stephen Hemminger
2023-12-08 20:46     ` Tyler Retzlaff
2023-12-14 10:11     ` Ori Kam
2023-12-08 14:59   ` [RFC v2 03/14] lib: use dedicated logtypes David Marchand
2023-12-08 17:00     ` Stephen Hemminger
2023-12-08 20:49     ` Tyler Retzlaff
2023-12-16  9:47     ` Andrew Rybchenko
2023-12-08 14:59   ` [RFC v2 04/14] lib: add newline in logs David Marchand
2023-12-08 17:01     ` Stephen Hemminger
2023-12-11 12:38       ` David Marchand
2023-12-08 20:50     ` Tyler Retzlaff
2023-12-16  9:43     ` Andrew Rybchenko
2023-12-08 14:59   ` [RFC v2 05/14] lib: remove redundant newline from logs David Marchand
2023-12-08 17:02     ` Stephen Hemminger
2023-12-09  7:15     ` fengchengwen
2023-12-11  8:48     ` Mattias Rönnblom
2023-12-08 14:59   ` [RFC v2 06/14] eal/linux: remove log paraphrasing the doc David Marchand
2023-12-08 17:03     ` Stephen Hemminger
2023-12-08 20:54     ` Tyler Retzlaff
2023-12-08 14:59   ` [RFC v2 07/14] bpf: remove log level in internal helper David Marchand
2023-12-08 17:04     ` Stephen Hemminger
2023-12-08 21:02     ` Tyler Retzlaff
2023-12-08 14:59   ` [RFC v2 08/14] lib: simplify multilines log messages David Marchand
2023-12-08 17:05     ` Stephen Hemminger
2023-12-16  9:26       ` Andrew Rybchenko
2023-12-08 21:03     ` Tyler Retzlaff
2023-12-08 14:59   ` [RFC v2 09/14] rcu: introduce a logging helper David Marchand
2023-12-08 17:08     ` Stephen Hemminger
2023-12-08 18:26     ` Honnappa Nagarahalli [this message]
2023-12-08 21:27     ` Tyler Retzlaff
2023-12-12 15:00       ` David Marchand
2023-12-12 19:11         ` Tyler Retzlaff
2023-12-18  9:37           ` David Marchand
2023-12-18 19:52             ` Tyler Retzlaff
2023-12-08 14:59   ` [RFC v2 10/14] vhost: improve log for memory dumping configuration David Marchand
2023-12-08 17:14     ` Stephen Hemminger
2023-12-08 14:59   ` [RFC v2 11/14] log: add a per line log helper David Marchand
2023-12-08 17:15     ` Stephen Hemminger
2023-12-09  7:21     ` fengchengwen
2023-12-08 14:59   ` [RFC v2 12/14] lib: convert to per line logging David Marchand
2023-12-08 17:16     ` Stephen Hemminger
2023-12-11 12:34       ` David Marchand
2023-12-16  9:30     ` Andrew Rybchenko
2023-12-08 14:59   ` [RFC v2 13/14] lib: replace logging helpers David Marchand
2023-12-08 17:18     ` Stephen Hemminger
2023-12-11 12:36       ` David Marchand
2023-12-16  9:42     ` Andrew Rybchenko
2023-12-08 14:59   ` [RFC v2 14/14] lib: use per line logging in helpers David Marchand
2023-12-09  7:19     ` fengchengwen
2023-12-16  9:41     ` Andrew Rybchenko
2023-12-18  9:27 ` [PATCH v3 00/14] Detect superfluous newline in logs David Marchand
2023-12-18  9:27   ` [PATCH v3 01/14] hash: remove some dead code David Marchand
2023-12-18  9:27   ` [PATCH v3 02/14] regexdev: fix logtype register David Marchand
2023-12-18  9:27   ` [PATCH v3 03/14] lib: use dedicated logtypes and macros David Marchand
2023-12-18  9:27   ` [PATCH v3 04/14] lib: add newline in logs David Marchand
2023-12-18  9:27   ` [PATCH v3 05/14] lib: remove redundant newline from logs David Marchand
2023-12-18  9:27   ` [PATCH v3 06/14] eal/linux: remove log paraphrasing the doc David Marchand
2023-12-18  9:27   ` [PATCH v3 07/14] bpf: remove log level in internal helper David Marchand
2023-12-18  9:27   ` [PATCH v3 08/14] lib: simplify multilines log messages David Marchand
2023-12-18 10:05     ` Andrew Rybchenko
2023-12-18  9:27   ` [PATCH v3 09/14] rcu: introduce a logging helper David Marchand
2023-12-18  9:27   ` [PATCH v3 10/14] vhost: improve log for memory dumping configuration David Marchand
2023-12-18  9:27   ` [PATCH v3 11/14] log: add a per line log helper David Marchand
2023-12-18  9:27   ` [PATCH v3 12/14] lib: convert to per line logging David Marchand
2023-12-18  9:27   ` [PATCH v3 13/14] lib: replace logging helpers David Marchand
2023-12-18  9:27   ` [PATCH v3 14/14] lib: use per line logging in helpers David Marchand
2023-12-18 14:37 ` [PATCH v4 00/14] Detect superfluous newline in logs David Marchand
2023-12-18 14:37   ` [PATCH v4 01/14] hash: remove some dead code David Marchand
2023-12-18 14:37   ` [PATCH v4 02/14] regexdev: fix logtype register David Marchand
2023-12-18 16:46     ` Stephen Hemminger
2023-12-18 14:37   ` [PATCH v4 03/14] lib: use dedicated logtypes and macros David Marchand
2023-12-18 14:37   ` [PATCH v4 04/14] lib: add newline in logs David Marchand
2023-12-18 14:37   ` [PATCH v4 05/14] lib: remove redundant newline from logs David Marchand
2023-12-18 14:37   ` [PATCH v4 06/14] eal/linux: remove log paraphrasing the doc David Marchand
2023-12-18 14:37   ` [PATCH v4 07/14] bpf: remove log level in internal helper David Marchand
2023-12-18 14:37   ` [PATCH v4 08/14] lib: simplify multilines log messages David Marchand
2023-12-18 14:37   ` [PATCH v4 09/14] rcu: introduce a logging helper David Marchand
2023-12-18 14:37   ` [PATCH v4 10/14] vhost: improve log for memory dumping configuration David Marchand
2023-12-18 14:38   ` [PATCH v4 11/14] log: add a per line log helper David Marchand
2023-12-19 15:45     ` Thomas Monjalon
2023-12-19 17:16       ` Stephen Hemminger
2023-12-20  8:26         ` David Marchand
2023-12-18 14:38   ` [PATCH v4 12/14] lib: convert to per line logging David Marchand
2023-12-20 13:46     ` Thomas Monjalon
2023-12-20 14:00       ` David Marchand
2023-12-18 14:38   ` [PATCH v4 13/14] lib: replace logging helpers David Marchand
2023-12-18 14:38   ` [PATCH v4 14/14] lib: use per line logging in helpers David Marchand
2023-12-20 15:35 ` [PATCH v5 00/13] Detect superfluous newline in logs David Marchand
2023-12-20 15:35   ` [PATCH v5 01/13] hash: remove some dead code David Marchand
2023-12-21  5:58     ` Ruifeng Wang
2023-12-21  6:26     ` Ruifeng Wang
2023-12-20 15:35   ` [PATCH v5 02/13] regexdev: fix logtype register David Marchand
2023-12-20 15:35   ` [PATCH v5 03/13] lib: use dedicated logtypes and macros David Marchand
2023-12-20 15:35   ` [PATCH v5 04/13] lib: add newline in logs David Marchand
2023-12-20 15:35   ` [PATCH v5 05/13] lib: remove redundant newline from logs David Marchand
2023-12-20 15:35   ` [PATCH v5 06/13] eal/linux: remove log paraphrasing the doc David Marchand
2023-12-20 15:36   ` [PATCH v5 07/13] bpf: remove log level in internal helper David Marchand
2023-12-20 15:36   ` [PATCH v5 08/13] lib: simplify multilines log messages David Marchand
2023-12-20 15:36   ` [PATCH v5 09/13] lib: add more logging helpers David Marchand
2023-12-20 15:36   ` [PATCH v5 10/13] vhost: improve log for memory dumping configuration David Marchand
2023-12-20 15:36   ` [PATCH v5 11/13] log: add a per line log helper David Marchand
2023-12-20 15:42     ` David Marchand
2023-12-20 15:36   ` [PATCH v5 12/13] lib: replace logging helpers David Marchand
2023-12-20 15:36   ` [PATCH v5 13/13] lib: use per line logging in helpers David Marchand
2023-12-21  9:31   ` [PATCH v5 00/13] Detect superfluous newline in logs David Marchand
2023-12-21 16:32   ` Stephen Hemminger

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=DBAPR08MB58147FEA894D12031B581EC3988AA@DBAPR08MB5814.eurprd08.prod.outlook.com \
    --to=honnappa.nagarahalli@arm.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=mb@smartsharesystems.com \
    --cc=nd@arm.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /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).