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 617B0A0A0C; Fri, 18 Jun 2021 23:30:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C99F6410F3; Fri, 18 Jun 2021 23:30:24 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id AEFDE410DE for ; Fri, 18 Jun 2021 23:30:23 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 014BB20B7178; Fri, 18 Jun 2021 14:30:22 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 014BB20B7178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1624051823; bh=nuJInpWgNy327+6QvE41dWTKu//KqN7ZhUEWI9HbIsc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VExkZDALo0xc+rdYy2zwgfJ7jELImJJ1LeuxMGMB66jMq3xN6gjewg2+6zAgNerMr zz9Z6GWd3KwVyGs+FoSXDSm79jgO32YVj/4af2ME8DteUgvyeKfmUNNZ4U6Ab5XLHv RTWqZ0tpsnPSKMoB+wSyS4XE9xJ7WxC5H4YzBHSY= Date: Fri, 18 Jun 2021 14:30:22 -0700 From: Narcisa Ana Maria Vasile To: Dmitry Kozlyuk Cc: dev@dpdk.org, thomas@monjalon.net, khot@microsoft.com, navasile@microsoft.com, dmitrym@microsoft.com, roretzla@microsoft.com, talshn@nvidia.com, ocardona@microsoft.com, bruce.richardson@intel.com, david.marchand@redhat.com, pallavi.kadam@intel.com Message-ID: <20210618213022.GA26950@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1622849908-5710-1-git-send-email-navasile@linux.microsoft.com> <1622850274-6946-1-git-send-email-navasile@linux.microsoft.com> <1622850274-6946-2-git-send-email-navasile@linux.microsoft.com> <20210609020348.20a0cad2@sovereign> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210609020348.20a0cad2@sovereign> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [dpdk-dev] [PATCH v9 01/10] eal: add thread id and simple thread functions 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 Sender: "dev" On Wed, Jun 09, 2021 at 02:03:48AM +0300, Dmitry Kozlyuk wrote: > 2021-06-04 16:44 (UTC-0700), Narcisa Ana Maria Vasile: > > From: Narcisa Vasile > > > > Use a portable, type-safe representation for the thread identifier. > > Add functions for comparing thread ids and obtaining the thread id > > for the current thread. > > > > Signed-off-by: Narcisa Vasile > > --- > > lib/eal/common/rte_thread.c | 105 ++++++++++++++++++ > > lib/eal/include/rte_thread.h | 53 +++++++-- > > lib/eal/include/rte_thread_types.h | 10 ++ > > .../include/rte_windows_thread_types.h | 10 ++ > > lib/eal/windows/rte_thread.c | 17 +++ > > 5 files changed, 186 insertions(+), 9 deletions(-) > > create mode 100644 lib/eal/common/rte_thread.c > > create mode 100644 lib/eal/include/rte_thread_types.h > > create mode 100644 lib/eal/windows/include/rte_windows_thread_types.h > > It is strange that new files are being filled in the series, but are neither > compiled nor installed until the last patch. Any reason not to replace > lib/eal/unix/rte_thread.c starting from this patch? > Replaced unix/rte_thread.c starting from here. > A better name for rte_thread_types.h would be rte_posix_thread_types.h > to indicate this file is not really common. > > > > > +rte_thread_t > > +rte_thread_self(void) > > +{ > > + rte_thread_t thread_id = { 0 }; > > (Applies to entire series.) > Please do not initialize variables when you intend to overwrite them. > This prevents compiler from reporting code paths where the variable is used > before a proper assignment. Thanks for the explanation, Dmitry! > > > [...] > > diff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h > > index 8be8ed8f36..347df1a6ae 100644 > directly, see lib/eal/$arch/rte_atomic_64.h for examples. > > Note that rte_*_thread_types.h should be `indirect_headers`, not `headers` > in `meson.build` so that they're not checked by `buildtools/chkincs` when is > gets enabled for Windows. This is especially > true for lib/eal/common/rte_thread.h that cannot work without pthread. > > However, in later patches these headers only contain mutex bits, > see the comment to pathc 07/10 about them. Maybe we don't need these files > after all. Agreed, I was able to remove them after reimplementing the mutex functions.