Skip to content

RFC Allow intitializing EAL without argc/argv

Bruce Richardson dpdk-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest44 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/44eal: define new functionally distinct config structslib/eal/common/eal_common_config.c lib/eal/common/eal_internal_cfg.h+59 -02 replies
2/44eal: move memory request fields to user configlib/eal/common/eal_common_dynmem.c lib/eal/common/eal_common_memory.c lib/eal/common/eal_common_options.c +7 more+56 -430 replies
3/44eal: move NUMA request fields to user configlib/eal/common/eal_common_dynmem.c lib/eal/common/eal_common_options.c lib/eal/common/eal_internal_cfg.h +5 more+38 -430 replies
4/44eal: move hugepage policy fields to user configlib/eal/common/eal_common_config.c lib/eal/common/eal_common_dynmem.c lib/eal/common/eal_common_options.c +9 more+67 -600 replies
5/44eal: move process policy fields to user configlib/eal/common/eal_common_config.c lib/eal/common/eal_common_fbarray.c lib/eal/common/eal_common_memory.c +12 more+132 -1610 replies
6/44eal: move advanced user config options to user cfg structlib/eal/common/eal_common_bus.c lib/eal/common/eal_common_config.c lib/eal/common/eal_common_dynmem.c +16 more+165 -2200 replies
7/44eal: move hugepage size info to platform info structlib/eal/common/eal_common_dynmem.c lib/eal/common/eal_common_options.c lib/eal/common/eal_internal_cfg.h +9 more+122 -1500 replies
8/44telemetry: make cpuset init parameter constlib/telemetry/telemetry.c lib/telemetry/telemetry_internal.h+3 -30 replies
9/44eal: move runtime state to appropriate structurelib/eal/common/eal_common_config.c lib/eal/common/eal_common_mcfg.c lib/eal/common/eal_common_memzone.c +8 more+30 -560 replies
10/44eal: record details of all cpus in platform infolib/eal/common/eal_common_lcore.c lib/eal/common/eal_internal_cfg.h lib/eal/common/eal_private.h +3 more+71 -70 replies
11/44eal: use platform info for lcore lookupslib/eal/common/eal_common_lcore.c lib/eal/common/eal_common_thread.c lib/eal/common/eal_private.h+43 -520 replies
12/44eal: add RTE_CPU_FFS macrolib/eal/freebsd/include/rte_os.h lib/eal/linux/include/rte_os.h lib/eal/windows/include/rte_os.h +1 more+23 -00 replies
13/44eal: store lcore configuration in runtime datalib/eal/common/eal_common_launch.c lib/eal/common/eal_common_lcore.c lib/eal/common/eal_common_options.c +9 more+142 -1270 replies
14/44eal: cleanup CPU init functionlib/eal/common/eal_common_lcore.c+18 -650 replies
15/44eal: move numa node information to platform info structlib/eal/common/eal_common_lcore.c lib/eal/common/eal_internal_cfg.h lib/eal/common/eal_private.h+33 -160 replies
16/44eal: move lcore role and count to runtime statelib/eal/common/eal_common_lcore.c lib/eal/common/eal_common_options.c lib/eal/common/eal_internal_cfg.h +2 more+53 -580 replies
17/44eal: make lcore role a field in lcore config structlib/eal/common/eal_common_lcore.c lib/eal/common/eal_common_options.c lib/eal/common/eal_internal_cfg.h +1 more+31 -310 replies
18/44eal: move main lcore setting to runtime config structlib/eal/common/eal_common_dynmem.c lib/eal/common/eal_common_lcore.c lib/eal/common/eal_common_options.c +7 more+35 -400 replies
19/44eal: move iova mode and process type to runtime cfglib/eal/common/eal_common_config.c lib/eal/common/eal_common_mcfg.c lib/eal/common/eal_internal_cfg.h +4 more+17 -240 replies
20/44eal: move memory config pointer to runtime state structlib/eal/common/eal_common_config.c lib/eal/common/eal_common_dynmem.c lib/eal/common/eal_common_mcfg.c +19 more+137 -1300 replies
21/44eal: remove rte_config structurelib/eal/common/eal_common_config.c lib/eal/common/eal_private.h lib/eal/freebsd/eal.c +3 more+24 -490 replies
22/44eal: separate runtime state update from arg parsinglib/eal/common/eal_common_options.c lib/eal/common/eal_options.h lib/eal/freebsd/eal.c +2 more+37 -520 replies
23/44eal: move devopt_list staging list into user_cfglib/eal/common/eal_common_options.c lib/eal/common/eal_internal_cfg.h+21 -150 replies
24/44eal: separate plugin paths from loaded plugin objectslib/eal/common/eal_common_options.c lib/eal/common/eal_internal_cfg.h+158 -1120 replies
25/44eal: simplify internal driver path iteration APIsapp/test/process.h lib/eal/common/eal_common_options.c lib/eal/include/rte_eal.h+31 -680 replies
26/44eal: move trace config into user config structlib/eal/common/eal_common_options.c lib/eal/common/eal_common_trace.c lib/eal/common/eal_common_trace_utils.c +6 more+87 -1370 replies
27/44eal: record service cores in user config structlib/eal/common/eal_common_options.c lib/eal/common/eal_internal_cfg.h+43 -1130 replies
28/44eal: store user-provided lcore info in user config structlib/eal/common/eal_common_options.c lib/eal/common/eal_internal_cfg.h lib/eal/freebsd/eal.c +2 more+108 -520 replies
29/44eal: clarify docs on params taking lcore IDsdoc/guides/linux_gsg/eal_args.include.rst lib/eal/common/eal_option_list.h+38 -60 replies
30/44eal: remove internal config reset functionlib/eal/common/eal_common_options.c lib/eal/common/eal_internal_cfg.h lib/eal/freebsd/eal.c +1 more+21 -740 replies
31/44eal: move functions setting runtime statelib/eal/common/eal_common_config.c lib/eal/common/eal_common_options.c lib/eal/common/eal_options.h +4 more+175 -1340 replies
32/44eal: initialize platform info on first uselib/eal/common/eal_common_config.c lib/eal/common/eal_common_dynmem.c lib/eal/common/eal_common_lcore.c +14 more+323 -1490 replies
33/44eal: remove duplicated scan of sysfs for hugepage detailslib/eal/freebsd/eal_hugepage_info.c lib/eal/linux/eal_hugepage_info.c lib/eal/windows/eal_hugepages.c+40 -1020 replies
34/44eal: add utilities for working with user config structlib/eal/common/eal_common_options.c lib/eal/common/eal_internal_cfg.h+153 -110 replies
35/44eal: split EAL init into two stageslib/eal/common/eal_common_options.c lib/eal/common/eal_options.h lib/eal/freebsd/eal.c +2 more+149 -870 replies
36/44eal: provide hooks for init with externally supplied configlib/eal/common/eal_common_config.c lib/eal/common/eal_common_lcore.c lib/eal/common/eal_common_thread.c +9 more+168 -210 replies
37/44eal_cfg: add new library to programmatically init DPDKapp/test/meson.build app/test/test_eal_cfg.c doc/api/doxy-api-index.md +7 more+276 -00 replies
38/44eal_cfg: configure defaults for easier testing and uselib/eal_cfg/eal_cfg.c lib/eal_cfg/rte_eal_cfg.h+133 -60 replies
39/44app/test: enable testing init using EAL config libapp/test/test.c app/test/test.h app/test/test_eal_cfg.c+86 -280 replies
40/44eal_cfg: add basic setters and gettersapp/test/test_eal_cfg.c lib/eal_cfg/eal_cfg.c lib/eal_cfg/rte_eal_cfg.h+1034 -40 replies
41/44eal_cfg: add hugepage memory configurationapp/test/test_eal_cfg.c lib/eal_cfg/eal_cfg.c lib/eal_cfg/rte_eal_cfg.h+489 -110 replies
42/44eal_cfg: support configuring lcoresapp/test/test_eal_cfg.c lib/eal_cfg/eal_cfg.c lib/eal_cfg/rte_eal_cfg.h+408 -00 replies
43/44eal_cfg: support device and driver listsapp/test/meson.build app/test/test_eal_cfg.c lib/eal_cfg/eal_cfg.c +1 more+293 -10 replies
44/44eal_cfg: add APIs for configuring remaining init settingsapp/test/test_eal_cfg.c lib/eal_cfg/eal_cfg.c lib/eal_cfg/rte_eal_cfg.h+515 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 00/44] Allow intitializing EAL without argc/argv

