eal/windows: set Windows main lcore affinitization
PATCH 1/1 eal/windows: set Windows main lcore affinitization
add missing code to affinitize main_lcore from lcore configuration.
--- lib/eal/windows/eal.c | 6 ++++++ 1 file changed, 6 insertions(+)
lib/eal/windows/eal.c +6 -0
@@ -401,6 +401,12 @@ enum rte_proc_type_treturn -1 ; } +if (pthread_setaffinity_np (pthread_self (),sizeof (rte_cpuset_t), + &lcore_config[config->main_lcore].cpuset) !=0 ) { +rte_eal_init_alert ("Cannot set affinity" ); + rte_errno =EINVAL ; +return -1 ; + }__rte_thread_init (config->main_lcore, &lcore_config[config->main_lcore].cpuset);
Signature · 1 line
1.8.3.1
Hello Tyler,
Quoted 2 lines · Tyler Retzlaff
add missing code to affinitize
main_lcorefrom lcore configuration.
Nit: Add*
Quoted 13 lines
Signed-off-by Tyler Retzlaff <[email protected]>--- lib/eal/windows/eal.c | 6 ++++++ 1 file changed, 6 insertions(+)lib/eal/windows/eal.c +0
-0@@ -401,6 +401,12 @@ enum rte_proc_type_treturn -1 ; }
lib/eal/windows/eal.c enum rte_proc_type_t · line 412
Quoted 10 lines
lib/eal/windows/eal.c +6
-0+if (pthread_setaffinity_np (pthread_self (),sizeof (rte_cpuset_t), + &lcore_config[config->main_lcore].cpuset) !=0 ) { +rte_eal_init_alert ("Cannot set affinity" ); + rte_errno =EINVAL ; +return -1 ; + }__rte_thread_init (config->main_lcore, &lcore_config[config->main_lcore].cpuset);
- It looks like the affinity is dumped for workers (see below), I would dump affinity for the main lcore like other OS do:
ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset));
RTE_LOG(DEBUG, EAL, "Main lcore %u is ready (tid=%p;cpuset=[%s%s])\n",
config->main_lcore, thread_id, cpuset,
ret == 0 ? "" : "...");- Which makes me notice that windows/eal_thread.c probably dumps random stuff in logs because it is missing a call to eal_thread_dump_current_affinity() to format affinity as a string.
lib/eal/windows/eal_thread.c: char cpuset[RTE_CPU_AFFINITY_STR_LEN]; lib/eal/windows/eal_thread.c: __rte_thread_init(lcore_id,
&lcore_config[lcore_id].cpuset);lib/eal/windows/eal_thread.c: RTE_LOG(DEBUG, EAL, "lcore %u is ready
(tid=%zx;cpuset=[%s])\n",lib/eal/windows/eal_thread.c: lcore_id, (uintptr_t)thread_id, cpuset);
Signature · 1 line
David Marchand
Quoted 23 lines · David Marchand
Hello Tyler,
Quoted 2 lines · Tyler Retzlaff
add missing code to affinitize
main_lcorefrom lcore configuration.Nit: Add*
Quoted 14 lines
Signed-off-by Tyler Retzlaff <[email protected]>--- lib/eal/windows/eal.c | 6 ++++++ 1 file changed, 6 insertions(+)lib/eal/windows/eal.c +0
-0@@ -401,6 +401,12 @@ enum rte_proc_type_treturn -1 ; }
Quoted 12 lines
lib/eal/windows/eal.c enum rte_proc_type_t · line 412
Quoted 9 lines
lib/eal/windows/eal.c +6
-0+if (pthread_setaffinity_np (pthread_self (),sizeof (rte_cpuset_t), + &lcore_config[config->main_lcore].cpuset) !=0 ) { +rte_eal_init_alert ("Cannot set affinity" ); + rte_errno =EINVAL ; +return -1 ; + }__rte_thread_init (config->main_lcore, &lcore_config[config->main_lcore].cpuset);- It looks like the affinity is dumped for workers (see below), I would dump affinity for the main lcore like other OS do:
yep, it's missing i should have noticed that. i'll submit a new version to dump the affinity for the main lcore.
Quoted 11 lines
ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset)); RTE_LOG(DEBUG, EAL, "Main lcore %u is ready (tid=%p;cpuset=[%s%s])\n", config->main_lcore, thread_id, cpuset, ret == 0 ? "" : "...");- Which makes me notice that
windows/eal_thread.cprobably dumps random stuff in logs because it is missing a call toeal_thread_dump_current_affinity()to format affinity as a string.
oh yeah, that's not so good.
i think the series you submitted for eal_thread_loop should resolve this shouldn't it? shall we ride your change to fix the issue or do you feel it's worth me adding the missing call in this series?
--
ty
Hello Tyler,
Quoted 9 lines · Tyler Retzlaff
Quoted 3 lines
- Which makes me notice that
windows/eal_thread.cprobably dumps random stuff in logs because it is missing a call toeal_thread_dump_current_affinity()to format affinity as a string.oh yeah, that's not so good.
i think the series you submitted for
eal_thread_loopshould resolve this shouldn't it? shall we ride your change to fix the issue or do you feel it's worth me adding the missing call in this series?
This issue here is only for a log on cpu affinity.
Lcores cpu affinity is not correct for Windows in LTS releases, in any case. So let's keep it as is and don't bother fixing it.
I'll add a note in my series about this log and apply it.
I marked this current patch as "Changes requested", wrt to my first comment.
Signature · 1 line
David Marchand
PATCH v2 1/1 eal/windows: set Windows main lcore affinitization
In reply to Tyler Retzlaffadd missing code to affinitize main_lcore from lcore configuration.
---
v2: RTE_LOG of eal_thread_dump_current_affinity as linux does
lib/eal/windows/eal.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
lib/eal/windows/eal.c +12 -0
@@ -279,6 +279,7 @@ rte_eal_init(int argc, char **argv)bool has_phys_addr;enum rte_iova_mode iova_mode;int ret; +char cpuset[RTE_CPU_AFFINITY_STR_LEN ];eal_log_init (NULL ,0 );
@@ -401,9 +402,20 @@ rte_eal_init(int argc, char **argv)return -1 ; } +if (pthread_setaffinity_np (pthread_self (),sizeof (rte_cpuset_t), + &lcore_config[config->main_lcore].cpuset) !=0 ) { +rte_eal_init_alert ("Cannot set affinity" ); + rte_errno =EINVAL ; +return -1 ; + }__rte_thread_init (config->main_lcore, &lcore_config[config->main_lcore].cpuset); + ret =eal_thread_dump_current_affinity (cpuset,sizeof (cpuset)); +RTE_LOG (DEBUG ,EAL ,"Main lcore %u is ready (tid=%zx;cpuset=[%s%s])\n" , + config->main_lcore, (uintptr_t )pthread_self (), cpuset, + ret ==0 ?"" :"..." ); +RTE_LCORE_FOREACH_WORKER (i) {/*
Signature · 1 line
2.33.0.vfs.0.0
PATCH v3 1/1 eal/windows: set Windows main lcore affinitization
In reply to Tyler RetzlaffAdd missing code to affinitize main_lcore from lcore configuration.
---
v3: update commit message s/add/Add/
v2: RTE_LOG of eal_thread_dump_current_affinity as linux does
lib/eal/windows/eal.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
lib/eal/windows/eal.c +12 -0
@@ -279,6 +279,7 @@ enum rte_proc_type_tbool has_phys_addr;enum rte_iova_mode iova_mode;int ret; +char cpuset[RTE_CPU_AFFINITY_STR_LEN ];eal_log_init (NULL ,0 );
@@ -401,9 +402,20 @@ enum rte_proc_type_treturn -1 ; } +if (pthread_setaffinity_np (pthread_self (),sizeof (rte_cpuset_t), + &lcore_config[config->main_lcore].cpuset) !=0 ) { +rte_eal_init_alert ("Cannot set affinity" ); + rte_errno =EINVAL ; +return -1 ; + }__rte_thread_init (config->main_lcore, &lcore_config[config->main_lcore].cpuset); + ret =eal_thread_dump_current_affinity (cpuset,sizeof (cpuset)); +RTE_LOG (DEBUG ,EAL ,"Main lcore %u is ready (tid=%zx;cpuset=[%s%s])\n" , + config->main_lcore, (uintptr_t )pthread_self (), cpuset, + ret ==0 ?"" :"..." ); +RTE_LCORE_FOREACH_WORKER (i) {/*
Signature · 1 line
1.8.3.1
Quoted 4 lines · Tyler Retzlaff
Add missing code to affinitize
main_lcorefrom lcore configuration.Signed-off-by Tyler Retzlaff <[email protected]>
Signature · 1 line
David Marchand
David Marchand
AppliedQuoted 8 lines · David Marchand
Quoted 4 lines · Tyler Retzlaff
Add missing code to affinitize
main_lcorefrom lcore configuration.Signed-off-by Tyler Retzlaff <[email protected]>Reviewed-by David Marchand <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand