DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Roger B. Melton" <rmelton@cisco.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2] eal: fix compile error for old glibc caused by pthread_setname_np()
Date: Wed, 25 Nov 2015 08:51:35 -0500	[thread overview]
Message-ID: <5655BCE7.2060206@cisco.com> (raw)
In-Reply-To: <1448450035-23991-1-git-send-email-ferruh.yigit@intel.com>



> +/**
> + * Set thread names.
> + *
> + * Macro to wrap `pthread_setname_np()` with a glibc version check.
> + * Only glibc >= 2.12 supports this feature.
> + *
> + * This macro only used for Linux, BSD does direct libc call.
> + * BSD libc version of function is `pthread_set_name_np()`.
> + */
> +#if defined(__DOXYGEN__)
> +#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__)
> +#endif
> +
> +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
> +#if __GLIBC_PREREQ(2, 12)
> +#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__)
> +#else
> +#define rte_thread_setname(...) 0
> +#endif
> +#endif

Have you thought about a way to set thread name when glibc < 2.12.  I 
also ran into the problem recently and played around with prctl() 
(Linux) to set thread (process) name.  e.g.

    ret = prctl(PR_SET_NAME,<thread_name>,0,0,0);


There are 2 issues I think:

    1) The semantics are different than prthread_setname_np().  With
    pthread_setname_np() a name can be assigned to any thread, with
    prctl() the name is assigned to the active thread.  That would mean
    that rather than rte_eal_init(), rte_eal_intr_init() could not
    assign thread names.  Rather the threads would have to name themselves.

    2) I think BSD lacks prctl(), but some (not all?) BSD
    implementations have setproctitle() to do the same thing.


It might be too late for 2.2, but something to think about for the future.

Regards,
Roger

  parent reply	other threads:[~2015-11-25 13:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 13:32 [dpdk-dev] Compile errors with libc < 2.12 Ferruh Yigit
2015-11-18 14:24 ` Thomas Monjalon
2015-11-19 11:22   ` [dpdk-dev] [PATCH] Revert "eal: set name to threads" Ferruh Yigit
2015-11-19 11:49     ` Panu Matilainen
2015-11-19 12:32       ` Thomas Monjalon
2015-11-19 13:39         ` Ferruh Yigit
2015-11-19 16:59           ` Ferruh Yigit
2015-11-19 17:44             ` [dpdk-dev] [PATCH] eal: fix compile error for old glibc caused by pthread_setname_np() Ferruh Yigit
2015-11-20 12:21               ` [dpdk-dev] [PATCH] eal: fix compile error for old glibc caused by pthread_setname_np()# Bruce Richardson
2015-11-24 14:26                 ` Ferruh Yigit
2015-11-24 17:54               ` [dpdk-dev] [PATCH] eal: fix compile error for old glibc caused by pthread_setname_np() Thomas Monjalon
2015-11-24 18:47                 ` Ferruh Yigit
2015-11-25 11:13                   ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2015-11-25 11:18                     ` Thomas Monjalon
2015-11-25 11:24                       ` Ferruh Yigit
2015-11-25 11:30                         ` Thomas Monjalon
2015-11-25 13:41                     ` Thomas Monjalon
2015-11-25 13:51                     ` Roger B. Melton [this message]
2015-11-25 14:03                       ` Thomas Monjalon
2015-11-25 14:20                         ` Roger B. Melton
2015-11-19 11:23   ` [dpdk-dev] [PATCH] eal: fix compile error for old glibc caused by CLOCK_MONOTONIC_RAW Ferruh Yigit
2015-11-20 17:02     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5655BCE7.2060206@cisco.com \
    --to=rmelton@cisco.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).