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 EF60EA0542; Tue, 31 May 2022 10:33:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE261400EF; Tue, 31 May 2022 10:33:03 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 35FAC400D6 for ; Tue, 31 May 2022 10:33:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653985981; x=1685521981; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=qruZPuKk29aqckF8jSzh0QM40KkIOKJPQB+VmO+FLgg=; b=X7n/wzFV3IYolZzWhyHn0IOyLA8QqoxLfotf6MZ+Cn5LquqwDtbFs7Er pk/L+iWBuggiSU0Fs05plJVqO2R56sbiP+SJFo6F+T3znrToF3xEzzyGa CNw7vJUixqFsKndgnrOY5CezS+HMZ0msg0GSHkrNR6VKyebiboAB24hAu ajQ7B60WZqy9+xIxlpZL//w+0uMKSa6tVncZ2kjmd3KLtHIrqn0wel4Zl dHkygahMqlmwnUESjbDldoKKqTloP3r9Jb8ahrl5E/n3j7ifRXKLFU/tF jnVX3hh2y2+cH6iFstrUfv4viCRJVl3yc+xWkorFD+kHeGYvh5SilUp07 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10363"; a="361562400" X-IronPort-AV: E=Sophos;i="5.91,264,1647327600"; d="scan'208,217";a="361562400" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2022 01:32:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,264,1647327600"; d="scan'208,217";a="666826341" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by FMSMGA003.fm.intel.com with ESMTP; 31 May 2022 01:32:44 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Tue, 31 May 2022 01:32:43 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Tue, 31 May 2022 01:32:43 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Tue, 31 May 2022 01:32:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YdAqQqkfOiN54CcJDR8kipaGEEQ0QrGkSZMjzhHhQIOBpVoyaMAFQXeKptbMHdIVEau1ZlnjF5j7jAZwmZd1bmYc6GMvZz6WPhpvTlMsgZSh3oYwqJsP3nS9QxppgRXZCEwBaT0BJIivWDsgQhNpwsJ+a5rTOwmAqUvGsMmoFssdeOto2kohnQ4Aq5+5Ouue/qPKbh9PExN1AD/Sl3t1/Jgc/sUIEkIlhEY01aPer6gB9lkXkcNHwiPxjdyujmGpRCw8qaBjk694cxLYH1iLF13UVzE9rg5yWTOSQNjQiHfPmm0ThDT1Iq1I3NcoTu4KorAGXimK/6AcvzJ1ZLrpqw== 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=rMd23BFYq2dqUNttGT8QsxxWAxn/EkkryLQA0Shptw8=; b=fLEw6ZyK1iZWt9Z1ePh77NjqU+BFY7aXoAGH6ZZRJ7sxWIm+HOc288MtIqkYiXbaSS9VSK+qruF3q9aFKjcKNxMpjf6Xp1cRJOq+BLr1iTmDsUWEekLUpTtt/OMzjRUv3DFHi91RzPtOiOaIVMmPrTGaiGLPJlAicTAYMUX3DWCtaqbnXL3uRodJEw9C/lfx3q6jyHTVdkzVFkd8Cy4DHoy4hPvKKQSMCK5D3VCMmWFJM6jEVO+JHMPUiXH8RZ+KG2COYKPOP/Yuzzqa0v9nxF3eeZ5bhjjZNP4Ue7NMjAHmK466vEH1+n6XbQjBXCkPpK6K3yPWXB/dT6utaI9y8w== 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 Received: from DM6PR11MB3868.namprd11.prod.outlook.com (2603:10b6:5:19f::13) by PH0PR11MB4917.namprd11.prod.outlook.com (2603:10b6:510:32::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Tue, 31 May 2022 08:32:39 +0000 Received: from DM6PR11MB3868.namprd11.prod.outlook.com ([fe80::3d91:62dc:c665:9083]) by DM6PR11MB3868.namprd11.prod.outlook.com ([fe80::3d91:62dc:c665:9083%6]) with mapi id 15.20.5293.019; Tue, 31 May 2022 08:32:38 +0000 From: "Naga Harish K, S V" To: "ferruh.yigit@xilinx.com" , "Yigit, Ferruh" , "thomas@monjalon.net" CC: "Jayatheerthan, Jay" , "dev@dpdk.org" Subject: Re: [PATCH v4] kni: optimize alloc queue release Thread-Topic: [PATCH v4] kni: optimize alloc queue release Thread-Index: AQHYUCX53W80CBV8zE2SOIxXRjOg6q048KVY Date: Tue, 31 May 2022 08:32:38 +0000 Message-ID: References: <20220413054856.3054752-1-s.v.naga.harish.k@intel.com> <20220414173504.771998-1-s.v.naga.harish.k@intel.com> In-Reply-To: <20220414173504.771998-1-s.v.naga.harish.k@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: 90b8c874-fdef-59f7-f7cb-ecde54cef07a authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a03ad840-9e6a-453e-7df5-08da42e01f28 x-ms-traffictypediagnostic: PH0PR11MB4917:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rwwGJsyosZdhYqIN4KyUyp2qLsdbfG26WUQNSC57ejeG7/d1KrR3rHj4y0NnRVrInZWNt6pOJDCRxXb5/sWMP7L5PaGpBNbBRbB7XinWXUBxRO6DemVXLmfH2VTaiiNUg1fDz9DiJ04G6cFQvVFtQuZZ+7zFSCu0rqLp9LGMHGNA7p/Xg/A4vWcoW302G7qrJe91PvhZmIYutuHg6ZGJei4lBj5V7LIYcXltISeand5q7njnyUvKF8B/duGEK6Zea43Rgx2mqOVCoyESsk8E8poJ/oiN2yT8AiOUS37pgAcNWie0HWaKa4SBF+Af9tOKFkzhIlTx5YzxvdeE1/78qCgNs5orIxT4CKyAlPYm/Emyebz0EvCZHa1qSBQ8lA8jdQUR9iKTRdIYtiMUIb4JudummlD55+rTWagNZH9wZMDOcRfligSXN1JvzLhfMj+7Vujs33Sxm4cN+FuFWyyhlDackmDiBkarGenxFuvybgROyuKfKEo1xeG1GCnSgL7b5m348Ovz5OefUYFuBOm858dxpnCbMh1v/Q64U7iiI5mCUK6xW8gmMcPextAOnogDOHMpiLJEh8Mtcv0i1d8E0Rq7SVekosEiIxa+IoO+l4UGkFvuODkI6erAOOxzCch6q3lP5ZC9CHaL5bmz/E70S+5Z4hL7OiAbiILesf7ZBDDgP+BikJNyQwwBY/T8TRxD36TXl63ApahMmgr85bX4cQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3868.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(53546011)(54906003)(110136005)(9686003)(2906002)(316002)(26005)(7696005)(6506007)(19627405001)(122000001)(8936002)(38070700005)(83380400001)(55016003)(82960400001)(86362001)(52536014)(4326008)(66946007)(38100700002)(5660300002)(64756008)(66556008)(66476007)(76116006)(66446008)(8676002)(91956017)(508600001)(33656002)(71200400001)(186003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0SUv9m13KD9dskHjlxbhnTYPN0BD5gXoGfT7Vq324XJ1mkNG9rMJMz/8RJP7?= =?us-ascii?Q?kCFpSbsKwKb27NtILKjkhpoAoh+1v9EYILVHRjKt2K3quXKFCdypVu4/Io3z?= =?us-ascii?Q?GC8NiIOMK6SuGcCLqWrwGJ6PamAD4YeOrBlnWeDxbkYc5DHJrPODx8fKeg84?= =?us-ascii?Q?FE/miLb/XXG2uUjrxSRk0Tlr6x9cFP/Zus/aPFf4G9QVf2wIoEW/0XI+M+9Y?= =?us-ascii?Q?80j2QQPSCs/aDxR7iEElgrHdvzIB+OJtG4BxcRiX1/Z7dm/KYWyYLhYM+qko?= =?us-ascii?Q?iknCndECwm2KcUQ7iptkX0ss7xvoIJXTwzHmyO75qD39UZfiiSBh+euoq5kU?= =?us-ascii?Q?s03MdpZN08sm/DlhQUNp06S+BH6rNehtOc13/deDKPhbL0jaoe4O5VWce3XP?= =?us-ascii?Q?MRlr78j9Mtx8chxP0NuV/alG8AAYP+CkOeuUu6c7cdAyykUNRFwPNrF/FMyY?= =?us-ascii?Q?4yWv2lpOIZ7+nD7TCohuDLoYcuCWu46V5dwkUPvJx+7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GSITk6ClbUI0gLhebhVL2Ro2L5+ek1Hz/tlgoosd9LuVRckWEB3EzCE?= =?us-ascii?Q?eqa9eP15FBoEo5UQy1elFXJtG531GFluqDLvu52gB/7c+svPIOuvAbkOe7Wj?= =?us-ascii?Q?ISTMuWBzl1SIG/7A0b3U2NJr2bvMHpuHOnR06OJMdTUmWyJmpL/jmvIAe94s?= =?us-ascii?Q?3Gmj8g0WfZ1uymhqsxiSVdx9Qi4yl1ca9OlHTIsa9TbKH0OYJTuqTMta8f9i?= =?us-ascii?Q?HHr2X1ID/hz67S+I91ps2GFKt/6KV1kvXxB+XnH2JVKkg1AyIRyVZ0L5n+P9?= =?us-ascii?Q?9k6lsYeZjvuC+fo8q+gDchO5KuLDDBnE1FMRVM05DnMpCOFpIxfbal3uQpA0?= =?us-ascii?Q?zCLXZ1Wx+w=3D=3D?= Content-Type: multipart/alternative; boundary="_000_DM6PR11MB386850C0B468F4286DFD1792A1DC9DM6PR11MB3868namp_" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB3868.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a03ad840-9e6a-453e-7df5-08da42e01f28 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 May 2022 08:32:38.9045 (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: b7KNiabG2T30E8I28UNOJ5BwCIjL8YLPC8fM2YbUOd/oyO39rKlKsZloL3jKzhlNCjXiZXa9d7Hm/4h1R+lvgkMK68IbyzNC1+qE4I1nuwY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4917 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 --_000_DM6PR11MB386850C0B468F4286DFD1792A1DC9DM6PR11MB3868namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi all, Looks like this patch is out there for review for quite some time. Can somebody review this patch? -Harish ________________________________ From: Naga Harish K S V Sent: Thursday, April 14, 2022 11:05 PM To: ferruh.yigit@xilinx.com ; Yigit, Ferruh Cc: Jayatheerthan, Jay ; dev@dpdk.org Subject: [PATCH v4] kni: optimize alloc queue release The kni alloc queue is filled with physical addresses of mbufs for kernel consumption. Any unused mbufs in the alloc queue are freed during shutdown sequence in rte_kni_release. In the existing implementation, for freeing one entry of alloc queue all the objects of the mempool are traversed to find a match. This process is repeated for all the objects of the alloc queue which consumes lot of cpu cycles. Instead of using mempool object iteration method,use ``rte_mem_iova2virt()`` api to get the virtual address for the physical addresses of alloc_q objects. This speeds up the freeing process. Signed-off-by: Naga Harish K S V --- v2: * fix checkpatch errors v3: * fix commit message as per review comments v4: * update commit message as per review comments --- lib/kni/rte_kni.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c index 7971c56bb4..f443e5b2fc 100644 --- a/lib/kni/rte_kni.c +++ b/lib/kni/rte_kni.c @@ -375,26 +375,19 @@ va2pa_all(struct rte_mbuf *mbuf) } static void -obj_free(struct rte_mempool *mp __rte_unused, void *opaque, void *obj, - unsigned obj_idx __rte_unused) -{ - struct rte_mbuf *m =3D obj; - void *mbuf_phys =3D opaque; - - if (va2pa(m) =3D=3D mbuf_phys) - rte_pktmbuf_free(m); -} - -static void -kni_free_fifo_phy(struct rte_mempool *mp, struct rte_kni_fifo *fifo) +kni_free_fifo_phy(struct rte_kni_fifo *fifo) { void *mbuf_phys; int ret; + struct rte_mbuf *m; do { ret =3D kni_fifo_get(fifo, &mbuf_phys, 1); - if (ret) - rte_mempool_obj_iter(mp, obj_free, mbuf_phys); + if (ret) { + m =3D (struct rte_mbuf *) + rte_mem_iova2virt((rte_iova_t)mbuf_phys); + rte_pktmbuf_free(m); + } } while (ret); } @@ -440,7 +433,7 @@ rte_kni_release(struct rte_kni *kni) if (kni_fifo_count(kni->rx_q)) RTE_LOG(ERR, KNI, "Fail to free all Rx-q items\n"); - kni_free_fifo_phy(kni->pktmbuf_pool, kni->alloc_q); + kni_free_fifo_phy(kni->alloc_q); kni_free_fifo(kni->tx_q); kni_free_fifo(kni->free_q); -- 2.23.0 --_000_DM6PR11MB386850C0B468F4286DFD1792A1DC9DM6PR11MB3868namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hi all,
  Looks like this patch is out there for review for quite some time.
