From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <olivier.matz@6wind.com>
Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52])
 by dpdk.org (Postfix) with ESMTP id 61E282BBB
 for <dev@dpdk.org>; Thu,  8 Jun 2017 12:08:05 +0200 (CEST)
Received: by mail-wm0-f52.google.com with SMTP id 7so134519226wmo.1
 for <dev@dpdk.org>; Thu, 08 Jun 2017 03:08:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=dSq0JwvbdwNK0yZh4jnGFA4MzXrYhnyzvtzyQ0Nq104=;
 b=VZQHyYzTgOSRb8G1xiOfDX1FOb118jKLQnNGEDeK3OEOhoBu4VFdvKBOaFM42N+aNU
 j0fD9srMGBir9E21b4bjpctlL1tgfqzS/ZajaF+aoDsomyHhxSJPhU52rmJ3UwNtWqzh
 bR4bAPmdqZsiSXCg48bDY/DD5fN/Hg3D41FxCDsu1+PgDy0RxyhbkqO/rik9Gu69jPsJ
 avLLR3uLdUVxUm/p1pNn6Ob7oaOvp1KbRCMftC5T6s6ivPLvHR9ccmpY/kafmGXPbxdg
 5oYIe7VLuj39d832dQ8Kqv1WQydE+cXt14pA3556vKMz6NZ+Ntl27Gass3o/ZtyLdmUZ
 4cEQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=dSq0JwvbdwNK0yZh4jnGFA4MzXrYhnyzvtzyQ0Nq104=;
 b=HFslmcC9YXvNot3IXRj1+xg1T4Blg4w9cELazT2mdfB0Ns5Ne8xCqgbBX2XuO/lsma
 Rwp1zbDx7pIduZ7BLscrEEInU/TsQQ3F6jrVs8ktiesVtZ2VyXLGQKFZ/dRokhhVi2Eg
 LrNjhxewzv4YJQ6r+l2++CjTggtb7M2AMTvw7LQRZN/R2XuVR9t2AxvjNUPMAsVVY2v3
 DjkGVsjxjc/6C4uJUVueg8ejoPoupx/tVonpU6iJn8kQKMayxSZm3AZUnKlw6rGk/0rW
 CZMP6S1KNVmvNhoQU4Zwkjgodpp5kVcpV+iqwn7++OrD3WOdWJvK3otkBGqgNwgdy5nS
 LHlQ==
X-Gm-Message-State: AODbwcBzyRlIXz5nRNaaNZBcsY0GQZ0BSKdxpmMQz3Pu9gN9xncB1ExH
 HD3HNxUFWe+moWXv
X-Received: by 10.28.2.67 with SMTP id 64mr2702926wmc.101.1496916485023;
 Thu, 08 Jun 2017 03:08:05 -0700 (PDT)
Received: from platinum (2a01cb0c03c651000226b0fffeed02fc.ipv6.abo.wanadoo.fr.
 [2a01:cb0c:3c6:5100:226:b0ff:feed:2fc])
 by smtp.gmail.com with ESMTPSA id q77sm4999788wmd.31.2017.06.08.03.08.04
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 08 Jun 2017 03:08:04 -0700 (PDT)
Date: Thu, 8 Jun 2017 12:08:01 +0200
From: Olivier Matz <olivier.matz@6wind.com>
To: Hemant Agrawal <hemant.agrawal@nxp.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>, <shreyansh.jain@nxp.com>
Message-ID: <20170608120801.1102e7bc@platinum>
In-Reply-To: <1495532028-9700-2-git-send-email-hemant.agrawal@nxp.com>
References: <1495532028-9700-1-git-send-email-hemant.agrawal@nxp.com>
 <1495532028-9700-2-git-send-email-hemant.agrawal@nxp.com>
X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH 2/2] mempool/dpaa2: improving the alloc/free
	logging
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 08 Jun 2017 10:08:05 -0000

Hi Hemant,

On Tue, 23 May 2017 15:03:48 +0530, Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
> Debug logs are helpful for better debugging. Alloc
> was having the logs, but logs were not present in free routines.
> 
> This patch add support for debug mode logs in free routine.
> Also, changing the log category to DRV instead of TX.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> index 60dd1c0..e00ed5d 100644
> --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> @@ -309,8 +309,8 @@
>  
>  #ifdef RTE_LIBRTE_DPAA2_DEBUG_DRIVER
>  	alloc += n;
> -	PMD_TX_LOG(DEBUG, "Total = %d , req = %d done = %d",
> -		   alloc, count, n);
> +	PMD_DRV_LOG(DEBUG, "Total = %d , req = %d done = %d",
> +		    alloc, count, n);
>  #endif
>  	return 0;
>  }

Since we are in a mempool driver, we may not want to use PMD_*_LOG()
functions.

Also, I don't see where these macros are defined for this file, but maybe
I miss something that is right under my nose ;)

Anyway, I suggest to use your own macros for dpaa mempool instead,
and if possible:
  - avoid compilation options as much as possible
  - RTE_LOG() for logs that cannot occur in dataplane (they can be enabled
    dynamically)
  - RTE_LOG_DP() for dataplane logs: these are stripped at compilation
    time, unless your log level <= RTE_LOG_DP_LEVEL


> @@ -320,6 +320,9 @@
>  		  void * const *obj_table, unsigned int n)
>  {
>  	struct dpaa2_bp_info *bp_info;
> +#ifdef RTE_LIBRTE_DPAA2_DEBUG_DRIVER
> +	static int freed;
> +#endif
>  
>  	bp_info = mempool_to_bpinfo(pool);
>  	if (!(bp_info->bp_list)) {
> @@ -329,6 +332,11 @@
>  	rte_dpaa2_mbuf_release(pool, obj_table, bp_info->bpid,
>  			   bp_info->meta_data_size, n);
>  
> +#ifdef RTE_LIBRTE_DPAA2_DEBUG_DRIVER
> +	freed += n;
> +	PMD_DRV_LOG(DEBUG, "Total = %d , done = %d",
> +		    freed, n);
> +#endif
>  	return 0;
>  }
>