The ultimate end goal of this RFC is, as stated in the title, to move away from argc/argv as the sole means of configuring EAL on init. This set therefore looks to:
* rework EAL so that we have a generic EAL init function taking a struct-based configuration
* provide a rough *example* of how that might be used to create a new set of C APIs to be used by apps to initialize EAL without having to create dummy argc/argv pairs. [A side benefit of this is that it makes it a lot easier to initialize EAL from other languages like Rust or Python too, because arrays of C strings are not the most user-friendly for a foreign interface]

Therefore this set can be considered in 3 parts:

Part 1: Struct rework.

Largely for legacy reasons, we have a number of different structs and arrays holding eal configuration, without having clear guides as to why certain fields are stored where. The first ~30 patches rework the existing structs - rte_config, internal_config, lcore_config etc. into three defined-purpose structs:

- eal_platform_info - contains the raw HW info for the system, details of CPUs and hugepage mounts. This is initialized on first use - even before EAL init is called - and is then immutable, since our HW should not change much underneath us. Its early availability means that it can be used to sanity check the contents of the other structs as they are being built up.

- eal_user_cfg - contains the config settings passed in by the user. For existing rte_eal_init, this is built up in the arg parse stage, and it's contents verified against the platform info, e.g. to check core masks are valid etc. Once argument parsing is completed, is also immutable.

