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 9CDEC5F1F for ; Mon, 12 Mar 2018 15:31:05 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Mar 2018 07:31:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,461,1515484800"; d="scan'208";a="38054965" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga001.jf.intel.com with ESMTP; 12 Mar 2018 07:31:03 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 12 Mar 2018 07:30:49 -0700 Received: from fmsmsx108.amr.corp.intel.com ([169.254.9.207]) by FMSMSX110.amr.corp.intel.com ([169.254.14.108]) with mapi id 14.03.0319.002; Mon, 12 Mar 2018 07:30:49 -0700 From: "Eads, Gage" To: Jerin Jacob CC: "dev@dpdk.org" , "Van Haaren, Harry" , "hemant.agrawal@nxp.com" , "Richardson, Bruce" , "santosh.shukla@caviumnetworks.com" , "nipun.gupta@nxp.com" Thread-Topic: [PATCH v2 1/2] eventdev: add device stop flush callback Thread-Index: AQHTucsBUJi7Hxd3jEiYnDi+5PBPIKPMpw1g Date: Mon, 12 Mar 2018 14:30:49 +0000 Message-ID: <9184057F7FC11744A2107296B6B8EB1E3FA711B8@FMSMSX108.amr.corp.intel.com> References: <1520290870-4987-1-git-send-email-gage.eads@intel.com> <1520550631-13403-1-git-send-email-gage.eads@intel.com> <20180312062527.GA20170@jerin> In-Reply-To: <20180312062527.GA20170@jerin> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZGJlMDBkMzgtNGNlOS00OGQ2LTgyY2ItZjExODQxNTI4N2RkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Im9IbE1kQnFCU3M4dUJEdUhUUWo4NFBJOCtmWlwvWHdiSFR3SU9cL2Jnc2J2az0ifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.1.200.106] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 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: Mon, 12 Mar 2018 14:31:06 -0000 > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Monday, March 12, 2018 1:25 AM > To: Eads, Gage > Cc: dev@dpdk.org; Van Haaren, Harry ; > hemant.agrawal@nxp.com; Richardson, Bruce ; > santosh.shukla@caviumnetworks.com; nipun.gupta@nxp.com > Subject: Re: [PATCH v2 1/2] eventdev: add device stop flush callback >=20 > -----Original Message----- > > 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 > process. > > This callback is stored in process memory, so the callback must be > > registered by any process that may call rte_event_dev_stop(). > > > > This commit also clarifies the behavior of rte_event_dev_stop(). > > > > This follows this mailing list discussion: > > http://dpdk.org/ml/archives/dev/2018-January/087484.html > > > > Signed-off-by: Gage Eads > > --- > > v2: allow a NULL callback pointer to unregister the callback > > > > lib/librte_eventdev/rte_eventdev.c | 17 +++++++++ > > lib/librte_eventdev/rte_eventdev.h | 55 > +++++++++++++++++++++++++++- > > lib/librte_eventdev/rte_eventdev_version.map | 6 +++ > > 3 files changed, 76 insertions(+), 2 deletions(-) > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c > > b/lib/librte_eventdev/rte_eventdev.c > > index 851a119..1aacb7b 100644 > > --- a/lib/librte_eventdev/rte_eventdev.c > > +++ b/lib/librte_eventdev/rte_eventdev.c > > @@ -1123,6 +1123,23 @@ rte_event_dev_start(uint8_t dev_id) > > return 0; > > } > > > > +typedef void (*eventdev_stop_flush_t)(uint8_t dev_id, struct rte_event= event, > > + void *arg); > > +/**< Callback function called during rte_event_dev_stop(), invoked > > +once per > > + * flushed event. > > + */ > > + > > #define RTE_EVENTDEV_NAME_MAX_LEN (64) > > /**< @internal Max length of name of event PMD */ > > > > @@ -1176,6 +1194,11 @@ struct rte_eventdev { > > event_dequeue_burst_t dequeue_burst; > > /**< Pointer to PMD dequeue burst function. */ > > > > + eventdev_stop_flush_t dev_stop_flush; > > + /**< Optional, user-provided event flush function */ > > + void *dev_stop_flush_arg; > > + /**< User-provided argument for event flush function */ > > + >=20 > I think, we can move this additions to the internal rte_eventdev_data str= ucture. > Reasons are > 1) Changes to "struct rte_eventdev" would call for ABI change > 2) We can keep "struct rte_eventdev" only for fast path functions, slow p= ath > functions can have additional redirection. >=20 Good points -- I hadn't considered the ABI impact of modifying rte_eventdev= . rte_eventdev_data is in shared memory, though, so it's not multi-process = friendly for function pointers. How about putting it in rte_eventdev_ops? > > struct rte_eventdev_data *data; > > /**< Pointer to device data */ > > const struct rte_eventdev_ops *dev_ops; @@ -1822,6 +1845,34 @@ > > rte_event_dev_xstats_reset(uint8_t dev_id, > > */ > > int rte_event_dev_selftest(uint8_t dev_id); > > > > +/** > > + * Registers a callback function to be invoked during > > +rte_event_dev_stop() for > > + * each flushed event. This function can be used to properly dispose > > +of queued > > + * events, for example events containing memory pointers. > > + * > > + * The callback function is only registered for the calling process. > > +The > > + * callback function must be registered in every process that can > > +call > > + * rte_event_dev_stop(). > > + * > > + * To unregister a callback, call this function with a NULL callback p= ointer. > > + * > > + * @param dev_id > > + * The identifier of the device. > > + * @param callback > > + * Callback function invoked once per flushed event. > > + * @param userdata > > + * Argument supplied to callback. > > + * > > + * @return > > + * - 0 on success. > > + * - -EINVAL if *dev_id* is invalid > > + * > > + * @see rte_event_dev_stop() > > + */ > > +int > > +rte_event_dev_stop_flush_callback_register(uint8_t dev_id, > > + eventdev_stop_flush_t callback, void *userdata); > > + > IMO, It would be better if we place this function near to rte_event_dev_s= top(). >=20 > Other than above minor changes, It looks good to me. Ok, will address in v3. Thanks, Gage