Skip to contentSkip to conversation

eal: store control thread CPU affinity in TLS

PATCH Applied [email protected] 2 participants 3 messages Feb 5, 2020 – Mar 25, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: store control thread CPU affinity in TLS

From: Jerin Jacob <[email protected]>

_cpuset TLS variable stores the CPU affinity of eal thread. Populate the _cpuset TLS variable for control thread to

1) Make rte_thread_get_affinity() and eal_thread_dump_affinity functional with control thread.
2) Quick access to cpu affinity.

---
 lib/librte_eal/common/eal_common_thread.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/librte_eal/common/eal_common_thread.c +4 -0
index 78581753c..99fe1aa4e 100644
@@ -152,10 +152,14 @@ struct rte_thread_ctrl_params {
 static void *rte_thread_init(void *arg)
 {
 	int ret;
+	rte_cpuset_t *cpuset = &internal_config.ctrl_cpuset;
 	struct rte_thread_ctrl_params *params = arg;
 	void *(*start_routine)(void *) = params->start_routine;
 	void *routine_arg = params->arg;
 
+	/* Store cpuset in TLS for quick access */
+	memmove(&RTE_PER_LCORE(_cpuset), cpuset, sizeof(rte_cpuset_t));
+
 	ret = pthread_barrier_wait(&params->configured);
 	if (ret == PTHREAD_BARRIER_SERIAL_THREAD) {
 		pthread_barrier_destroy(&params->configured);
Signature · 1 line
2.24.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · On Wed, Feb 5, 2020 at 11:24 AM <[email protected]> wrote:

From: Jerin Jacob <[email protected]>

_cpuset TLS variable stores the CPU affinity of eal thread. Populate the _cpuset TLS variable for control thread to

1) Make rte_thread_get_affinity() and eal_thread_dump_affinity functional with control thread.
2) Quick access to cpu affinity.

---
 lib/librte_eal/common/eal_common_thread.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/librte_eal/common/eal_common_thread.c +1 -0
index 78581753c..99fe1aa4e 100644
@@ -152,10 +152,14 @@ struct rte_thread_ctrl_params {
 static void *rte_thread_init(void *arg)
 {
        int ret;
+       rte_cpuset_t *cpuset = &internal_config.ctrl_cpuset;

lib/librte_eal/common/eal_common_thread.c struct rte_thread_ctrl_params { · line 165

Quoted 10 lines
lib/librte_eal/common/eal_common_thread.c +3 -0
        struct rte_thread_ctrl_params *params = arg;
        void *(*start_routine)(void *) = params->start_routine;
        void *routine_arg = params->arg;
 
+       /* Store cpuset in TLS for quick access */
+       memmove(&RTE_PER_LCORE(_cpuset), cpuset, sizeof(rte_cpuset_t));
+
        ret = pthread_barrier_wait(&params->configured);
        if (ret == PTHREAD_BARRIER_SERIAL_THREAD) {
                pthread_barrier_destroy(&params->configured);
Signature · 1 line
David Marchand
#2 lore raw
Quoted 7 lines · David Marchand
Quoted 6 lines · On Wed, Feb 5, 2020 at 11:24 AM <[email protected]> wrote:

From: Jerin Jacob <[email protected]>

_cpuset TLS variable stores the CPU affinity of eal thread. Populate the _cpuset TLS variable for control thread to

Quoted 6 lines
Quoted 5 lines

1) Make rte_thread_get_affinity() and eal_thread_dump_affinity functional with control thread.
2) Quick access to cpu affinity.

Applied, thanks.

Signature · 1 line
David Marchand