On 2020-07-14 15:08, Van Haaren, Harry wrote: >> -----Original Message----- >> From: dev <dev-boun...@dpdk.org> On Behalf Of Mattias Rönnblom >> Sent: Tuesday, July 14, 2020 1:04 PM >> To: dpdk-dev <dev@dpdk.org> >> Cc: Tomasz Piatkowski <tomasz.piatkow...@ericsson.com> >> Subject: [dpdk-dev] Retrieving lcore worker thread id >> >> Hi. > Hey, > >> In DPDK 19.11, the lcore_config struct of <rte_lcore.h> is made private, >> and with it the possibility to look up the thread id of the lcore worker >> threads disappears. >> >> One use case is an application with a monitoring function (on some >> control plane thread), which uses the thread ids to make sure the worker >> threads gets the CPU runtime they should, and thus is able to detect >> stalls. >> >> Is there some other way of finding out the thread_id of a lcore worker >> thread? All I can think of are hacks like using a temporary service >> function for service cores, in combination with requiring launched >> application threads also to store their thread id in some global >> structure (index by lcore_id). > -1 for the service cores idea. I like the creative solution thinking, > but not as a long-term solution. > >> Is there some cleaner way? If not, would adding something like a >> rte_lcore_thread_id() function make sense? > I think given your use-case description above, this makes sense. > I guess it comes down to a discussion around if thread_id should > be exposed at all - but given you have a use I'd argue yes it should. > Doing so in a cross-platform way might be a bit tricky though. >
With the Windows port ongoing, I guess that's a valid concern. <rte_lcore.h> already is a heavy user of pthread ids though. Maybe you would leave that change to a later patch, which would typedef the whole thing into something DPDK specific and portable. Regards, Mattias