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 CBF024D3A for ; Fri, 23 Mar 2018 17:57:29 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Mar 2018 09:57:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,351,1517904000"; d="scan'208";a="214041583" Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28]) by fmsmga006.fm.intel.com with ESMTP; 23 Mar 2018 09:57:26 -0700 Received: from irsmsx155.ger.corp.intel.com (163.33.192.3) by irsmsx105.ger.corp.intel.com (163.33.3.28) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 23 Mar 2018 16:57:26 +0000 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.176]) by irsmsx155.ger.corp.intel.com ([169.254.14.50]) with mapi id 14.03.0319.002; Fri, 23 Mar 2018 16:57:25 +0000 From: "Van Haaren, Harry" To: "Eads, Gage" , "dev@dpdk.org" CC: "jerin.jacob@caviumnetworks.com" , "hemant.agrawal@nxp.com" , "Richardson, Bruce" , "santosh.shukla@caviumnetworks.com" , "nipun.gupta@nxp.com" Thread-Topic: [PATCH v4 1/2] eventdev: add device stop flush callback Thread-Index: AQHTwFWqdT39rqZI0EybXoXPZCJB8qPeCbog Date: Fri, 23 Mar 2018 16:57:25 +0000 Message-ID: References: <1521087130-20244-1-git-send-email-gage.eads@intel.com> <1521555187-25710-1-git-send-email-gage.eads@intel.com> In-Reply-To: <1521555187-25710-1-git-send-email-gage.eads@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.200.100 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 v4 1/2] eventdev: add device stop flush callback 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: Fri, 23 Mar 2018 16:57:31 -0000 > From: Eads, Gage > Sent: Tuesday, March 20, 2018 2:13 PM > To: dev@dpdk.org > Cc: jerin.jacob@caviumnetworks.com; Van Haaren, Harry > ; hemant.agrawal@nxp.com; Richardson, Bruce > ; santosh.shukla@caviumnetworks.com; > nipun.gupta@nxp.com > Subject: [PATCH v4 1/2] eventdev: add device stop flush callback >=20 > When an event device is stopped, it drains all event queues. These events > may contain pointers, so to prevent memory leaks eventdev now supports a > user-provided flush callback that is called during the queue drain proces= s. > This callback is stored in process memory, so the callback must be > registered by any process that may call rte_event_dev_stop(). >=20 > This commit also clarifies the behavior of rte_event_dev_stop(). >=20 > This follows this mailing list discussion: > http://dpdk.org/ml/archives/dev/2018-January/087484.html >=20 > Signed-off-by: Gage Eads > /** > - * Stop an event device. The device can be restarted with a call to > - * rte_event_dev_start() > + * Stop an event device. > + * > + * This function causes all queued events to be drained. While draining > events > + * out of the device, this function calls the user-provided flush callba= ck > + * (if one was registered) once per event. > + * > + * This function does not drain events from event ports; the application= is > + * responsible for flushing events from all ports before stopping the > device. Question about how an application is expected to correctly cleanup all the events here. Note in particular the last part: "application is responsible for flushing events from all ports **BEFORE** stopping the device". Given the event device is still running, how can the application be sure it= has flushed all the events (from the dequeue side in particular)? In order to drain all events from the ports, I was expecting the following: // stop scheduling new events to worker cores rte_event_dev_stop() ---> callback gets called for each event // to dequeue events from each port, and app cleans them up? FOR_EACH_PORT( rte_event_dev_dequeue(..., port_id, ...) ) I'd like to avoid the dequeue-each-port() approach in application, as it ad= ds extra burden to clean up correctly... What if we say that dequeue() returns zero after stop() (leaving events pos= sibly in the port-dequeue side SW buffers), and these events which were about to be dequeued by the worker core are also passed to the dev_stop_flush callba= ck?