From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 7C2A11B233 for ; Wed, 10 Jan 2018 17:53:58 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2018 08:53:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,341,1511856000"; d="scan'208";a="165707604" Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28]) by orsmga004.jf.intel.com with ESMTP; 10 Jan 2018 08:53:55 -0800 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by irsmsx105.ger.corp.intel.com (163.33.3.28) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 10 Jan 2018 16:53:55 +0000 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.180]) by irsmsx112.ger.corp.intel.com ([169.254.1.12]) with mapi id 14.03.0319.002; Wed, 10 Jan 2018 16:53:54 +0000 From: "Van Haaren, Harry" To: "Van Haaren, Harry" , Pavan Nikhilesh , "jerin.jacob@caviumnetworks.com" , "santosh.shukla@caviumnetworks.com" , "Eads, Gage" , "hemant.agrawal@nxp.com" , "nipun.gupta@nxp.com" , "Ma, Liang J" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 09/12] app/eventdev: add pipeline queue worker functions Thread-Index: AQHTiiK5mRtKbCy3BUu0FF77R8OT8aNtTtvggAACt5A= Date: Wed, 10 Jan 2018 16:53:53 +0000 Message-ID: References: <20171130072406.15605-1-pbhagavatula@caviumnetworks.com> <20180110145144.28403-1-pbhagavatula@caviumnetworks.com> <20180110145144.28403-9-pbhagavatula@caviumnetworks.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWZmMGNmZjItZTliYi00YmI5LWI2YmYtNzRiOTdiMTJlYWMzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Ink3MWRuWWx3b3RKNDFnMFdkY2xaMVwvZjErczhJeHBieU40U1plamVkZHZjPSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 09/12] app/eventdev: add pipeline queue worker functions 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: , X-List-Received-Date: Wed, 10 Jan 2018 16:53:58 -0000 Replying to self... > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Van Haaren, Harry > Sent: Wednesday, January 10, 2018 4:45 PM > To: Pavan Nikhilesh ; > jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; Eads, > Gage ; hemant.agrawal@nxp.com; nipun.gupta@nxp.com; = Ma, > Liang J > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v3 09/12] app/eventdev: add pipeline queue > worker functions >=20 > > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com] > > Sent: Wednesday, January 10, 2018 2:52 PM > > To: jerin.jacob@caviumnetworks.com; santosh.shukla@caviumnetworks.com; = Van > > Haaren, Harry ; Eads, Gage > > ; hemant.agrawal@nxp.com; nipun.gupta@nxp.com; Ma, > > Liang J > > Cc: dev@dpdk.org; Pavan Nikhilesh > > Subject: [dpdk-dev] [PATCH v3 09/12] app/eventdev: add pipeline queue > worker > > functions > > >=20 > >=20 >=20 > > +static __rte_always_inline void > > +pipeline_tx_pkt_safe(struct rte_mbuf *mbuf) > > +{ > > + while (rte_eth_tx_burst(mbuf->port, 0, &mbuf, 1) !=3D 1) > > + rte_pause(); > > +} >=20 > re safe, see comment below >=20 > > + > > +static __rte_always_inline void > > +pipeline_tx_pkt_unsafe(struct rte_mbuf *mbuf, struct test_pipeline *t) > > +{ > > + rte_spinlock_t *lk =3D &t->tx_lk[mbuf->port]; > > + > > + rte_spinlock_lock(lk); > > + pipeline_tx_pkt_safe(mbuf); > > + rte_spinlock_unlock(lk); > > +} >=20 > IIRC usually the "Safe" version of a function has extra locks/protection, > while the "normal" version has better performance, but less-error-checkin= g. >=20 > Here, the "unsafe" function does the extra locking. If looking from the H= W > POV, that makes sense, but I think its inverted from most existing code..= . >=20 > Happy to be proved wrong here .. ? >=20 > Thinking a little more about this, also in light of patch 11/12 of this ser= ies. The code here has a "safe" and "unsafe" version of TX. This involves adding= a spinlock inside the code, which is being locked/unlocked before doing th= e actual TX action. I don't understand why this is necessary? DPDK's general stance on locking = for data-path is DPDK functions do not provide locks, and that application = level must implement thread-synchronization if it is required. In this case, the app/eventdev can be considered an App, but I don't like t= he idea of providing a sample application and code that duplicates core fun= ctionality with safe/unsafe versions.. Hope I'm making some sense here.. >=20 > > +static int > > +pipeline_queue_worker_single_stage_safe(void *arg) > > +{ > > + struct worker_data *w =3D arg; > > + struct test_pipeline *t =3D w->t; > > + const uint8_t dev =3D w->dev_id; > > + const uint8_t port =3D w->port_id; > > + struct rte_event ev; > > + > > + while (t->done =3D=3D false) { > > + uint16_t event =3D rte_event_dequeue_burst(dev, port, &ev, 1, 0); > > + > > + if (!event) { > > + rte_pause(); > > + continue; > > + } > > + > > + if (ev.sched_type =3D=3D RTE_SCHED_TYPE_ATOMIC) { > > + pipeline_tx_pkt_safe(ev.mbuf); >=20 > I guess that means that the functions where they're used are inverted in > name too. >=20 >