From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0046.outbound.protection.outlook.com [104.47.33.46]) by dpdk.org (Postfix) with ESMTP id 32B6B4F90 for ; Mon, 30 Jul 2018 12:37:08 +0200 (CEST) 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:X-MS-Exchange-SenderADCheck; bh=hDv0TGdURlvt/3+e1wequ8UJR1l6fTeVD/5J+noBbzQ=; b=aCg8bwwrFvDWNm00IfPQf1XzdSxKoh1gR+nDJPAd7+t3PzGJ1nRfAQlx+uGcOLQPGwTV/EMP5SF+yEv0TrA/aeg9QtSVneXD6Hqt/xDbRMldHKKy22F6IJzHp/JK4TYBkpVpB4P/kGI8cwbl2WR1KizibKqzZj6yFtqglmpGTFU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (50.233.148.155) by BL0PR07MB4996.namprd07.prod.outlook.com (2603:10b6:208:49::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.20; Mon, 30 Jul 2018 10:36:55 +0000 Date: Mon, 30 Jul 2018 16:06:41 +0530 From: Jerin Jacob To: "Van Haaren, Harry" Cc: "Elo, Matias (Nokia - FI/Espoo)" , "dev@dpdk.org" Message-ID: <20180730103638.GA26701@jerin> References: <20180730075408.GA14117@jerin> <80CC5C07-0D73-4F86-9F93-0AB78DEF2BFD@nokia.com> <20180730092921.GA22242@jerin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Originating-IP: [50.233.148.155] X-ClientProxiedBy: MWHPR14CA0023.namprd14.prod.outlook.com (2603:10b6:300:ae::33) To BL0PR07MB4996.namprd07.prod.outlook.com (2603:10b6:208:49::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ddd87c01-0346-4047-6bc9-08d5f6086482 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BL0PR07MB4996; X-Microsoft-Exchange-Diagnostics: 1; BL0PR07MB4996; 3:Ws9dx9OGip0NDdKjNiTfSAbEDjXwXkqsot0ahfO5LyeqqW/atRl0z+OZWX4eZ0eWPSHM6FNQFjWj8orscETSUmg3A8B8o8qsqyYlOnrtZuYPmJAx1glmKwU3VBscHLPZGrAoBKHGWl7NQQnRWi/ZOU4s17SQYAJ2r11K0IOpOYSg1cYPIfL3zs35fqD1jcqYO/vK3LEjAUvnLScQtXHPpMu3nwJkN6xqHbGB/6pH1v2RUAdbe77jvnrufxkMD35P; 25:lwCLsKduUV84po7X8iRmvHN0yYdcKQlvZE7XWGmtPub2D9p/ryHqhyIEBrNdhwJg8A7vEL6U3CnlKu89d/oDrz4qXmXdqsZM4+H5QXzWslP6kyb6GvOOWZQovaw1s0f72KW8JB9m8EsHfMhAdaYWRcTwhgkCJzxqQjkM9hXjR6DWoDcEWtjpatjf5EdBot3ke6Ex0GC24UOnqi8yjjZ3OmwvwrQuWa32DkiBiBkL9c2sO5pH2Vn1Ow36G+bo/TNMGHyRjH1c9ATlXcKCBlDgePZdaYWqvVC/5m46aOF273qvMqRR8dtnbpVMSNaAtQlSsKOIKMoh/QWeN6xZSWch8w==; 31:op3ymdEyBHq6McFGdkehVbDW0+fHrE9rDl0umBy3sfbGVI4ErNvln1pzBBLz1AGqEwJaVD1RiS9tSQ9o65J+3Hk2wb3i/5t9K+LOop5M+WZb9lh01nQhx+YJ1zyjSmLeRHopvrJ7kxuWe1jGazkYBI/r0ORUVaPGZghQnE0j36jy0AxJVlKkSbNw7d6p1uVWlFP0lakPyaJNh8XiK8RwyGEKbcbyaY74jaDTeRTVLgg= X-MS-TrafficTypeDiagnostic: BL0PR07MB4996: X-Microsoft-Exchange-Diagnostics: 1; BL0PR07MB4996; 20:/Vrlo36mu/eOeuVHH71jXvT2wHT9iTBiDIGDlwdagFGfuw7DKo3AfutYx11W4GoRYuXPZiR+INmDmnGCkcUmhrZFp6Xh+25q8LQgsqxENuai9jBM9gpiXT5kN7OfnLOdqxqCyZfbZOML17cW6NgAn7WRNWWrh0y66uEYzSdYftkEJd6zUNJnj+dVIJ2SnxbScYGZgEwor1gwYYEjUSOF04uIW4KvfuO9yy2yHebeq5LPTx1+0uT7jz724hAt8d+cYvkN3xmn4bKmiG18dIxsR5t4hGz+wlQB74KGI1ZbTlZYiRrgaVCfHYPt0koLrnT8ygtYSW/9sJeMwUDde0iDRk7o5ZHRfUXQVCPdudLXyydQHVgFbpfWkGq0AqTsr7o/3X+Xw/jByRZHlhbX2DLGuPFbN69ppAhQlJfEnSI+7HT/ddF9coaZZyWMYCNfTpgrHuzn/DU5CA27SZuT/49xxco0czpDjl8ZK8b2+W/dBSyXVbrC9K4SHeoZw1jY+8gt1ZnFdeWjPYC7rJqj1/CrNNwmJis9MD1wl11/bOjLdTj00tFmK812kWhyU8oKnlcF53rXLhMlJ7Dt7cjHqi7BL7B5VwikxOJFz6s5QUvrbNQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(82608151540597)(109105607167333)(195916259791689)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:BL0PR07MB4996; BCL:0; PCL:0; RULEID:; SRVR:BL0PR07MB4996; X-Microsoft-Exchange-Diagnostics: 1; BL0PR07MB4996; 4:C0EDLIBbFtVpY0DIl4FdGhW0Bj6zlRGEdpP9UA13XIAvdBPv+AZ3wOeqo2C+XltO4mty0g4eRxvBKFhvmoaWwOijBl9MUIgUw7XAp341GnQXfrmybi+P3paHr4cZ230ZjTUe5abOsTZfjN9dYx2wBYHj+hiOwwwjdzLXqxDP/C+plXYrBisbsdsG3ttMHk5rmKTGKDUArsOLSvBzDib15BDChxR/eqd878da/FZ8NW8uOsOYrQcSlhFoTfWOXfT6QETF/OHP9KIitWUUb/xNR7hRqVWyFXuUn/ppCG6QSJTz7v7nna/hl09RA9QXe0HHhjquQiSF5plGWz2M0hOMQ5mbPQP22QKuF2RrkcvTraTKHvu4LXJFXaaehB47vF9173z5fzclqLeozOCvHb51qB0Js7iCjvBv5MHN54Vu/4U= X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(366004)(136003)(346002)(376002)(189003)(13464003)(199004)(4326008)(6246003)(44832011)(97736004)(52116002)(25786009)(6306002)(11346002)(9686003)(476003)(105586002)(55016002)(6496006)(956004)(486006)(7736002)(386003)(2906002)(305945005)(446003)(81166006)(42882007)(81156014)(76176011)(93886005)(8936002)(54906003)(186003)(16526019)(53546011)(229853002)(26005)(33896004)(8676002)(478600001)(33656002)(6666003)(5660300001)(6116002)(3846002)(6916009)(966005)(106356001)(23726003)(1076002)(72206003)(47776003)(53936002)(316002)(68736007)(66066001)(50466002)(33716001)(58126008)(16586007)(14444005)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL0PR07MB4996; H:jerin; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL0PR07MB4996; 23:it88P+ip3i/0K0F2y1wmkV3iGQFrSSTJ9Xf3WUgPz?= =?us-ascii?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I2iamtAUEO6Fjd7QC0IZ6?= =?us-ascii?Q?930CSSRZve8PA2JkMSnZXXtTS+cHZoIEVzY43vtytd6OmvvqvJNEGl9D8MGO?= =?us-ascii?Q?yaXA5jobJEL/swarX7YdVXyp0BpdqweAxkkCmGLF7BSr4o5naYG0G+7B0snI?= =?us-ascii?Q?1P3TtE8t3Dun0HnQ+nyTCCHBM/uunGOnTWhroMvzQ3Ialz2dmdX/MeDpinUZ?= =?us-ascii?Q?D1vDdcoxei40BVVTlNl5ejRRCbAuPD9qahF3Db3loTuKYBj7AtN2egH+vPQY?= =?us-ascii?Q?tzB2JpFbRD7/9waE0alBowvRTKsnNGvLYsWgVqMz/Bqxk3q+41tDE0xX0Eld?= =?us-ascii?Q?z5W0M7LCHS47FRniSa0sYZfAa4wpY10AVZdqFAYtzZC4xoGwO9ZdMoM0VDvA?= =?us-ascii?Q?p/Kv5d0VMeNxp182jGLK8cxJ7Sch7wpjyWDnm3+patStLqmL4wr5LHzlOl9r?= =?us-ascii?Q?W6DqSQHl3f4NIB4go09D8YEgrO5Agwyro3m0qoSkn029y7rvMQbe1sqMKttB?= =?us-ascii?Q?+9BBydZjTGb++//DB89ClLPgjnck+I=3D?= X-Microsoft-Antispam-Message-Info: zI2ZU3pWaSjWjKgCqwY/J9o3uJtg7l8DSEhmT3IvjE0ITHcnl7NkcYShQ4XyKHm31+hHtdlwEvnYEAjWL+ek9rnp/G/kjEBS/MVodJ9A7226C0198yKpwlyR+y9t+7jz7SrkshqmeilJfrxr2tx6zyjlLD+EenHMjWRELEIbRzUjObXnbyi8H7afO8qwd181bbBmhns9/+C/rMJcSOnXUNEzCFBd3KOT8wo3MHX94IxZXOxuo/K0BWCRVpczD5g0a0j09ZHQNcy6bjz1olZBt3+9pn5E0cPH3FlQl1Z5dGCD6JnPNy6SH5UTYfnf/XrtVL2Q/Ul10UH4HAe5j+3gE8fWP19hOVxtd53N8YTHtag= X-Microsoft-Exchange-Diagnostics: 1; BL0PR07MB4996; 6:59mgtgf64JEW7ic+a1YIMdQRfgfS8zlP+qIMI8d6Yr8XtsQ32Wqb0dNh/SIHpEQ3pwoSrfvjhxZfyjz9qrfKLr9yLPvjBr7qY7wEnsVePzS41HbzPOrndWzR7WW1WKp6PziCWHnyqOfbpQ/HTXnavZwG3+E17tbs99zG9rvrDjTa8bKlNm8BGNUnJRokyaUZpjrO+wnO164rBQnzbnk6hI88miFvcZhR2WSNg3T7PwvkmuLo5cHHlcs0ZCRCaIi9wBuzfR3hvPYDEzjfua+kTAKiN1dR6Lr5xVwkJIwLyIk2vaeavQaFdaM6SfxK/aglms8nK5n8gdzr83qdmAv6+9G8uk2CTlVBW76PcYjGKfV3tkiFADV7Ur0whI1A6GpFGZMfF6lW6fIUVmr0XvXGVp3vFaQ/NKKLCP+rfQO1da5nmnYqPod4n1H1KtoiaoCBxv/i3SCBt3rZS5NPqBB28g==; 5:uJRh8F2K21GXyhfYZy8nwo6/AwqLX51rBa1zMFRLZ8d+mxsZf3wHHIu5o1OoGNt6rDGrqRmS2Oqu/VQZN5+lsUu9rOt4+NqGravi8tis4m458b/iOuVVqThJAxk07R0xrvzG0W8IlwJkrvJRyBtkvGutX2vko6xYwOXA1JIKLfE=; 7:ZFDEAM9gRTYT6Znrs4g2UCwYGOm1h90C/+cFHlwxCMTAd1vyu2/7pRRdTn5lnS/1QhG7K3dEu9lZ2leLPtYbv7t22weAZw4t7Nm0QHINh6qdGiKxJIH/EMiGPHi9puKlJy5rRLEkI32XfoEDxKSQSuQo9Gwg1oeDxuE2mX1OzYkmC3Mx43wxW0jk6fYZ7dba0rrd3hOtoq8EdHCxmon1+KvvDrrAFIOCDuI2P+sIXKV3TVg4Bwweu1rHeaJpcFBH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 10:36:55.6776 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ddd87c01-0346-4047-6bc9-08d5f6086482 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR07MB4996 Subject: Re: [dpdk-dev] eventdev: method for finding out unlink status 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, 30 Jul 2018 10:37:08 -0000 -----Original Message----- > Date: Mon, 30 Jul 2018 09:38:01 +0000 > From: "Van Haaren, Harry" > To: Jerin Jacob , "Elo, Matias (Nokia - > FI/Espoo)" > CC: "dev@dpdk.org" > Subject: RE: [dpdk-dev] eventdev: method for finding out unlink status > > > > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > > Sent: Monday, July 30, 2018 10:29 AM > > To: Elo, Matias (Nokia - FI/Espoo) > > Cc: dev@dpdk.org; Van Haaren, Harry > > Subject: Re: [dpdk-dev] eventdev: method for finding out unlink status > > > > -----Original Message----- > > > Date: Mon, 30 Jul 2018 09:17:47 +0000 > > > From: "Elo, Matias (Nokia - FI/Espoo)" > > > To: Jerin Jacob > > > CC: "dev@dpdk.org" , "Van Haaren, Harry" > > > > > > Subject: Re: [dpdk-dev] eventdev: method for finding out unlink status > > > x-mailer: Apple Mail (2.3445.9.1) > > > > > > > > > >> > > > >> In bug report https://bugs.dpdk.org/show_bug.cgi?id=60 we have been > > discussing > > > >> issues related to events ending up in wrong ports after calling > > > >> rte_event_port_unlink(). In addition of finding few bugs we have > > identified a > > > >> need for a new API call (or documentation extension) for an application > > to be > > > > > > > > From HW perspective, documentation extension should be enough. adding > > > > "there may be pre-scheduled events and the application is responsible to > > process them" > > > > on unlink(). Since dequeue() has which queue it is dequeue-ed from, the > > > > application can allays make action based on that(i.e, Is the event > > > > post/pre to unlink) > > > > > > At least in case of SW eventdev the problem is how the application can know > > that > > > it has processed all pre-scheduled events. E.g. dequeue may return nothing > > but since > > > the scheduler is running as a separate process events may still end up to > > the unlinked > > > port asynchronously. > > > > Can't we do, dequeue() in loop to get all the events from port. If > > dequeue returns with zero event then ports are drained up. Right? > > Nope - because the scheduler might not have performed and "Acked" the > unlink(), and internally it has *just* scheduled an event, but it wasn't > available in the dequeue ring yet. > > Aka, its racy behavior - and we need a way to retrieve this "Unlink Ack" > from the scheduler (which runs in another thread in event/sw). OK. Some bits specific to event/sw. We will address it. > > > > > >> able to find out when an unlink() call has finished and no new events are > > > >> scheduled anymore to the particular event port. This is required e.g. > > when doing > > > >> clean-up after an application thread stops processing events. > > > > > > > > If thread stopping then it better to call dev_stop(). At least in HW > > > > implementation, > > > > > > For an application doing dynamic load balancing stopping the whole eventdev > > is not an > > > option. > > > > OK. Makes sense. Doing unlink() and link() in fastpath is not a > > problem. > > Correct > > > > Changing core assignment to event port is problem without stop(). I > > guess, you > > application or general would be OK with that constraint. > > > I don't think that the eventdev API requires 1:1 Lcore / Port mapping, so really a > PMD should be able to handle any thread calling any port. > > The event/sw PMD allows any thread to call dequeue/enqueue any port, > so long as it is not being accessed by another thread. Yes. True. Eventdev API does not required 1:1 Lcore/Port mapping. Just like event/sw requires some bits to clear "Unlink Ack". At least, our HW implementation we need some bit clear when we change lcore to port mapping. Currently we are doing it in stop() call, If there is a real valid use case to change lcore to port mapping without stop, we would like to propose and API to flush/clear state on Lcore/port mapping change. It can be NOP for event/sw. > > > > > > A given event port assigned to a new lcore other than > > > > it previous one then we need to do some clean up at port level. > > > > > > In my case I'm mapping an event port per thread statically (basically > > thread_id == port_id), > > > so this shouldn't be an issue. > > This is the common case - but I don't think we should demand it. > There is a valid scale-down model which just polls *all* ports using > a single lcore, instead of unlink() of multiple ports. > > > For this "runtime scale down" use-case the missing information is being > able to identify when an unlink is complete. After that (and ensuring the > port buffer is empty) the application can be guaranteed that there are no > more events going to be sent to that port, and the application can take > the worker lcore out of its polling-loop and put it to sleep. > > As mentioned before, I think an "unlinks_in_progress()" function is perhaps > the easiest way to achieve this functionality, as it allows relatively simple > tracking of unlinks() using an atomic counter in sw. (Implementation details > become complex when we have a separate core running event/sw, separate cores > polling, and a control-plane thread calling unlink...) > > I think the end result we're hoping for is something like pseudo code below, > (keep in mind that the event/sw has a service-core thread running it, so no > application code there): > > int worker_poll = 1; > > worker() { > while(worker_poll) { > // eventdev_dequeue_burst() etc > } > go_to_sleep(1); > } > > control_plane_scale_down() { > unlink(evdev, worker, queue_id); > while(unlinks_in_progress(evdev) > 0) > usleep(100); > > /* here we know that the unlink is complete. > * so we can now stop the worker from polling */ > worker_poll = 0; > } Make sense. Instead of rte_event_is_unlink_in_progress(), How about adding a callback in rte_event_port_unlink() which will be called on unlink completion. It will reduce the need for ONE more API. Anyway it RC2 now, so we can not accept a new feature. So we will have time for deprecation notice. > > Hope my pseudo-code makes pseudo-sense :) > > -Harry