Can somebody review this patch?

-Harish

From: Naga Harish K S V <= ;s.v.naga.harish.k@intel.com>
Sent: Thursday, April 14, 2022 11:05 PM
To: ferruh.yigit@xilinx.com <ferruh.yigit@xilinx.com>; Yigit, = Ferruh <ferruh.yigit@intel.com>
Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; dev@dpdk= .org <dev@dpdk.org>
Subject: [PATCH v4] kni: optimize alloc queue release
 
The kni alloc queue is filled with physical addres= ses of mbufs
for kernel consumption. Any unused mbufs in the alloc queue are
freed during shutdown sequence in rte_kni_release.

In the existing implementation, for freeing one entry of alloc
queue all the objects of the mempool are traversed to find
a match. This process is repeated for all the objects of the
alloc queue which consumes lot of cpu cycles.

Instead of using mempool object iteration method,use
``rte_mem_iova2virt()`` api to get the virtual address
for the physical addresses of alloc_q objects.
This speeds up the freeing process.

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
v2:
* fix checkpatch errors

v3:
* fix commit message as per review comments

v4:
* update commit message as per review comments
---
 lib/kni/rte_kni.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c
index 7971c56bb4..f443e5b2fc 100644
--- a/lib/kni/rte_kni.c
+++ b/lib/kni/rte_kni.c
@@ -375,26 +375,19 @@ va2pa_all(struct rte_mbuf *mbuf)
 }
 
 static void
