Message ID | 20230815145023.1386003-1-okaya@kernel.org (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DE28943073; Tue, 15 Aug 2023 16:50:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B05D14114B; Tue, 15 Aug 2023 16:50:32 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mails.dpdk.org (Postfix) with ESMTP id 48A5740F17 for <dev@dpdk.org>; Tue, 15 Aug 2023 16:50:31 +0200 (CEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B594F61F16 for <dev@dpdk.org>; Tue, 15 Aug 2023 14:50:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5780CC433C8; Tue, 15 Aug 2023 14:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692111030; bh=ISt9AaivIU2OGgByyi9DS3bCAIIl7seXP4YgXUlYF6g=; h=From:To:Cc:Subject:Date:From; b=nen1opy8xZBeBrKDfvZll4w43Ki8rT8W48w35zefh8guKPYMk3apxRwsLPn+hCFPg UXAzg28ECJhltExYf0/Q9Hq0YUGoomWTyaRhVIudXvwlLSVMucXbyUHelovCbsgtHa nccNpnpZPdiY5BmXHoWn6vdZlxz7aEWJkn6WL7jAT1mPvjLQ+gHG93M7iGM5QdxUy5 +vIheNHUfmOb5LF7ZaVA3fCuI1NmPWnPceMnpEWyvm85NcgoqLz8g62/fg5Z2HXqQg PotkJ+LMUn1uwrb9CrxrjGiQuJ3XubPs8cotYW6UJ33L6UwAAaKqNBPN9XDOczNmmA 5lRXbc09n/wBg== From: okaya@kernel.org To: Cc: dev@dpdk.org, Sinan Kaya <okaya@kernel.org> Subject: [PATCH v4 0/8] support reinit flow Date: Tue, 15 Aug 2023 10:50:15 -0400 Message-Id: <20230815145023.1386003-1-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org |
Series |
support reinit flow
|
|
Message
Sinan Kaya
Aug. 15, 2023, 2:50 p.m. UTC
From: Sinan Kaya <okaya@kernel.org>
We want to be able to call rte_eal_init() and rte_eal_cleanup()
APIs back to back for maintanance reasons.
Here is a summary of the code we have seen so far:
1. some code support getting called multiple times by keeping
a static variable.
2. some code initializes once but never clean up after them and
don't have a cleanup API.
3. some code assumes that they only get called once during the
lifecycle of the process.
Most changes in this patch center around following the #1 design
principle.
Why?
It is not always ideal to reinitialize a DPDK process. Memory needs
to be reinitialized, hugetables need to warm up etc.
Changed from
v1:
Fix checkpatch warnings
v2:
rebase to most recent DPDK.
v3:
pick up Stephen's "eal: cleanup plugins data" as a pre-requisite
patch.
Graham Whyte (1):
eal: fixes for re-initialization issues
Sinan Kaya (6):
tailq: skip init if already initialized
eal_memzone: bail out on initialized
memseg: init once
eal_memory: skip initialization
eal_interrupts: don't reinitialize threads
eal: initialize worker threads once
Stephen Hemminger (1):
eal: cleanup plugins data
lib/eal/common/eal_common_memory.c | 5 +++
lib/eal/common/eal_common_memzone.c | 7 +++
lib/eal/common/eal_common_options.c | 20 +++++++++
lib/eal/common/eal_common_tailqs.c | 20 ++++++---
lib/eal/common/eal_options.h | 1 +
lib/eal/common/malloc_heap.c | 7 +++
lib/eal/linux/eal.c | 66 ++++++++++++++++-------------
lib/eal/linux/eal_interrupts.c | 7 +++
lib/eal/linux/eal_memory.c | 12 +++++-
9 files changed, 108 insertions(+), 37 deletions(-)
Comments
On Tue, 15 Aug 2023 10:50:15 -0400 okaya@kernel.org wrote: > From: Sinan Kaya <okaya@kernel.org> > > We want to be able to call rte_eal_init() and rte_eal_cleanup() > APIs back to back for maintanance reasons. > > Here is a summary of the code we have seen so far: > > 1. some code support getting called multiple times by keeping > a static variable. > 2. some code initializes once but never clean up after them and > don't have a cleanup API. > 3. some code assumes that they only get called once during the > lifecycle of the process. > > Most changes in this patch center around following the #1 design > principle. > > Why? > > It is not always ideal to reinitialize a DPDK process. Memory needs > to be reinitialized, hugetables need to warm up etc. I am familiar with the backstory of why this is desirable in your case. But others may not be. It will work for you, but for the wider the range of libraries and drivers it probably won't. As a compromise, can this restart be officially tagged as unsupported. I.e. it may work for some drivers and libraries but not all of them. If nothing else many parts of DPDK still do leak memory on cleanup and currently this is harmless. This has enough impact that it probably needs to wait past 23.11 release. Could you add a test for restart into standalone tests and test-pmd?
On Tue, 2023-08-15 at 10:45 -0700, Stephen Hemminger wrote: > > Why? > > It is not always ideal to reinitialize a DPDK process. Memory needs > > to be reinitialized, hugetables need to warm up etc. > > > > > I am familiar with the backstory of why this is desirable in your > case. > > But others may not be. It will work for you, but for the wider the > > range of libraries and drivers it probably won't. > > Fair enough. > > As a compromise, can this restart be officially tagged as > unsupported. any pointers how to do this? I have no idea how to mark something unsupported in code. If this is acceptable in cover letter, I'm happy to do that too. > > I.e. it may work for some drivers and libraries but not all of them. > > If nothing else many parts of DPDK still do leak memory on cleanup > > and currently this is harmless. > > > > This has enough impact that it probably needs to wait past 23.11 > release. > > Sure, no rush. Happy to wait for time slot and accumulate review feedbacks. > > Could you add a test for restart into standalone tests and test-pmd? Will do.
On Tue, 15 Aug 2023 14:58:03 -0400 Sinan Kaya <okaya@kernel.org> wrote: > > > > As a compromise, can this restart be officially tagged as > > unsupported. > > any pointers how to do this? > > I have no idea how to mark something unsupported in code. > If this is acceptable in cover letter, I'm happy to do that too. Put some additional notes in the rte_eal.h like: diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h index 53c4a5519e61..348b340f006d 100644 --- a/lib/eal/include/rte_eal.h +++ b/lib/eal/include/rte_eal.h @@ -67,6 +67,11 @@ int rte_eal_iopl_init(void); * as possible in the application's main() function. * It puts the WORKER lcores in the WAIT state. * + * @warning + * It maybe possisble to call it again after rte_eal_cleanup(). + * But this usage is dependent on libraries and drivers support which + * may not work. Use at your own risk. + * * @param argc * A non-negative value. If it is greater than 0, the array members * for argv[0] through argv[argc] (non-inclusive) shall contain pointers Or maybe in the Shutdown and Cleanup section of: doc/guides/prog_guide/env_abstraction_layer.rst