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 98403A00C2; Fri, 6 Jan 2023 17:08:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 37A6940141; Fri, 6 Jan 2023 17:08:24 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 36A99400EF for ; Fri, 6 Jan 2023 17:08:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673021302; x=1704557302; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=40K1fAh9trzeX1v94QhNjGof/i8kq2W3dMOLOoLMpQE=; b=XYVOSnAvimMGro6vpxZUHj9rQMcIf7aJS0lk/viIRRHn5FCN88h0Qf3d iGViIk76/IKpgmZwZJpqJv6nKEqvj2LxQK72U60rV7nlNZ5Gc1qCwJ9l5 T2oUbu4vPLAdVBmYE662SfQA1rBSJz+VRU+yaAB/R0a1Nubf34BKzFQGX O/HMbf6MY22zbsFUy/I2dLjTd/oxRBSXcfuXdIPc2UFRc3vzkRZNIspJR saGg8lqeoxJnqFI8gD+v9LXzZi4Rv3ha0OJUpq3W3RyjRAfWvGPBFCgwS 8q+TYswr6rmnxd09KmB69EBYpgMLUIQA0ymuC/n1gkuih56NPmsbrmA4V g==; X-IronPort-AV: E=McAfee;i="6500,9779,10582"; a="384804201" X-IronPort-AV: E=Sophos;i="5.96,305,1665471600"; d="scan'208";a="384804201" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2023 08:08:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10582"; a="901324424" X-IronPort-AV: E=Sophos;i="5.96,305,1665471600"; d="scan'208";a="901324424" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga006.fm.intel.com with ESMTP; 06 Jan 2023 08:07:54 -0800 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 6 Jan 2023 08:07:54 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Fri, 6 Jan 2023 08:07:54 -0800 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.44) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Fri, 6 Jan 2023 08:07:53 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jqA3pHDFPkgEnhVnUhIQHHRQU49w9e0d9DLs8fSBJmwXaOUhApu8bG9IR17SKvMTYgoiZLZ5Gp8hgAIQz1JVP1b7VF+tJTXYa0u0vUYgHabDRDAc0PXgebAHcdjrz6MoNX3rCoRZ3zf+Ji2Vl3DHPE0+BBIE2fDpcNDU96/FsV+9nqD5rZqSSkNMR0O8rAbXjXtHqdNaPYIconxb2MZ2Z695sRZy9dC9ywWXAlJ2Ta2zMzh1Tkn4wSIjSWcZqKIp/Ybj2OnEL0dvpmeemHeXREOeRf035B5jDUExGaQNhwBn4NDvJAe8GfTFlvsKfqDrOhqElN+WkxKpwk4k7xskig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=j3qznbu4Q1GflQTbCkUo58T9U9I79O0LRxl/6le+5YQ=; b=INxIO0GBb7vdTn9OVOChMPGDiSMEqChiyyojHh2YASTCx9TKBfCn2tkC1z/Xtk2yvcuQN2Sh16byuSkGoQAxA/iUc5PVFV22Qv/DxNF+Etc9cl7/MlaliS1UQ7tJ8IaC87n3caBahiAnmQmhkJukjdTol6tGwuzg70nMKhlQHAPg8rj59Bz3qlVhJw+1zlKKKBMQFFYGKDtxIwFNQxt9m9e4ktj4veyvoyiftMwMiy9qgNcw+JeOsEWLy1B4ogSCsQ5hcOLv8g1h5KU+g/7t/j8kkXWL1g7lTFTUcc2fqpd4GET2W/uY+7ZyFh0lmqHBVSf0eCQNP3pUZUqVA4Og9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by DS7PR11MB6200.namprd11.prod.outlook.com (2603:10b6:8:98::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 16:07:51 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4d9f:6867:2d53:9ee]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4d9f:6867:2d53:9ee%7]) with mapi id 15.20.5944.019; Fri, 6 Jan 2023 16:07:51 +0000 Date: Fri, 6 Jan 2023 16:07:45 +0000 From: Bruce Richardson To: fengchengwen CC: , , , , , Subject: Re: [PATCH v5 2/5] telemetry: fix repeated display when callback don't set dict Message-ID: References: <20221219090723.29356-1-fengchengwen@huawei.com> <20221219090723.29356-3-fengchengwen@huawei.com> <82dd43d3-661f-64dc-8ce0-a7b6b2a62d79@huawei.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <82dd43d3-661f-64dc-8ce0-a7b6b2a62d79@huawei.com> X-ClientProxiedBy: LO4P123CA0063.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::14) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|DS7PR11MB6200:EE_ X-MS-Office365-Filtering-Correlation-Id: d8774f79-c156-4a74-ac08-08daf000298c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E91fMSmGl0r070xXnBperHDXu0DCXqyLp6yHYNzfSdUJ8s49V7XSGg3MMDAhU1iKd6Q2TSjftufx+j6OoWieW4XswETdtRxjCwr6+dA7DXGQgYsDMt0VJ78LgddS6gBXiR/LIebOwfTUt8jY3z8cCGh+liID5ql0IKpJfm19Ff0BlcdYByv4ujQ84WPb4UpmhgPe40AqWYpwc5mhACswSOHARvsRxI66bCthGRe/BLq+HiKpSdpgUd1xMOBkbhGMOaVd3/nQjepuzoXBJ13JFdGOdL1lQ4z/IDFLi+U/pKKOUkmPASH9QD/yVx1d1CZJqpJfnmLy+z6nWss2ghlvAzf2tU+4aCl769xahqv3zugq7R3IXk78gUgPd3cvRgwqZ/H2FmxdC3wlA6h8raIIal/jeipWQZZdxYVusLkPzfFN2KgihYSbw0KF8aObnQuokDH3SfAdmUdzwerkkR5cXLfaksLRPWZs2q1uf25f6RFRHdrSriVD7vUi8VYWtThVLZWozY1VrHr/ts60rnXLSZqx7zLv8Vf1FivOnG+E+tr6n03POJLCVwMTY5FOG6z7gfXcRmq/GcymkLKxEHTAfp4Ij6DYq007Bmr1SuRHwFPegV3dCZDyjGg7vE/Js7/M+NCAKxqDhjloWOjWybgF0g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(346002)(136003)(376002)(366004)(39860400002)(396003)(451199015)(186003)(82960400001)(26005)(6512007)(86362001)(38100700002)(44832011)(107886003)(2906002)(6916009)(8676002)(4326008)(66946007)(41300700001)(5660300002)(316002)(8936002)(6666004)(66476007)(478600001)(6486002)(53546011)(66556008)(6506007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?aKJqXT3/5oLtiZ4f5TNFcQ1Rwfw3T5uVV6Cswye17N1GYDX4566KGKE46qel?= =?us-ascii?Q?ZbYanQ64OSWrcOD9iRYzwpnj5TikDqtpFL6MB/ruBgS1DWhFUNk/ixLbdNb0?= =?us-ascii?Q?s95IFX5XJsmI0PIFNxALmql9dCcA+RtkGXeuFFxzzMX+gnNV3OphV/eTkqAl?= =?us-ascii?Q?7TUSqMLko0DPiiUB/3f8gSKndk7171P7qlHABZ9wKab8KQaNZOsjJvV1DfH4?= =?us-ascii?Q?r8Cih9ZOJZAwcLZY5CmVk4uvjJ3pHyw1igSMZ8KJgsmL1Wpa0DrPKSLYJ51n?= =?us-ascii?Q?LLjSiaOtrH3zDNQqWoFZZbRuzDPUsTXaguLgzlGluh1srjK1QHMWJ/CWSsYQ?= =?us-ascii?Q?yig2nbrOpb+SeJJWtXBsdfuhcazLh+RYpDfO0G/DAL9ZV4MYQs0VoCep5+kf?= =?us-ascii?Q?l6VvrH6gnqVfP27s1PPYxnOLLx2KeIKl6FWoE1TFdgylZ7Wfb4yoX4sgH4fD?= =?us-ascii?Q?i84Wbf714Xl28ZoyKd41rBV3s04QXmDOMu+VgmCKkqhlyRearmsuLLeRxa0Y?=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BAU2RvzHwZYwyGPR?= =?us-ascii?Q?lQH1uZenYw6J2hLM/n2SyZoQV08Rgsory8MKExlyWwq2t53vOY+ItGLEjF1F?= =?us-ascii?Q?uHrCLrLRM38WtZHLdhWDq+xkxZJZUjEWaZ1I5MHWKicUq8YcSuh/9j4JmCQM?= =?us-ascii?Q?eHROh9umGL65TKciIeruh86denlHX5oZ3uUlfYVsMzyTf8s80VxPL1w9dyLL?= =?us-ascii?Q?gw=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: d8774f79-c156-4a74-ac08-08daf000298c X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2023 16:07:51.5347 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Z0T1e+y89zREM0ZkQQ3T6uLK+ygj6f8BD2/XCDnz233gr11Nmma8CSEJsxlxsdctHObvK4usswj8FochJcDrhZ4S89E3zpa8EJHzyvH6mLQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB6200 X-OriginatorOrg: intel.com 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 Mon, Dec 26, 2022 at 12:53:57PM +0800, fengchengwen wrote: > On 2022/12/19 17:33, Bruce Richardson wrote: > > On Mon, Dec 19, 2022 at 09:07:20AM +0000, Chengwen Feng wrote: > >> When telemetry callback didn't set dict and return a non-negative > >> number, the telemetry will repeat to display the last result. > >> > >> Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality") > >> Cc: stable@dpdk.org > >> > >> Signed-off-by: Chengwen Feng > >> --- > > > > Hi Chengwen, > > > > I'm a little curious about this bug. Can you describe some steps to > > reproduce it as I'm curious as to exactly what is happening. The fix seems > > a little strange to me so I'd like to investigate a little more to see if > > other approaches might work. > > Hi Bruce, > > Sorry for late reply. > > The steps: > 1. applay "[PATCH v5 1/5] dmadev: support stats reset telemetry command" > 2. compile > 3. start dpdk-dma: dpdk-dma -a DMA.BDF -a NIC.BDF -- -c hw > 4. start telemetry, and execute /dmadev/stats,0, and then /dmadev/stats_reset,0 > the output of /dmadev/stats_reset,0 will be the same of previous cmd "/dmadev/stats,0" > e.g. my environment: > --> /dmadev/stats,0 > { > "/dmadev/stats": { > "submitted": 23, > "completed": 23, > "errors": 0 > } > } > --> /dmadev/stats_reset,0 > { > "/dmadev/stats_reset": { > "submitted": 23, > "completed": 23, > "errors": 0 > } > } > > The rootcause is that the /dmadev/stats_reset don't set the outer parameter "struct rte_tel_data *info" > and return zero. > Thanks for the fuller explanation, I'll hopefully test it out myself. However, in the meantime, looking at the telemetry library code, would the following change work rather than explicitly always setting the telemetry data to a dictionary by default? Zeroing the data by default sets it to a null return which is what you probably want as default rather than an empty dictionary. (And it's also a smaller diff) /Bruce diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index 8fbb4f3060..7b905355cd 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -333,7 +333,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) static void perform_command(telemetry_cb fn, const char *cmd, const char *param, int s) { - struct rte_tel_data data; + struct rte_tel_data data = {0}; int ret = fn(cmd, param, &data); if (ret < 0) {