From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4BAD142409; Wed, 18 Jan 2023 07:28:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2D1EB40DFD; Wed, 18 Jan 2023 07:28:54 +0100 (CET) Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) by mails.dpdk.org (Postfix) with ESMTP id 408E54003F for ; Wed, 18 Jan 2023 07:28:53 +0100 (CET) Received: by mail-ua1-f51.google.com with SMTP id a40so1537035uad.12 for ; Tue, 17 Jan 2023 22:28:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Fkva/+ivZD5lYsgFbr/S75MyPlZfsYl1C4Gsq+bBKMc=; b=XtO/wTkrKV3lq1OA732W47vDPPkqTQsrxnkgEviaR/WmtzrKBXtqH3+xdjLWDNVrRY yx2ZKh5D/9cBXnDt9Gb24SxWUlVRjaYI642PsIw7UTC1MHtX7oX/SwppxWfkJxlhlt0t tMqm7G4aPw2r6uXhwPc7skTqne0Y3/gko+KvPVX6fLZN7zQsyxHqayhaKM1k13MJDsoK Z122LJSjCCV7W3Z0RA6fNxUGfxh4xvHFufo/2JByzVwKgxh1aqcTwsSFMnozNKLFwYGM MsfP1pAMTQqYMrxN7MPvw8LGbr5iR07nKHWKeHi6Eyhnsq7usYyNiVnxAksnWmO6wDMs Fpow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Fkva/+ivZD5lYsgFbr/S75MyPlZfsYl1C4Gsq+bBKMc=; b=hnU6jPGRRb2ky95ULcinDM+fD0+WGNErIzx4oaoBOdPbrfDTRydpUn4RbRMS3VAHMO 4P8+h4FjL1ahFLkBR307Fy19qU9noWoLUOUBYA0b6NvzDZo6w06VMU2clpf4xntIKUdJ 6MDBZ6X4yawK6AqbbAGG0JWrPeYIv7NN9oWNHpM4M8vk3dyuy9MvCxAdSjQ37ZQthvqL eAnEoJxCUnTIIqU1BM+ysp28NX5dUvRJUCUD2uA7eq4SydgSRTX9naVjJU50FYOy/8lP DZGv2ixzajLSnxDwVFhOHEjg9x4aip2kNTjqx7PJiQY1BywI/E8B7KfmH/Scq3dt271p gyaw== X-Gm-Message-State: AFqh2koGAYni69eZBANbrPveYiqTYWOAIwpAio9bk1fdL/616l3wyX7C PrebgWUX0/9ovFf5muxK5koK8zIeVHwRa2L3rYo= X-Google-Smtp-Source: AMrXdXvjPa2LFmwDVu3DWZ0hNNH+G/WMUwpZvv3BtXRg59eLE0mMsNENeVqaGrBdyDpi8Ovmd2MbXBjOcl5LS67Oax0= X-Received: by 2002:ab0:7206:0:b0:5ef:293:84c6 with SMTP id u6-20020ab07206000000b005ef029384c6mr612094uao.52.1674023332562; Tue, 17 Jan 2023 22:28:52 -0800 (PST) MIME-Version: 1.0 References: <1670439617-9054-1-git-send-email-roretzla@linux.microsoft.com> <1673979709-8613-1-git-send-email-roretzla@linux.microsoft.com> <1673979709-8613-3-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1673979709-8613-3-git-send-email-roretzla@linux.microsoft.com> From: Jerin Jacob Date: Wed, 18 Jan 2023 11:58:26 +0530 Message-ID: Subject: Re: [PATCH v5 2/4] eal: remove thread getname API To: Tyler Retzlaff Cc: dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Jan 17, 2023 at 11:51 PM Tyler Retzlaff wrote: > > Remove the rte_thread_getname API. The API is __rte_experimental and > requires no deprecation notice. > > Fold the platform specific variants into the one place it is used as a > special case to retain the functionality for linux only. > > Adjust the function as follows. > * limit use of this very platform glibc specific function to the single > place it is used. > * change the return type to void since the single use cannot > meaningfully check for failure given the platform defined behavior. > * change the thread id type to be rte_thread_t. > * rename the function rte_thread_get_name to be consistent with the > exported rte_thread_set_name. > > Signed-off-by: Tyler Retzlaff Trace changes are looks good to me. For trace, Acked-by: Jerin Jacob > --- > lib/eal/common/eal_common_trace.c | 15 ++++++++++++++- > lib/eal/freebsd/eal_thread.c | 9 --------- > lib/eal/include/rte_lcore.h | 17 ----------------- > lib/eal/linux/eal_thread.c | 15 --------------- > lib/eal/version.map | 1 - > 5 files changed, 14 insertions(+), 43 deletions(-) > > diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c > index 5caaac8..75162b7 100644 > --- a/lib/eal/common/eal_common_trace.c > +++ b/lib/eal/common/eal_common_trace.c > @@ -298,6 +298,19 @@ rte_trace_mode rte_trace_mode_get(void) > trace_point_dump(f, tp); > } > > +static void > +thread_get_name(rte_thread_t id, char *name, size_t len) > +{ > +#if defined(RTE_EXEC_ENV_LINUX) && defined(__GLIBC__) && defined(__GLIBC_PREREQ) > +#if __GLIBC_PREREQ(2, 12) > + pthread_getname_np((pthread_t)id.opaque_id, name, len); > +#endif > +#endif > + RTE_SET_USED(id); > + RTE_SET_USED(name); > + RTE_SET_USED(len); > +} > + > void > __rte_trace_mem_per_thread_alloc(void) > { > @@ -356,7 +369,7 @@ rte_trace_mode rte_trace_mode_get(void) > /* Store the thread name */ > char *name = header->stream_header.thread_name; > memset(name, 0, __RTE_TRACE_EMIT_STRING_LEN_MAX); > - rte_thread_getname(pthread_self(), name, > + thread_get_name(rte_thread_self(), name, > __RTE_TRACE_EMIT_STRING_LEN_MAX); > > trace->lcore_meta[count].mem = header; > diff --git a/lib/eal/freebsd/eal_thread.c b/lib/eal/freebsd/eal_thread.c > index b69f5d3..3227d9b 100644 > --- a/lib/eal/freebsd/eal_thread.c > +++ b/lib/eal/freebsd/eal_thread.c > @@ -49,12 +49,3 @@ int rte_thread_setname(pthread_t id, const char *name) > pthread_set_name_np(id, name); > return 0; > } > - > -int rte_thread_getname(pthread_t id, char *name, size_t len) > -{ > - RTE_SET_USED(id); > - RTE_SET_USED(name); > - RTE_SET_USED(len); > - > - return -ENOTSUP; > -} > diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h > index 6938c3f..9c78650 100644 > --- a/lib/eal/include/rte_lcore.h > +++ b/lib/eal/include/rte_lcore.h > @@ -352,23 +352,6 @@ enum rte_lcore_role_t { > int rte_thread_setname(pthread_t id, const char *name); > > /** > - * Get thread name. > - * > - * @note It fails with glibc < 2.12. > - * > - * @param id > - * Thread id. > - * @param name > - * Thread name to set. > - * @param len > - * Thread name buffer length. > - * @return > - * On success, return 0; otherwise return a negative value. > - */ > -__rte_experimental > -int rte_thread_getname(pthread_t id, char *name, size_t len); > - > -/** > * Register current non-EAL thread as a lcore. > * > * @note This API is not compatible with the multi-process feature: > diff --git a/lib/eal/linux/eal_thread.c b/lib/eal/linux/eal_thread.c > index d5fddab..c07ad9d 100644 > --- a/lib/eal/linux/eal_thread.c > +++ b/lib/eal/linux/eal_thread.c > @@ -55,18 +55,3 @@ int rte_thread_setname(pthread_t id, const char *name) > RTE_SET_USED(name); > return -ret; > } > - > -int rte_thread_getname(pthread_t id, char *name, size_t len) > -{ > - int ret = ENOSYS; > -#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) > -#if __GLIBC_PREREQ(2, 12) > - ret = pthread_getname_np(id, name, len); > -#endif > -#endif > - RTE_SET_USED(id); > - RTE_SET_USED(name); > - RTE_SET_USED(len); > - return -ret; > - > -} > diff --git a/lib/eal/version.map b/lib/eal/version.map > index c98ba71..6523102 100644 > --- a/lib/eal/version.map > +++ b/lib/eal/version.map > @@ -369,7 +369,6 @@ EXPERIMENTAL { > __rte_trace_point_register; > per_lcore_trace_mem; > per_lcore_trace_point_sz; > - rte_thread_getname; # WINDOWS_NO_EXPORT > rte_trace_dump; # WINDOWS_NO_EXPORT > rte_trace_is_enabled; # WINDOWS_NO_EXPORT > rte_trace_metadata_dump; # WINDOWS_NO_EXPORT > -- > 1.8.3.1 >