From patchwork Sun Aug 11 06:58:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Kudurumalla X-Patchwork-Id: 143062 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B1C7545791; Sun, 11 Aug 2024 08:58:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92D7B4028B; Sun, 11 Aug 2024 08:58:31 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 0E92A400D7; Sun, 11 Aug 2024 08:58:29 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47B5SIPM009227; Sat, 10 Aug 2024 23:58:27 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=W 6ScyMrUeJSTkg2JMflp+l8+2lPD46VYM/82n1rM3VE=; b=X6PlooiwxVs3+IdNl Tao3wXVQmhElvJ7riEj6fn3X7U79kDaiUnd2lZ5E26qwedlyzu6uU4dGZ0GPpdUh WNhdP3uVAOoZ54ENNAgAdZunHRgeve1vJXzRq+mPpyJo2iGB1HBnjoZpTxiMF8Ey hS5inA1KLLEhxDSEUFP7wU/GXrOYaGnwCm+f+OV+NifaS1n+gdlnwV/uC5EfJDCr aUcU3DMSQMvpX9pkY+8WM4Eadvm3tj4Vv9WfY7hLQVDt1LanLE8PrT3lelt3G02/ 4bM6q1863aMXiVSAQ3s/2C423h2xujll2ImhFIEYf3Mv8ZLIPvau6DXlBAv5KOoj 7PbCw== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 40xq5wg4fp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 10 Aug 2024 23:58:27 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sat, 10 Aug 2024 23:58:26 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Sat, 10 Aug 2024 23:58:26 -0700 Received: from localhost.localdomain (unknown [10.28.36.154]) by maili.marvell.com (Postfix) with ESMTP id 304E33F7050; Sat, 10 Aug 2024 23:58:22 -0700 (PDT) From: Rakesh Kudurumalla To: , , , monjalon.net@mx0b-0016f401.pphosted.com CC: , , , "Rakesh Kudurumalla" , Subject: [PATCH v4 1/1] examples/l2fwd-jobstats: fix lock availability Date: Sun, 11 Aug 2024 12:28:19 +0530 Message-ID: <20240811065819.575759-1-rkudurumalla@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240730100335.3734796-1-rkudurumalla@marvell.com> References: <20240730100335.3734796-1-rkudurumalla@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 9sa0x_Uf64dHhYnFUtQnR5VdsbN4TABI X-Proofpoint-ORIG-GUID: 9sa0x_Uf64dHhYnFUtQnR5VdsbN4TABI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-11_05,2024-08-07_01,2024-05-17_01 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 Race condition between jobstats and time metrics for forwading and flushing is maintained using spinlock. Timer metrics are not displayed properly due to the frequent unavailability of the lock.This patch fixes the issue by introducing a delay before acquiring the lock in the loop. This delay allows for betteravailability of the lock, ensuring that show_lcore_stats() can periodically update the statistics even when forwarding jobs are running. Fixes: 204896f8d66c ("examples/l2fwd-jobstats: add new example") Cc: stable@dpdk.org Signed-off-by: Rakesh Kudurumalla --- v4: Addressed cause of issue in commit message examples/l2fwd-jobstats/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 308b8edd20..7bb38b290f 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -542,7 +542,7 @@ l2fwd_main_loop(void) } while (likely(stats_read_pending == 0)); rte_spinlock_unlock(&qconf->lock); - rte_pause(); + rte_delay_us(10); } /* >8 End of minimize impact of stats reading. */ }