RFC Allow intitializing EAL without argc/argv
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest44 patches 5 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/44 | eal: define new functionally distinct config structslib/ lib/ | +59 | 2 replies | |
| 2/44 | eal: move memory request fields to user configlib/ lib/ lib/ +7 more | +56 | 0 replies | |
| 3/44 | eal: move NUMA request fields to user configlib/ lib/ lib/ +5 more | +38 | 0 replies | |
| 4/44 | eal: move hugepage policy fields to user configlib/ lib/ lib/ +9 more | +67 | 0 replies | |
| 5/44 | eal: move process policy fields to user configlib/ lib/ lib/ +12 more | +132 | 0 replies | |
| 6/44 | eal: move advanced user config options to user cfg structlib/ lib/ lib/ +16 more | +165 | 0 replies | |
| 7/44 | eal: move hugepage size info to platform info structlib/ lib/ lib/ +9 more | +122 | 0 replies | |
| 8/44 | telemetry: make cpuset init parameter constlib/ lib/ | +3 | 0 replies | |
| 9/44 | eal: move runtime state to appropriate structurelib/ lib/ lib/ +8 more | +30 | 0 replies | |
| 10/44 | eal: record details of all cpus in platform infolib/ lib/ lib/ +3 more | +71 | 0 replies | |
| 11/44 | eal: use platform info for lcore lookupslib/ lib/ lib/ | +43 | 0 replies | |
| 12/44 | eal: add RTE_CPU_FFS macrolib/ lib/ lib/ +1 more | +23 | 0 replies | |
| 13/44 | eal: store lcore configuration in runtime datalib/ lib/ lib/ +9 more | +142 | 0 replies | |
| 14/44 | eal: cleanup CPU init functionlib/ | +18 | 0 replies | |
| 15/44 | eal: move numa node information to platform info structlib/ lib/ lib/ | +33 | 0 replies | |
| 16/44 | eal: move lcore role and count to runtime statelib/ lib/ lib/ +2 more | +53 | 0 replies | |
| 17/44 | eal: make lcore role a field in lcore config structlib/ lib/ lib/ +1 more | +31 | 0 replies | |
| 18/44 | eal: move main lcore setting to runtime config structlib/ lib/ lib/ +7 more | +35 | 0 replies | |
| 19/44 | eal: move iova mode and process type to runtime cfglib/ lib/ lib/ +4 more | +17 | 0 replies | |
| 20/44 | eal: move memory config pointer to runtime state structlib/ lib/ lib/ +19 more | +137 | 0 replies | |
| 21/44 | eal: remove rte_config structurelib/ lib/ lib/ +3 more | +24 | 0 replies | |
| 22/44 | eal: separate runtime state update from arg parsinglib/ lib/ lib/ +2 more | +37 | 0 replies | |
| 23/44 | eal: move devopt_list staging list into user_cfglib/ lib/ | +21 | 0 replies | |
| 24/44 | eal: separate plugin paths from loaded plugin objectslib/ lib/ | +158 | 0 replies | |
| 25/44 | eal: simplify internal driver path iteration APIsapp/ lib/ lib/ | +31 | 0 replies | |
| 26/44 | eal: move trace config into user config structlib/ lib/ lib/ +6 more | +87 | 0 replies | |
| 27/44 | eal: record service cores in user config structlib/ lib/ | +43 | 0 replies | |
| 28/44 | eal: store user-provided lcore info in user config structlib/ lib/ lib/ +2 more | +108 | 0 replies | |
| 29/44 | eal: clarify docs on params taking lcore IDsdoc/ lib/ | +38 | 0 replies | |
| 30/44 | eal: remove internal config reset functionlib/ lib/ lib/ +1 more | +21 | 0 replies | |
| 31/44 | eal: move functions setting runtime statelib/ lib/ lib/ +4 more | +175 | 0 replies | |
| 32/44 | eal: initialize platform info on first uselib/ lib/ lib/ +14 more | +323 | 0 replies | |
| 33/44 | eal: remove duplicated scan of sysfs for hugepage detailslib/ lib/ lib/ | +40 | 0 replies | |
| 34/44 | eal: add utilities for working with user config structlib/ lib/ | +153 | 0 replies | |
| 35/44 | eal: split EAL init into two stageslib/ lib/ lib/ +2 more | +149 | 0 replies | |
| 36/44 | eal: provide hooks for init with externally supplied configlib/ lib/ lib/ +9 more | +168 | 0 replies | |
| 37/44 | eal_cfg: add new library to programmatically init DPDKapp/ app/ doc/ +7 more | +276 | 0 replies | |
| 38/44 | eal_cfg: configure defaults for easier testing and uselib/ lib/ | +133 | 0 replies | |
| 39/44 | app/test: enable testing init using EAL config libapp/ app/ app/ | +86 | 0 replies | |
| 40/44 | eal_cfg: add basic setters and gettersapp/ lib/ lib/ | +1034 | 0 replies | |
| 41/44 | eal_cfg: add hugepage memory configurationapp/ lib/ lib/ | +489 | 0 replies | |
| 42/44 | eal_cfg: support configuring lcoresapp/ lib/ lib/ | +408 | 0 replies | |
| 43/44 | eal_cfg: support device and driver listsapp/ app/ lib/ +1 more | +293 | 0 replies | |
| 44/44 | eal_cfg: add APIs for configuring remaining init settingsapp/ lib/ lib/ | +515 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
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