From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D5D3E429DD; Mon, 24 Apr 2023 18:08:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C457641138; Mon, 24 Apr 2023 18:08:39 +0200 (CEST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id 3CD0A410ED for ; Mon, 24 Apr 2023 18:08:38 +0200 (CEST) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1a686260adcso51709625ad.0 for ; Mon, 24 Apr 2023 09:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1682352517; x=1684944517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=A5rWJZFAMRerdqXJo2ExOXjLo5qnMZeVuxOVVkGgzwI=; b=0cdTF7tLRjpNgRF4CYYoIjsqwwG3jhb22wZaKiS3xoaG1pgd6rk+aqCtva6IKmOfPJ sFqbFguviqHkJ76/KqPiJ8MeSrH4vBE3GMl6oH9iCEZyb3R1oywRhJzoEdKsEZBiUt0/ chXnGiAhQSsUiZY7Q5Iytace7al5BYS48f9htUNdP53rGthFEfRqRU+0eUSjqzSaxpMy E/cuftBsIq/Y8OqCQpaTNHHi526WpLz0c2ikkwoLA/5j23OFYPagpuhKCMyvCIdk5rKc 7cpxQK8+s3u1esO1slZnfU9Z429+7sluqNXPlkPhHPFIo946uhbl7JkK2DnMi6m+xUL2 /euA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682352517; x=1684944517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A5rWJZFAMRerdqXJo2ExOXjLo5qnMZeVuxOVVkGgzwI=; b=RXIxnLx3o5ZHbb3SMH5CPAxZTR1ZPv6WxCsm1zvoVZAHtj+ZmHUGxOrgdaedGxWMa1 WzrU9qjtRNsy0YBmlpWwbnUABQGb5R331/yLxHjQHZLaTuEnM8XEbyQ0vN71Gt1qwwCR GKBIFDg+2HFZxfbrj22AM0WzGrDGZ7Zv7/7JIpUq6rB4Ibq87RfYQRLwpkI2ZKmPZKQj B0tjEI3pmSIQu/zdPpe7foB76AUuc2yz68VPWgK0vyiV/Ixqw1dFL/Zr0rcDd8zS9oxx bQjPXUKPCmJ9A+VcMGoJQiyUM9kRkOA8hRFkpZNma74W3N72V+7YPjLW4Uz5pCOgHpLa Mecw== X-Gm-Message-State: AAQBX9dQhdW0vIktVo2p5MI8XK1valAukNy5bukW+fBljyYWcXUAZ4xn byshittOU3b262XkxggtoSaa0Q== X-Google-Smtp-Source: AKy350YwQoDkANM5nX4G99cqmA3iTRcNcx716KoR47WHIAgXLMu06WaSLUB0DgKjWcj5N1+0HwVDWQ== X-Received: by 2002:a17:902:d4c8:b0:1a6:71b1:a0b9 with SMTP id o8-20020a170902d4c800b001a671b1a0b9mr17661254plg.47.1682352517291; Mon, 24 Apr 2023 09:08:37 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id np9-20020a17090b4c4900b002367325203fsm8459568pjb.50.2023.04.24.09.08.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 09:08:36 -0700 (PDT) Date: Mon, 24 Apr 2023 09:08:36 -0700 From: Stephen Hemminger To: Chengwen Feng Cc: , , Subject: Re: [RFC 0/3] introduce coroutine library Message-ID: <20230424090836.0550e14b@hermes.local> In-Reply-To: <20230424130208.9517-1-fengchengwen@huawei.com> References: <20230424130208.9517-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, 24 Apr 2023 13:02:05 +0000 Chengwen Feng wrote: > This patchset introduces the coroutine library which will help refactor > the hns3 PMD's reset process. > > The hns3 single function reset process consists of the following steps: > 1.stop_service(); > 2.prepare_reset(); > 3.delay(100ms); > 4.notify_hw(); > 5.wait_hw_reset_done(); // multiple sleep waits are involved. > 6.reinit(); > 7.restore_conf(); > > If the DPDK process take over multiple hns3 functions (e.g. 100), > it's impractical to reset and restore functions in sequence: > 1.proc_func(001); // will completed in 100+ms range. > 2.proc_func(002); // will completed in 100~200+ms range. > ... > x.proc_func(100); // will completed in 9900~10000+ms range. > The later functions will process fail because it's too late to deal with. > > One solution is that create a reset thread for each function, and it > will lead to large number of threads if the DPDK process take over > multiple hns3 functions. > > So the current hns3 driver uses asynchronous mechanism, for examples, it > use rte_eal_alarm_set() when process delay(100ms), it splits a serial > process into multiple asynchronous processes, and the code is complex > and difficult to understand. > > The coroutine is a good mechanism to provide programmers with the > simplicity of keeping serial processes within a limited number of > threads. > > This patchset use to build the coroutine framework, and it > just provides a demo. More APIs maybe added in the future. > > In addition, we would like to ask the community whether it it possible > to accept the library. If not, whether it is allowed to provide the > library in hns3 PMD. > > Chengwen Feng (3): > lib/coroutine: add coroutine library > examples/coroutine: support coroutine examples > net/hns3: refactor reset process with coroutine Interesting, but the DPDK really is not the right place for this. Also, why so much sleeping. Can't this device be handled with an event based model. Plus any complexity like this introduces more bugs into already fragile interaction of DPDK userspace applications and threads. Not only that, coroutines add to the pre-existing problems with locking. If coroutine 1 acquires a lock, the coroutine 2 will deadlock itself. And someone will spend days figuring that out. And the existing analyzer tools will not know about the magic coroutine library. Bottom line: please no