From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0077.outbound.protection.outlook.com [104.47.36.77]) by dpdk.org (Postfix) with ESMTP id 77BE019F5 for ; Mon, 12 Mar 2018 07:25:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=w/0LIaZqFdM0b0VgM7HdB5hGmYT6YdPRRMp2xOmXEmI=; b=Qrkq6TJEAkAz+DWbZNm2lLcEF8X62dem36EqvbwxQgXu2GVl26Chr+qm/VnloqAHB6mvY3na3pF5TGVHJ9B9E1h52uBWvYWMUHJvga/1BJUybaCfxrgI8fgV6ZmOE0qrAy98HQhNx6SUCcnvLNdk/M3fx/xe860JNb9sPRl9LIw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (122.178.251.71) by SN2PR07MB2528.namprd07.prod.outlook.com (2603:10b6:804:7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Mon, 12 Mar 2018 06:25:45 +0000 Date: Mon, 12 Mar 2018 11:55:28 +0530 From: Jerin Jacob To: Gage Eads Cc: dev@dpdk.org, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, bruce.richardson@intel.com, santosh.shukla@caviumnetworks.com, nipun.gupta@nxp.com Message-ID: <20180312062527.GA20170@jerin> References: <1520290870-4987-1-git-send-email-gage.eads@intel.com> <1520550631-13403-1-git-send-email-gage.eads@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1520550631-13403-1-git-send-email-gage.eads@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [122.178.251.71] X-ClientProxiedBy: PN1PR01CA0118.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00::34) To SN2PR07MB2528.namprd07.prod.outlook.com (2603:10b6:804:7::6) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: deb75ecd-5582-454b-49ce-08d587e21841 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2528; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2528; 3:NryipLFT2hluAM9ESJSIPdRevR3pmTaRjg5JZMyb3J5s0cPOYApPjU9YO1a0nDxJc93slkAodTr09V03abV8lwSBnLuuGpRA1u4AK86P1hG9c31H5Y0SosXULt6yKSjmvc70mjUvAp/ursjMb9/k1yZa3K96UImDR35U+RdSQxEX0IoxpcD4Iq+zDzheg+qvjcmmgw1DRiA7MHMktwnrAQjvpwm9lk6sB8LJZg1Dx/3x1esdesVKvCKewWHyNc9P; 25:3Vh6svPpXHPQe1yIgMcwwVG7KxFX+cCJDssgPO35jqji1dZatxemrH3Mnw27EC25bEwxi51foJjgs+Jabxz+xrFLC06MB/7wf+JTF40G49tme7PSdX7qzf3idfZiLQSbH+Sc/Ho2J1xi4ad06HEKSzc0gW3G/PqW/WRqcPzCv9ZasBzwWBfG3q0wczbjMZukz/3CGmWvIa1S0xfVmbuV04urob8nCOCiaAsNXxCZiluROsvBw/7wA2RYKJtJ6Fkr6LGV/XTIhsyNxxx3toBBM7OkE4pojUIN3gTCSVZCVTUFlBpa6UnWeIWLov3ZBfhhiRlklfEIxxZIPQNOb+zsPA==; 31:5Z4lc+HiPxb6EdTJtwoHvLOGj/hbFBW8GuDPqDpG8UuVUCTAVZrbwmTDou87B3ZACmOlGD4XUjKZ79Exg0WuyjmDHpQ28f6CWAvnuFcVJJrZW3DNNad6Zr/6FYUDACaPA9n9UU6frLJqRVyndgRrZdE/0tAWG+oyKW1WZOF0p5co33PxF7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S: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(3002001)(3231220)(944501244)(52105095)(10201501046)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:SN2PR07MB2528; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2528; X-Forefront-PRVS: 06098A2863 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39850400004)(396003)(39380400002)(366004)(199004)(189003)(13464003)(16526019)(26005)(25786009)(186003)(72206003)(42882007)(58126008)(966005)(4326008)(478600001)(8656006)(2950100002)(6666003)(6916009)(68736007)(8936002)(386003)(97736004)(5660300001)(81166006)(81156014)(33656002)(33716001)(76176011)(6496006)(33896004)(316002)(106356001)(16586007)(50466002)(105586002)(55016002)(9686003)(7736002)(305945005)(23726003)(1076002)(2906002)(53936002)(8676002)(6116002)(229853002)(6306002)(47776003)(66066001)(6246003)(52116002)(3846002)(53376002)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR07MB2528; H:jerin; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2528; 23:c1z8qnl0KPyup+XpJO93+0xB4KAeU7Qeifo4P2mPd?= =?us-ascii?Q?3mcOUab8Kmh0T52iAdiLeSuMFtTUv93M5qWB8owIboEsSREXJWlTPKBlhDiJ?= =?us-ascii?Q?3LefHTRF+65O6aikhjXaqAkWIEjdVaZE4036OMYRh/t3ZD4uuoSwLMbxS3QF?= =?us-ascii?Q?bO4HP7yku4kwgqCKKhjdB9HwuZ7AuDeJbwimY7Dch/mQOiCpvothfqakAenI?= =?us-ascii?Q?H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WW3wAwminudg?= =?us-ascii?Q?6Q5eUKe+6wAloPyQt4q7oxkl4BCoYEgQq8ZnrdwKG18v+XabnA+is8htiNvI?= =?us-ascii?Q?SAHYrsWvVstsniAt4vhAG61A23AQfeWIO0mhotmjbPb+Ku1PSHmdaLUv96gm?= =?us-ascii?Q?K2nAEzlINw1mO9HOEweQgLFkHGf5+fUS59g7hdsvHDZsXF5q1lQWLbXwrI/D?= =?us-ascii?Q?bwQft2E+gXk7hhGfj54rdC2P8Z6w2re1cMh0q2gi1fj?= X-Microsoft-Antispam-Message-Info: QnN1z08QWTy7UFw3eBNO3RlQeYuHsoi2CQNiRHh0ehfVC0S82MZ0lZ6CPA/NbGqDXiQhPPLBckuU4Fc4pi9fhWnjLZTvu5kJF1hIW8b/Se3mzgcPKmjY954iy4jmqPTIjU8dC/FWf60peqxpQBR/BGI1xH9eplAH7iBz8+LtmDYQf9yQQk+UKaWBgYgh2aJy X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2528; 6:5K2GjizicMCWrLydYTOAwkA+/T9h5ewx5MZ8WPEYFHXA3Iwq6/J28PqbH8KxvRVJ37Cwtyke+9iVl2VGwGtdFwL6d9xRJseQCbmB44/vSqwi0n0BGwqzIPkWvP8YRx5dJTLNGOQO7aVXMLgbonTYLyjmxB5f+G4V02RuWGvwsddsHTeCFyI/YawvvKnGq7KtwezRzvRkBzqVpD24rnmpUefLjCyxopr9KcZKq6AJQRRMCJ/31nto+posJ21YBldjYb1AeYc/maHrZi6sxaUoqM3v2d24Nrd1mN9KGJIsybWPRV4Fd3K3iQ3FxjItgSABWyiTz+nHJp81ODnsmDcp14A3hECXFFRESQbU8HWu0vc=; 5:voV3asb0KkqV/GqdZcyXGh4CBaRhV/viQrhCe03NGqlV2M7oXlhDRPydpOJeRzYFGLT8s3CQFfUXVvW42P/xJM3efgj96kjaBDTco7GeFF7/t/9f8N42AduoVWYihwAinHHGQSHpZY1P4nyvP6xdfABuVaIhxRVQBTHzZfKf7gg=; 24:JmZcmP6UwlwfXFsw5JgdzXqW8e0DN1+JDnfIpwmT6q7sTfrWQm7OfkBUaBQ9tdr1u1ui+UBDTpjV6cW+qfzzvVoD80SE3RC/bOKIx4t/WaE=; 7:cQ+i5mXXGbLb3szzNZZk9QP9hSj70aWw3JLKQLiyFs+20VR4ouuepqM+/c4yYrpFNWxI0zDwft7FxRqwC6qdCtRlMSX6NMP0UNp7dzeO8h3jw5IaGIr7gKxIHHAJzv6LqjrxBl50yH8wWZTM8LSkujQZueItZVntdK3QRoQjUAETArLCjHhWS2OeDKk0xzBKz2vTDLRdMSM3HvZHmG5d6kKvPgd4k9Nrs+gpkpbPBoGNfX2Xfmt1qrFUSZcbP7Cy SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2018 06:25:45.4271 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: deb75ecd-5582-454b-49ce-08d587e21841 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2528 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 06:25:50 -0000 -----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 */ > + I think, we can move this additions to the internal rte_eventdev_data structure. 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 path functions can have additional redirection. > 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 pointer. > + * > + * @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_stop(). Other than above minor changes, It looks good to me.