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 5C138A0501; Tue, 12 Apr 2022 00:53:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EEF2140E2D; Tue, 12 Apr 2022 00:53:02 +0200 (CEST) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by mails.dpdk.org (Postfix) with ESMTP id DE1E640DF7 for ; Tue, 12 Apr 2022 00:53:00 +0200 (CEST) Received: by mail-lf1-f51.google.com with SMTP id bq30so16432488lfb.3 for ; Mon, 11 Apr 2022 15:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OYReUhMA6r1+6LVKkhruIIt2iOIQkgFTUah3wnt2t9Q=; b=Yp9MCTxinPViJkRQug6nkNVOgQwn5cse85cSoyGlYCu9uA2BFFu2AlyQOIT7Dj7xmy DZCR3del+QMPgrn7zJVORIppp/9oOpLwXVzkGQcBPAO/9S3eOdd9xq1bQe26H1oq2iBL Bw+IJYS7u1DmnLetw6wRYuIeSxYpM8zKTglZ+uDI3iP4d2tjIZUJAU2wScOZB9mvoZbb bj8QIm9P2SJ7pS3hYOrzdb92GmdzAzRiX90SQxTsS8UJHiCS6hWj59SlU1m7swrDoJrN JN1nycm20RzbrsHpSv4son2kXKEWoB75d0p6pOsPqPPmxwsNdkA/7bYbAdjbXtqfbfS6 yCRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OYReUhMA6r1+6LVKkhruIIt2iOIQkgFTUah3wnt2t9Q=; b=3jrDZnKt1aba4qWu6uE1X9yPXcBq5Ev4xyuGbnyIYzVd7mCONoyz3DUelAp3cfrXuW LG7e0ZjBzWni6EaKSvsR+RWk4AMcj2eVHQ1bzxdXJbJmf+IX1iuHuXNk47irdUDL6WO7 bM+7RCYW4xLw6rbQ5sLbTEXYKL7rKAWzrWHuzd52C3ehpgrcE+MuYI/pfkT5taTX/AhX YUyYmB3e3FesmkFh48co9eLozb02bGFN5A2XbOd00ZLPiPe/mbNiwthmOj52us8sf83E EcAJy9cUATW9h38J33rinqfT22iJeVD1tG9DCUsP3qryiI33PhKQPmfENxnVWHXPCiVS 7BzA== X-Gm-Message-State: AOAM532tLOG37cWep7T9s8Yq8yY3BiYM/RMy8vPsrWY7liL9GveJzXhO /F82yALZgCvqhjUdFzUOtAc= X-Google-Smtp-Source: ABdhPJw13TeoYFyFNox/ocA3DzmChRuUfptCEihFixBmRvHoT9DlAQ5681kHa7MsJswELcWxxt0UVQ== X-Received: by 2002:a05:6512:e96:b0:465:760:f69a with SMTP id bi22-20020a0565120e9600b004650760f69amr14291749lfb.414.1649717580257; Mon, 11 Apr 2022 15:53:00 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id r9-20020ac25f89000000b0046b8d358e29sm1024431lfe.79.2022.04.11.15.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Apr 2022 15:52:59 -0700 (PDT) Date: Tue, 12 Apr 2022 01:52:58 +0300 From: Dmitry Kozlyuk To: Tyler Retzlaff Cc: dev@dpdk.org, thomas@monjalon.net, anatoly.burakov@intel.com, Narcisa Vasile Subject: Re: [PATCH 3/3] test/threads: add unit test for thread API Message-ID: <20220412015258.10053d7f@sovereign> In-Reply-To: <20220409085631.GB4153@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1648819793-18948-1-git-send-email-roretzla@linux.microsoft.com> <1648819793-18948-4-git-send-email-roretzla@linux.microsoft.com> <20220408170145.3b1c1025@sovereign> <20220409085631.GB4153@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 2022-04-09 01:56 (UTC-0700), Tyler Retzlaff: > On Fri, Apr 08, 2022 at 05:01:45PM +0300, Dmitry Kozlyuk wrote: > > 2022-04-01 06:29 (UTC-0700), Tyler Retzlaff: > > [...] > > > +static int > > > +test_thread_affinity(void) > > > +{ > > > + pthread_t id; > > > + rte_thread_t thread_id; > > > + > > > + RTE_TEST_ASSERT(pthread_create(&id, NULL, thread_main, NULL) == 0, > > > + "Failed to create thread"); > > > + thread_id.opaque_id = id; > > > > The need for this hack means that the new API is unusable in practice. > > I think functions to get the current thread ID and to compare IDs > > must be the part of this series to accept this unit test patch. > > are you proposing adding rte_thread_self and rte_thread_equals to this > series? i'm not sure i understand how that helps? while maybe the unit > test could be re-written in some fashion to use rte_thread_self it still > wouldn't do much for practically using the api outside of the test. Just rte_thread_self() should be enough; see below. How this helps: the series becomes complete, because there is enough API to verify it works without assumptions about implementation. [...] > if there is an absolute need to start using the api introduced in this > series outside of the unit test we could as a part of the __experimental > apis offer a function that formalizes the conversion to rte_thread_t from > pthread_t. the function would only be kept as long as needed and removed > when no longer necessary. I rather meant this: main thread: init barrier create thread enter barrier (wait) use shared thread ID thread: init shared thread ID from rte_thread_self() enter barrier (will unblock) After you will add rte_thread_create() in the subsequent series, the same logic will suit for checking that rte_thread_self() returns the proper ID.