From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2881CA00C3; Thu, 21 Apr 2022 11:04:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F05740042; Thu, 21 Apr 2022 11:04:12 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 9B4B140040 for ; Thu, 21 Apr 2022 11:04:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650531849; x=1682067849; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=xvOT2a0aiqFD3MzqukI07RuJhVVwnvJsreBhHCJjd9M=; b=OKuxhFiVVg+vC6TzI9s0r+tJ0MRcNRQB4cb048yQ5khd1z9MSFX6qfdr diVbgYxVRjLu+6gSTbuQTKy3Y1e4LbPgZpjvRXZ97glS/xPzFXXNT5XlO lEh14b9n46i6jS58eOuSYcxTUgcD6KnEdXM435Rjc+kLBknp9SudbCPCv se3g5Sv6FjhUhPoZAdBFukdLmSJ3T3ve4v2CAZInzF3DjceUkGsqcQ7Td Lxf116+NrY3FK7c+SheDiuyEYdTjVH0QrESXWa1DOybeMtmv6rquiPE72 RadJAZgTTp80HRLXni/my0KOvR1RAAdRF2Nr5+M4oe9VqK1s7G7JT+0to A==; X-IronPort-AV: E=McAfee;i="6400,9594,10323"; a="244219442" X-IronPort-AV: E=Sophos;i="5.90,278,1643702400"; d="scan'208";a="244219442" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2022 02:04:05 -0700 X-IronPort-AV: E=Sophos;i="5.90,278,1643702400"; d="scan'208";a="577109686" Received: from bricha3-mobl.ger.corp.intel.com ([10.55.133.40]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 21 Apr 2022 02:04:02 -0700 Date: Thu, 21 Apr 2022 10:03:58 +0100 From: Bruce Richardson To: David Marchand Cc: Chengwen Feng , Thomas Monjalon , ferruh.yigit@xilinx.com, Andrew Rybchenko , Nithin Dabilpuram , Kiran Kumar Kokkilagadda , Sunil Kumar Kori , Satha Rao , dev , Kevin Laatz , Conor Walsh , Ciara Power Subject: Re: [PATCH 2/3] ethdev: fix memory leak when telemetry xstats Message-ID: References: <20220416010747.40714-1-fengchengwen@huawei.com> <20220416010747.40714-3-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Apr 21, 2022 at 10:09:56AM +0200, David Marchand wrote: > On Sat, Apr 16, 2022 at 3:14 AM Chengwen Feng wrote: > > > > The 'eth_xstats' should be freed after setup telemetry dictionary. This > > patch fixes it. > > > > Fixes: c190daedb9b1 ("ethdev: add telemetry callbacks") > > Cc: stable@dpdk.org > > > > Signed-off-by: Chengwen Feng > > --- > > lib/ethdev/rte_ethdev.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > > index 615383bde2..df20433c2d 100644 > > --- a/lib/ethdev/rte_ethdev.c > > +++ b/lib/ethdev/rte_ethdev.c > > @@ -5585,6 +5585,7 @@ eth_dev_handle_port_xstats(const char *cmd __rte_unused, > > for (i = 0; i < num_xstats; i++) > > rte_tel_data_add_dict_u64(d, xstat_names[i].name, > > eth_xstats[i].value); > > + free(eth_xstats); > > return 0; > > } > > > > We need some minimal testing for telemetry commands. > > It could be a test automatically calling all available /ethdev/ > commands on a running testpmd. > This test could be really simple, not even checking what is returned. > It would just try every command sequentially with no parameter first, > then with port 0 and finally with port 1. > That seems reasonable. However, I'd go a little further and have all available commands called as an initial sanity check. Then we can use some heuristics to go further, with the *dev/stats commands or xstats commands all being called with numeric parameters as you suggest. /Bruce