-obj_free(struct rte_mempool *mp __rte_unused, void *opaque, void *obj,
-            &n= bsp;  unsigned obj_idx __rte_unused)
-{
-       struct rte_mbuf *m =3D obj;
-       void *mbuf_phys =3D opaque;
-
-       if (va2pa(m) =3D=3D mbuf_phys)
-            &n= bsp;  rte_pktmbuf_free(m);
-}
-
-static void
-kni_free_fifo_phy(struct rte_mempool *mp, struct rte_kni_fifo *fifo)
+kni_free_fifo_phy(struct rte_kni_fifo *fifo)
 {
         void *mbuf_phys;
         int ret;
+       struct rte_mbuf *m;
 
         do {
            &nb= sp;    ret =3D kni_fifo_get(fifo, &mbuf_phys, 1);
-            &n= bsp;  if (ret)
-            &n= bsp;          rte_mempool_obj_= iter(mp, obj_free, mbuf_phys);
+            &n= bsp;  if (ret) {
+            &n= bsp;          m =3D (struct rt= e_mbuf *)
+            &n= bsp;            = ;      rte_mem_iova2virt((rte_iova_t)mbuf_phys); +            &n= bsp;          rte_pktmbuf_free= (m);
+            &n= bsp;  }
         } while (ret);
 }
 
@@ -440,7 +433,7 @@ rte_kni_release(struct rte_kni *kni)
         if (kni_fifo_count(kni->= ;rx_q))
            &nb= sp;    RTE_LOG(ERR, KNI, "Fail to free all Rx-q items\n= ");
 
-       kni_free_fifo_phy(kni->pktmbuf_poo= l, kni->alloc_q);
+       kni_free_fifo_phy(kni->alloc_q);          kni_free_fifo(kni->tx_q= );
         kni_free_fifo(kni->free= _q);
 
--
2.23.0

--_000_DM6PR11MB386850C0B468F4286DFD1792A1DC9DM6PR11MB3868namp_--