- runtime_cfg - basically all the runtime settings that need to be there for DPDK to run, or which change over time. Largely combined content of the old rte_config, internal_config and lcore_config structs. This is initialized from the other two structs by eal initialization and can be modified by EAL at any time.

Part 2: Cleanup and Split EAL init

With the 3 structs clearly separated by purpose, we can then do some cleanup of the code, before - in patches 35 & 36 - splitting EAL into two and providing an *internal* struct-based alternative API for initializing DPDK. The old rte_eal_init function still exists, just the contents of it after the argument parsing are put into a new, static eal_runtime_init() function, which take the argparse output (user_cfg struct). Patch 36, adds a thin internal-API wrapper around this static, which is necessary to take care of things like the run-once flag. [This wrapper should never be the public API, since the struct will change and therefore be an ABI break. It's designed to be used by other wrapper libs which provide a stable ABI for config]

Part 3: Prototype of an eal_cfg library

Once we have the internal C API to init eal using a struct rte_eal_user_cfg, we can create new libraries which provide alternate ways to build up the user_cfg and initialize DPDK. Patches 37-44 have a rough example of such a library.

- The lib allows a user to create an opaque rte_eal_user_cfg struct, which can then be modified by APIs to get/set various parameters before calling rte_cfg_eal_init().
- An alternative way to do things (not prototyped), may be to have a library that creates an eal_user_cfg struct based on the contents of an ini file using the configfile library.
[Both these options could be used in parallel. Note too that both have no ABI implications for adding new flags, or making old ones no-ops!]

Bruce Richardson (44):
eal: define new functionally distinct config structs
eal: move memory request fields to user config
eal: move NUMA request fields to user config
eal: move hugepage policy fields to user config
eal: move process policy fields to user config
eal: move advanced user config options to user cfg struct
eal: move hugepage size info to platform info struct
telemetry: make cpuset init parameter const
eal: move runtime state to appropriate structure
eal: record details of all cpus in platform info
eal: use platform info for lcore lookups
eal: add RTE_CPU_FFS macro
eal: store lcore configuration in runtime data
eal: cleanup CPU init function
eal: move numa node information to platform info struct
eal: move lcore role and count to runtime state
eal: make lcore role a field in lcore config struct
eal: move main lcore setting to runtime config struct
eal: move iova mode and process type to runtime cfg
eal: move memory config pointer to runtime state struct
eal: remove rte_config structure
eal: separate runtime state update from arg parsing
eal: move devopt_list staging list into user_cfg
eal: separate plugin paths from loaded plugin objects
eal: simplify internal driver path iteration APIs
eal: move trace config into user config struct
eal: record service cores in user config struct
eal: store user-provided lcore info in user config struct
eal: clarify docs on params taking lcore IDs
eal: remove internal config reset function
eal: move functions setting runtime state
eal: initialize platform info on first use
eal: remove duplicated scan of sysfs for hugepage details
eal: add utilities for working with user config struct
eal: split EAL init into two stages
eal: provide hooks for init with externally supplied config
eal_cfg: add new library to programmatically init DPDK
eal_cfg: configure defaults for easier testing and use app/test: enable testing init using EAL config lib
eal_cfg: add basic setters and getters
eal_cfg: add hugepage memory configuration
eal_cfg: support configuring lcores
eal_cfg: support device and driver lists
eal_cfg: add APIs for configuring remaining init settings

 app/test/meson.build                      |    1 +
 app/test/process.h                        |    4 +-
 app/test/test.c                           |   14 +-
 app/test/test.h                           |    1 +
 app/test/test_eal_cfg.c                   | 1323 +++++++++++++++++++++
 doc/api/doxy-api-index.md                 |    1 +
 doc/api/doxy-api.conf.in                  |    1 +
 doc/guides/linux_gsg/eal_args.include.rst |   38 +-
 doc/guides/prog_guide/eal_cfg_lib.rst     |   23 +
 doc/guides/prog_guide/index.rst           |    1 +
 lib/eal/common/eal_common_bus.c           |    4 +-
 lib/eal/common/eal_common_config.c        |  221 +++-
 lib/eal/common/eal_common_dynmem.c        |   66 +-
 lib/eal/common/eal_common_fbarray.c       |   10 +-
 lib/eal/common/eal_common_launch.c        |   25 +-
 lib/eal/common/eal_common_lcore.c         |  230 ++--
 lib/eal/common/eal_common_mcfg.c          |   44 +-
 lib/eal/common/eal_common_memalloc.c      |    5 +-
 lib/eal/common/eal_common_memory.c        |  104 +-
 lib/eal/common/eal_common_memzone.c       |   24 +-
 lib/eal/common/eal_common_options.c       |  823 +++++--------
 lib/eal/common/eal_common_proc.c          |   43 +-
 lib/eal/common/eal_common_tailqs.c        |    6 +-
 lib/eal/common/eal_common_thread.c        |   81 +-
 lib/eal/common/eal_common_timer.c         |    2 +-
 lib/eal/common/eal_common_trace.c         |   30 +-
 lib/eal/common/eal_common_trace_utils.c   |  104 --
 lib/eal/common/eal_hugepages.h            |    8 +
 lib/eal/common/eal_internal_cfg.h         |  376 +++++-
 lib/eal/common/eal_memcfg.h               |    3 +
 lib/eal/common/eal_option_list.h          |    6 +-
 lib/eal/common/eal_options.h              |    7 +-
 lib/eal/common/eal_private.h              |  108 +-
 lib/eal/common/eal_trace.h                |   11 -
 lib/eal/common/malloc_elem.c              |   15 +-
 lib/eal/common/malloc_heap.c              |   41 +-
 lib/eal/common/malloc_mp.c                |    2 +-
 lib/eal/common/rte_malloc.c               |   14 +-
 lib/eal/common/rte_service.c              |   17 +-
 lib/eal/freebsd/eal.c                     |  271 +++--
 lib/eal/freebsd/eal_hugepage_info.c       |   71 +-
 lib/eal/freebsd/eal_lcore.c               |   16 +-
 lib/eal/freebsd/eal_memory.c              |   46 +-
 lib/eal/freebsd/include/rte_os.h          |    2 +
 lib/eal/include/rte_eal.h                 |   35 +-
 lib/eal/include/rte_memzone.h             |   10 +-
 lib/eal/include/rte_tailq.h               |    2 +-
 lib/eal/linux/eal.c                       |  280 +++--
 lib/eal/linux/eal_hugepage_info.c         |  219 ++--
 lib/eal/linux/eal_lcore.c                 |   13 +
 lib/eal/linux/eal_memalloc.c              |  168 ++-
 lib/eal/linux/eal_memory.c                |  153 ++-
 lib/eal/linux/eal_timer_hpet.c            |   21 +-
 lib/eal/linux/eal_vfio.c                  |   11 +-
 lib/eal/linux/include/rte_os.h            |   10 +
 lib/eal/unix/eal_unix_thread.c            |   11 +-
 lib/eal/windows/eal.c                     |  177 ++-
 lib/eal/windows/eal_hugepages.c           |   60 +-
 lib/eal/windows/eal_lcore.c               |    6 +
 lib/eal/windows/eal_memalloc.c            |   37 +-
 lib/eal/windows/eal_memory.c              |   14 +-
 lib/eal/windows/eal_thread.c              |   11 +-
 lib/eal/windows/eal_windows.h             |    8 -
 lib/eal/windows/include/rte_os.h          |    1 +
 lib/eal/windows/include/sched.h           |   10 +
 lib/eal_cfg/eal_cfg.c                     |  918 ++++++++++++++
 lib/eal_cfg/meson.build                   |    6 +
 lib/eal_cfg/rte_eal_cfg.h                 |  903 ++++++++++++++
 lib/meson.build                           |    1 +
 lib/telemetry/telemetry.c                 |    4 +-
 lib/telemetry/telemetry_internal.h        |    2 +-
 71 files changed, 5450 insertions(+), 1884 deletions(-)
 create mode 100644 app/test/test_eal_cfg.c
 create mode 100644 doc/guides/prog_guide/eal_cfg_lib.rst
 create mode 100644 lib/eal_cfg/eal_cfg.c
 create mode 100644 lib/eal_cfg/meson.build
 create mode 100644 lib/eal_cfg/rte_eal_cfg.h

--
2.51.0