On Thu, Oct 20, 2022 at 10:03:01PM +0200, Michael Pfeiffer wrote: > On Thu, 2022-10-20 at 08:36 -0700, Stephen Hemminger wrote: > > On Thu, 20 Oct 2022 13:20:40 +0200 > > David Marchand <david.march...@redhat.com> wrote: > > > > > On Fri, Oct 14, 2022 at 9:54 AM Markus Theil <markus.th...@tu-ilmenau.de> > > > wrote: > > > > > > > > From: Michael Pfeiffer <michael.pfeif...@tu-ilmenau.de> > > > > > > > > Also expose the pthread id of each lcore, in > > > > order to allow modification of pthread attributes, > > > > for example use rte_thread_setname without executing > > > > pthread_self() on the maybe already running lcore. > > > > > > > > The rte_lcore_to_thread_id function is added to API. > > > > > > > > Signed-off-by: Michael Pfeiffer <michael.pfeif...@tu-ilmenau.de> > > > > > > We are trying to abstract the use of pthread in DPDK API. > > > So I don't think this patch is going in the right direction. > > > > Agree, exposing this will make Windows support harder > > and who knows what next OS to come will need. > > Hi, > thanks for your feedback. I understand your concerns regarding abstraction and > portability. > > Markus and I ultimately use the function in the patch to call > rte_thread_setname() (which takes the pthread id as an argument) to rename our > lcore workers from "lcore-worker-X" to something more meaningful in the scope > of our application. Having descriptive thread names makes debugging > significantly easier. For example, verifying CPU pinning worked as intended > with ps -T ..., or identifying threads in the Intel VTune profiler. > > Would you consider something like > - int rte_lcore_setname(unsigned int lcore_id, const char *name) > - int rte_lcore_getname(unsigned int lcore_id, char *name, size_t len) > a more appropriate API? That would still allow us to set names from the main > lcore, but would not expose any pthread internals.
if only setname, getname are needed for rte_thread_t i imagine it shouldn't be too objectionable to add them to rte_thread.h you can either wait until i have time to do it (could be a while) or you can put a new patch + unit test together. if testing the windows implementation part of the addition is a barrier i can apply and run the supplied unit test, assist with review. > > Thanks & regards > Michael