aws / aws-nitro-enclaves-cli

Tooling for Nitro Enclave Management
Apache License 2.0
116 stars 78 forks source link

Remove dependency on topology_core_id for splitting cpu pool #560

Closed clupuishere closed 7 months ago

clupuishere commented 7 months ago

The topology_core_id(cpu) function, which generates the core id used for splitting the CPU pool and indexing ne_cpu_pool.avail_threads_per_core, return different values depending on the architecture on which it is run.

To address this problem, this commit removes the dependency on topology_core_id and modifies the logic for splitting the cpu pool. Now, topology_sibling_cpumask is called for each cpu. If a cpu has not yet been added to ne_cpu_pool.avail_threads_per_core, its siblings are checked to see if they are part of the cpu pool and have not yet been added. If so, they are added to the corresponding core.

This change ensures that the cpu pool is properly split and indexed regardless of the architecture.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.