From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE7D8A052A; Fri, 10 Jul 2020 17:16:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DBF631D934; Fri, 10 Jul 2020 17:16:05 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 212981D92E for ; Fri, 10 Jul 2020 17:16:03 +0200 (CEST) IronPort-SDR: 8Om8eb5zt8QJ0G82QUUYAoR2MMCUlDLeiZVOGCkfjkL/o0z+FTYeDxJU4iVYV4NgIBW/YSpap7 0NADPlO6udbg== X-IronPort-AV: E=McAfee;i="6000,8403,9678"; a="209746667" X-IronPort-AV: E=Sophos;i="5.75,336,1589266800"; d="scan'208";a="209746667" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2020 08:16:02 -0700 IronPort-SDR: TUb7ndi4I3IrH0AlBxndXJqYsKp6UZFLeiEcPe6noq6dA91ErpU1sUPyvJoSR0FF6TslRAiLOP th6A3/Sz1tzg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,336,1589266800"; d="scan'208";a="269111919" Received: from orsmsx107.amr.corp.intel.com ([10.22.240.5]) by fmsmga008.fm.intel.com with ESMTP; 10 Jul 2020 08:16:01 -0700 Received: from orsmsx153.amr.corp.intel.com (10.22.226.247) by ORSMSX107.amr.corp.intel.com (10.22.240.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 10 Jul 2020 08:15:27 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by ORSMSX153.amr.corp.intel.com (10.22.226.247) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 10 Jul 2020 08:15:27 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.101) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 10 Jul 2020 08:15:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZzPPCQIN7Bca+4YpZg5YcC/PMkXHwTXFQuVpUiOzt03EpOUiUF8uUE1QQHXJQyb1oqPyjXH347JGdBwDKRu8g2xXgjQ9beZSaehvNiTX/cM2OjthNFuToHIiwTG8It0If0fVocmz7kuiz/nrScAG1n/BVpusGCkf2bzApVjaOQP4Ggdu1P1IYPueuH3TTMpxR5DaZ4TCWi3ea0ro/iJeVjioDwR1pOjbcQWhT0jGph8tcVvRWkhvGZhOlRtoodxiKcL901RG2o2mi/+w+QdxcmZFuRqpqcFIF8Bh3XH21r1dMFkjxVHiuKpVcGMrKNLWrYN212fpgkPpe+cSYoMcDA== 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-SenderADCheck; bh=Dde253tAiZN/cCsBoJPv1sWo/svq129pcfDTmqAOr/Q=; b=KRuVEanHu3Bl4NTIlDZtF6ZJScrE4wZPNXMmRwH8/HBtsJ7Pc6HKK/LqeQ+yC+skKrJBNLO25Iu0ZHgINutmwIELxj5mCvFTOo4IFZFizfWmYxfkw0rVyDPKv+fXcykLkfzMTzPPufVUlPY+g8FGhBzDXDsZDT4HcTon6wvMSpCgIFBwWmiFvZgqtQ0/DFFxeOGTg0mn0+LSHLw1hhIajupehqYzCYSiPGIw3pvxVumOHjLCJVsY98CRiR4PBle6Yt8q3Nlzc7gq9yGRXepRifBYrKl7vkrdjI29TSD2QHS+1lOCNrDpt8KqYmjJexm9K1ZrD5PeYAoDKD6L6Py6lA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Dde253tAiZN/cCsBoJPv1sWo/svq129pcfDTmqAOr/Q=; b=Xe2veZhX5/w3cGKclCCIbfJpNeE7RBzyzKFtJ+Rg44HhNLT6+IQaQZN+vV3CV+9bXsv6d+fKhYU1tfaNaQNq1xnZJ1n7xcu6AvLitrL8nJ4KAQbrrm2p//Ap8TBg4bc99WFpEU+KE1Uh0yjup+1WUuek5VVtdcpfaXlLsKCLrUc= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BY5PR11MB3975.namprd11.prod.outlook.com (2603:10b6:a03:184::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.20; Fri, 10 Jul 2020 15:15:12 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f160:29ab:b8f9:4189]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f160:29ab:b8f9:4189%6]) with mapi id 15.20.3174.023; Fri, 10 Jul 2020 15:15:12 +0000 From: "Ananyev, Konstantin" To: Olivier Matz CC: "dev@dpdk.org" , "arybchenko@solarflare.com" , "jielong.zjl@antfin.com" , "Eads, Gage" Thread-Topic: [PATCH v2] mempool/ring: add support for new ring sync modes Thread-Index: AQHWTi/h8GtyGouqIUabQ46ZzlWz+aj/fMmAgAAHuBCAAVEngIAAJyIg Date: Fri, 10 Jul 2020 15:15:11 +0000 Message-ID: References: <20200521132027.28219-1-konstantin.ananyev@intel.com> <20200629161024.29059-1-konstantin.ananyev@intel.com> <20200709161829.GV5869@platinum> <20200710125249.GZ5869@platinum> In-Reply-To: <20200710125249.GZ5869@platinum> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiN2NkYmNmNDAtMjdhNy00NzhhLThiODItM2UwMDE3ZGY0MTU0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoieW1oODlPMXZhVW8xNDBWVnlzKzNMbWxVTXI1RHRYQU1tdEVxWVBMYnNkMlVGeWxETElobGNsMDhqMWxyenFIUSJ9 dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 x-ctpclassification: CTP_NT authentication-results: 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.151.177] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 731b2fd8-e14c-4dd8-fb3c-08d824e40a97 x-ms-traffictypediagnostic: BY5PR11MB3975: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vXJzhdwvQ7fb6O3U6dQ0Ivk/01RNgX8gTaylU0uMvnBT6vEl+MC8DmJgFw/0qnaij1789AbRg05XI2xW2AvAHVVnjQnZWBmDIMKdhVRN8MkSuahwDjKZgZdJ/k6RLRnbdvjIPE7BgfyqawO9MPMIOrdONgBUbyB26hB0mJY19TGtDcBMpGxhlfiL99eNbBv2d1szFNnQCpeayBkYR1eKoU4ETTyKalxFkFbQW4sERqnMSVKFzgS6hMO8aNe8Ki27yhZfKPGcEYFOGnTSWMEeeeM+7b59FnynT9CeNtzBgYT7YxM6ePTJazIWrOQVhJFylAR+KnSlnmkWOLPahUCFRA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3301.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(39860400002)(366004)(346002)(376002)(396003)(66476007)(52536014)(64756008)(66446008)(6916009)(26005)(66946007)(66556008)(8676002)(76116006)(83380400001)(186003)(86362001)(4326008)(6506007)(8936002)(71200400001)(54906003)(9686003)(478600001)(5660300002)(7696005)(33656002)(107886003)(55016002)(316002)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: cy0GVvx1xGU2QG2YnRRLmwq0TcO9O1ois90IFN4oSOkWlRffBBqH7LVEafQ90inDXtLV6L8vmOBmiGbpxO7vmvV6UNmUAeSF6x8P4ReM+rjJQzNdECPVZ7rXOqkteHl3ZGvqcbNayCKCdCJXFIk6n2oqVGscx9zSxTpTyGvlXPVghcHSGOaXHixSEoQgmZSQNiF19OnqFuHrWeZoqRQE+P5B2kB6XPnURrDGbK/e1puep+agMdmqyAZGuM1wHrOXl4JI2HdZxAkKzj5L0ysL5NG1WgRDpfHNa4H3i8A7vEKGm1sCO8nKkWjZIhSu+MhyOGF0ZykrOjoPDcjwfY+p3l4nwVZJ6cNRc0J5eUjaHXLN2zaKiSJWPe4dOp/25RU+ewI3xeowxoZObIRYNMJ6uBs7m/HevrRfDLqJbqHkUuUYyr4EF6A0BnqnePzzxaMz7Suho4fvY8u4PKQxtg0jAGZ+TjBTo6MgXIwZUUooly9bAkSOu4/Sm8o+iwKTuij5 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3301.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 731b2fd8-e14c-4dd8-fb3c-08d824e40a97 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jul 2020 15:15:11.9712 (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: HRAJF4WV6BxjGzRRjlLQHMRg/Oj2D/RSg8P8OTeUfBIqu6qEV/yrGf256DeNrchTZiA+65StNCM+Ef+Z25QthHv5PS/S5aVKbrjuX++VthA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB3975 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] mempool/ring: add support for new ring sync modes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Olivier, =20 > Hi Konstantin, >=20 > On Thu, Jul 09, 2020 at 05:55:30PM +0000, Ananyev, Konstantin wrote: > > Hi Olivier, > > > > > Hi Konstantin, > > > > > > On Mon, Jun 29, 2020 at 05:10:24PM +0100, Konstantin Ananyev wrote: > > > > v2: > > > > - update Release Notes (as per comments) > > > > > > > > Two new sync modes were introduced into rte_ring: > > > > relaxed tail sync (RTS) and head/tail sync (HTS). > > > > This change provides user with ability to select these > > > > modes for ring based mempool via mempool ops API. > > > > > > > > Signed-off-by: Konstantin Ananyev > > > > Acked-by: Gage Eads > > > > --- > > > > doc/guides/rel_notes/release_20_08.rst | 6 ++ > > > > drivers/mempool/ring/rte_mempool_ring.c | 97 +++++++++++++++++++++= +--- > > > > 2 files changed, 94 insertions(+), 9 deletions(-) > > > > > > > > diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/re= l_notes/release_20_08.rst > > > > index eaaf11c37..7bdcf3aac 100644 > > > > --- a/doc/guides/rel_notes/release_20_08.rst > > > > +++ b/doc/guides/rel_notes/release_20_08.rst > > > > @@ -84,6 +84,12 @@ New Features > > > > * Dump ``rte_flow`` memory consumption. > > > > * Measure packet per second forwarding. > > > > > > > > +* **Added support for new sync modes into mempool ring driver.** > > > > + > > > > + Added ability to select new ring synchronisation modes: > > > > + ``relaxed tail sync (ring_mt_rts)`` and ``head/tail sync (ring_m= t_hts)`` > > > > + via mempool ops API. > > > > + > > > > > > > > Removed Items > > > > ------------- > > > > diff --git a/drivers/mempool/ring/rte_mempool_ring.c b/drivers/memp= ool/ring/rte_mempool_ring.c > > > > index bc123fc52..15ec7dee7 100644 > > > > --- a/drivers/mempool/ring/rte_mempool_ring.c > > > > +++ b/drivers/mempool/ring/rte_mempool_ring.c > > > > @@ -25,6 +25,22 @@ common_ring_sp_enqueue(struct rte_mempool *mp, v= oid * const *obj_table, > > > > obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > } > > > > > > > > +static int > > > > +rts_ring_mp_enqueue(struct rte_mempool *mp, void * const *obj_tabl= e, > > > > + unsigned int n) > > > > +{ > > > > + return rte_ring_mp_rts_enqueue_bulk(mp->pool_data, > > > > + obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > +} > > > > + > > > > +static int > > > > +hts_ring_mp_enqueue(struct rte_mempool *mp, void * const *obj_tabl= e, > > > > + unsigned int n) > > > > +{ > > > > + return rte_ring_mp_hts_enqueue_bulk(mp->pool_data, > > > > + obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > +} > > > > + > > > > static int > > > > common_ring_mc_dequeue(struct rte_mempool *mp, void **obj_table, u= nsigned n) > > > > { > > > > @@ -39,17 +55,30 @@ common_ring_sc_dequeue(struct rte_mempool *mp, = void **obj_table, unsigned n) > > > > obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > } > > > > > > > > +static int > > > > +rts_ring_mc_dequeue(struct rte_mempool *mp, void **obj_table, unsi= gned int n) > > > > +{ > > > > + return rte_ring_mc_rts_dequeue_bulk(mp->pool_data, > > > > + obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > +} > > > > + > > > > +static int > > > > +hts_ring_mc_dequeue(struct rte_mempool *mp, void **obj_table, unsi= gned int n) > > > > +{ > > > > + return rte_ring_mc_hts_dequeue_bulk(mp->pool_data, > > > > + obj_table, n, NULL) =3D=3D 0 ? -ENOBUFS : 0; > > > > +} > > > > + > > > > static unsigned > > > > common_ring_get_count(const struct rte_mempool *mp) > > > > { > > > > return rte_ring_count(mp->pool_data); > > > > } > > > > > > > > - > > > > static int > > > > -common_ring_alloc(struct rte_mempool *mp) > > > > +ring_alloc(struct rte_mempool *mp, uint32_t rg_flags) > > > > { > > > > - int rg_flags =3D 0, ret; > > > > + int ret; > > > > char rg_name[RTE_RING_NAMESIZE]; > > > > struct rte_ring *r; > > > > > > > > @@ -60,12 +89,6 @@ common_ring_alloc(struct rte_mempool *mp) > > > > return -rte_errno; > > > > } > > > > > > > > - /* ring flags */ > > > > - if (mp->flags & MEMPOOL_F_SP_PUT) > > > > - rg_flags |=3D RING_F_SP_ENQ; > > > > - if (mp->flags & MEMPOOL_F_SC_GET) > > > > - rg_flags |=3D RING_F_SC_DEQ; > > > > - > > > > /* > > > > * Allocate the ring that will be used to store objects. > > > > * Ring functions will return appropriate errors if we are > > > > @@ -82,6 +105,40 @@ common_ring_alloc(struct rte_mempool *mp) > > > > return 0; > > > > } > > > > > > > > +static int > > > > +common_ring_alloc(struct rte_mempool *mp) > > > > +{ > > > > + uint32_t rg_flags; > > > > + > > > > + rg_flags =3D 0; > > > > > > Maybe it could go on the same line > > > > > > > + > > > > + /* ring flags */ > > > > > > Not sure we need to keep this comment > > > > > > > + if (mp->flags & MEMPOOL_F_SP_PUT) > > > > + rg_flags |=3D RING_F_SP_ENQ; > > > > + if (mp->flags & MEMPOOL_F_SC_GET) > > > > + rg_flags |=3D RING_F_SC_DEQ; > > > > + > > > > + return ring_alloc(mp, rg_flags); > > > > +} > > > > + > > > > +static int > > > > +rts_ring_alloc(struct rte_mempool *mp) > > > > +{ > > > > + if ((mp->flags & (MEMPOOL_F_SP_PUT | MEMPOOL_F_SC_GET)) !=3D 0) > > > > + return -EINVAL; > > > > > > Why do we need this? It is a problem to allow sc/sp in this mode (eve= n > > > if it's not optimal)? > > > > These new sync modes (RTS, HTS) are for MT. > > For SP/SC - there is simply no point to use MT sync modes. > > I suppose there are few choices: > > 1. Make F_SP_PUT/F_SC_GET flags silently override expected ops behaviou= r > > and create actual ring with ST sync mode for prod/cons. > > 2. Report an error. > > 3. Silently ignore these flags. > > > > As I can see for "ring_mp_mc" ops, we doing #1, > > while for "stack" we are doing #3. > > For RTS/HTS I chosoe #2, as it seems cleaner to me. > > Any thoughts from your side what preferable behaviour should be? >=20 > The F_SP_PUT/F_SC_GET are only used in rte_mempool_create() to select > the default ops among (ring_sp_sc, ring_mp_sc, ring_sp_mc, > ring_mp_mc).=20 As I understand, nothing prevents user from doing: mp =3D rte_mempool_create_empty(name, n, elt_size, cache_size, sizeof(struct rte_pktmbuf_pool_private), socket_id, 0); >I don't think we should look at it when using specific ops. >=20 > So I'll tend to say 3. is the correct thing to do. Ok, will resend v3 then. >=20 > > > > > > > > > + > > > > + return ring_alloc(mp, RING_F_MP_RTS_ENQ | RING_F_MC_RTS_DEQ); > > > > +} > > > > + > > > > +static int > > > > +hts_ring_alloc(struct rte_mempool *mp) > > > > +{ > > > > + if ((mp->flags & (MEMPOOL_F_SP_PUT | MEMPOOL_F_SC_GET)) !=3D 0) > > > > + return -EINVAL; > > > > + > > > > + return ring_alloc(mp, RING_F_MP_HTS_ENQ | RING_F_MC_HTS_DEQ); > > > > +} > > > > + > > > > static void > > > > common_ring_free(struct rte_mempool *mp) > > > > { > > > > @@ -130,7 +187,29 @@ static const struct rte_mempool_ops ops_sp_mc = =3D { > > > > .get_count =3D common_ring_get_count, > > > > }; > > > > > > > > +/* ops for mempool with ring in MT_RTS sync mode */ > > > > +static const struct rte_mempool_ops ops_mt_rts =3D { > > > > + .name =3D "ring_mt_rts", > > > > + .alloc =3D rts_ring_alloc, > > > > + .free =3D common_ring_free, > > > > + .enqueue =3D rts_ring_mp_enqueue, > > > > + .dequeue =3D rts_ring_mc_dequeue, > > > > + .get_count =3D common_ring_get_count, > > > > +}; > > > > + > > > > +/* ops for mempool with ring in MT_HTS sync mode */ > > > > +static const struct rte_mempool_ops ops_mt_hts =3D { > > > > + .name =3D "ring_mt_hts", > > > > + .alloc =3D hts_ring_alloc, > > > > + .free =3D common_ring_free, > > > > + .enqueue =3D hts_ring_mp_enqueue, > > > > + .dequeue =3D hts_ring_mc_dequeue, > > > > + .get_count =3D common_ring_get_count, > > > > +}; > > > > + > > > > MEMPOOL_REGISTER_OPS(ops_mp_mc); > > > > MEMPOOL_REGISTER_OPS(ops_sp_sc); > > > > MEMPOOL_REGISTER_OPS(ops_mp_sc); > > > > MEMPOOL_REGISTER_OPS(ops_sp_mc); > > > > +MEMPOOL_REGISTER_OPS(ops_mt_rts); > > > > +MEMPOOL_REGISTER_OPS(ops_mt_hts); > > > > > Not really related to your patch, but I think we need a function to > > > dump the name of available mempool ops. We could even add a descripti= on. > > > The problem we have is that a user does not know on which criteria is > > > should use a driver or another (except for platform drivers). > > > > Agree, it will be usefull. > > Though it probably subject for a separate patch. > >