On Tue, Sep 15, 2026 at 11:05:06AM -0400, Randy L Tice wrote:
> Some applications need to derive socket-specific EAL configuration
> from OS CPU IDs before EAL lcore IDs are useful. One example is
> building socket memory policy from the CPUs available to the process.
> 
> Existing public socket APIs do not cover this directly. rte_socket_id()
> reports the calling thread socket, while rte_lcore_to_socket_id()
> requires an EAL lcore ID and uses EAL lcore configuration.
> 
> Add experimental rte_cpu_socket_id() as a public API for mapping an OS
> logical CPU ID to the NUMA socket containing that CPU. The
> implementation reuses the existing per-OS EAL lookup internally, while
> keeping the eal_cpu_socket_id() helper private to EAL.
> 
> v2:
> - Mark rte_cpu_socket_id() experimental in the declaration, export
>   macro, release note and commit message.
> 
> Randy L Tice (1):
>   eal: add API to get CPU socket ID
> 
>  .mailmap                               |  1 +
>  doc/guides/rel_notes/release_26_11.rst |  3 +++
>  lib/eal/common/eal_common_lcore.c      |  7 +++++++
>  lib/eal/include/rte_lcore.h            | 18 ++++++++++++++++++
>  4 files changed, 29 insertions(+)
> 
I think this support is a good idea.

JFYI, something similar should be possible (or else easily added, I hope)
if patchset [1] ever makes it into DPDK. One of the goals of that patchset
is to have hardware information querying possible before initialization of
EAL. This ties in with the overall goal of alternative init paths for DPDK,
as having hardware querying available allows sanity checking of args as
they are added, rather than just as EAL init time.

/Bruce

[1] https://patches.dpdk.org/project/dpdk/list/?series=39005

Reply via email to