DPDK usage discussions
 help / color / mirror / Atom feed
* Accessing TLS for EAL threads
@ 2021-11-16 17:38 Antonio Di Bacco
  2021-11-18  7:36 ` Pavel Vazharov
  2021-11-18 16:26 ` Stephen Hemminger
  0 siblings, 2 replies; 3+ messages in thread
From: Antonio Di Bacco @ 2021-11-16 17:38 UTC (permalink / raw)
  To: users

[-- Attachment #1: Type: text/plain, Size: 318 bytes --]

I need to emulate the pthread_setspecific and pthread_getspecific for EAL threads. I don't find any suitable APIs in the DPDK to access the TLS and get and set keys.

I launched a number of threads using the rte_eal_remote launch but I don't find any API that allows me to access the TLS for those threads.





[-- Attachment #2: Type: text/html, Size: 2019 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Accessing TLS for EAL threads
  2021-11-16 17:38 Accessing TLS for EAL threads Antonio Di Bacco
@ 2021-11-18  7:36 ` Pavel Vazharov
  2021-11-18 16:26 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Vazharov @ 2021-11-18  7:36 UTC (permalink / raw)
  To: Antonio Di Bacco; +Cc: users

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

Hi there,

I think the DPDK uses the pthread_ functions to manages its threads. You
can see in `rte_eal_init` in `lib/librte_eal/linux/eal.c` that it "spawns"
the threads using
```
        /* create a thread for each lcore */

        ret = pthread_create(&lcore_config[i].thread_id, NULL,

                     eal_thread_loop, NULL);
```
So I think you should be able to use other pthread_ functions without
problems from inside the EAL threads.
Hope that helps.

Regards,
Pavel.

On Thu, Nov 18, 2021 at 9:24 AM Antonio Di Bacco <
antonio.di-bacco@keysight.com> wrote:

> I need to emulate the pthread_setspecific and pthread_getspecific for EAL
> threads. I don’t find any suitable APIs in the DPDK to access the TLS and
> get and set keys.
>
>
>
> I launched a number of threads using the rte_eal_remote launch but I don’t
> find any API that allows me to access the TLS for those threads.
>
>
>
>
>
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 1837 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Accessing TLS for EAL threads
  2021-11-16 17:38 Accessing TLS for EAL threads Antonio Di Bacco
  2021-11-18  7:36 ` Pavel Vazharov
@ 2021-11-18 16:26 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2021-11-18 16:26 UTC (permalink / raw)
  To: Antonio Di Bacco; +Cc: users

On Tue, 16 Nov 2021 17:38:43 +0000
Antonio Di Bacco <antonio.di-bacco@keysight.com> wrote:

> I need to emulate the pthread_setspecific and pthread_getspecific for EAL threads. I don't find any suitable APIs in the DPDK to access the TLS and get and set keys.
> 
> I launched a number of threads using the rte_eal_remote launch but I don't find any API that allows me to access the TLS for those threads.

There is not an API for a thread to access another threads local storage directly.
The DPDK TLS is wrapper around the glibc (and Windows) implementation of TLS.

For particular data structures, you can create a global data structure that is an
array of pointers indexed by lcore, and each lcore fills in itself.

Or do a more complex API via message passing.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-18 16:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 17:38 Accessing TLS for EAL threads Antonio Di Bacco
2021-11-18  7:36 ` Pavel Vazharov
2021-11-18 16:26 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).