[dpdk-dev] [PATCH v4] eal: refactor rte_eal_init into sub-functions

Tyler Retzlaff roretzla at linux.microsoft.com
Wed Jan 24 18:49:26 CET 2024


On Wed, Jan 24, 2024 at 05:45:11AM -0800, Rahul Gupta wrote:
> From: Rahul Gupta <rahulgupt at microsoft.com>
> 
> In continuation to the following email, I am sending this patch.
> (https://inbox.dpdk.org/dev/20231110172523.GA17466@microsoft.com/)
> 
> Initialization requires rte_eal_init + rte_pktmbuf_pool_create which
> can consume a total time of 500-600 ms:
> a) For many devices FLR may take a significant chunk of time
>    (200-250 ms in our use-case), this FLR is triggered during device
>    probe in rte_eal_init().
> b) rte_pktmbuf_pool_create() can consume up to 300-350 ms for
> applications that require huge memory.
> 
> This cost is incurred on each restart (which happens in our use-case
> during binary updates for servicing).
> This patch provides an optimization using pthreads that applications
> can use and which can save 200-230ms.
> 
> In this patch, rte_eal_init() is refactored into two parts-
> a) 1st part is dependent code ie- it’s a perquisite of the FLR and
>    mempool creation. So this code needs to be executed before any
>    pthreads. Its named as rte_eal_init_setup()
> b) 2nd part of code is independent code ie- it can execute in parallel
>    to mempool creation in a pthread. Its named as rte_eal_init_async_setup().
> 
> In existing applications no changes are required unless they wish to leverage
> the optimization.
> 
> If the application wants to leverage this optimization, then it needs to call
> rte_eal_init_async() (instead of call rte_eal_init()), then it can create a
> thread using rte_eal_remote_launch() to schedule a task it would like todo in
> parallel rte_eal_init_async_setup(), this task can be a mbuf pool creation
> using- rte_pktmbuf_pool_create()
> 
> After this, if next operations require completion of above task, then
> user can use rte_eal_init_wait_async_setup_complete(),
> or if user wants to just check status of that thread, then use-
> rte_eal_init_async_setup_done()
> 
> ---
> v2: Address Stephen Hemminger's comment
> ---
> v3: address support for single lcore
> ---
> v4: address Brue Richardson and Stephen Hemminger comment
> Existing application need not do any changes if bootup optimization is not needed.
> 
>  app/test-pmd/testpmd.c    |  24 ++++++++-
>  lib/eal/include/rte_eal.h | 107 ++++++++++++++++++++++++++++++++++++++
>  lib/eal/linux/eal.c       |  62 ++++++++++++++++++++--
>  lib/eal/version.map       |   7 +++
>  4 files changed, 196 insertions(+), 4 deletions(-)

NAK

changes to EAL need to cover all support OS/platforms, EAL is not
Linux-only library.



More information about the dev mailing list