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 02842A00C5; Sat, 5 Feb 2022 05:41:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A122406A2; Sat, 5 Feb 2022 05:41:43 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 9ED7A40143 for ; Sat, 5 Feb 2022 05:41:41 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id BAE7620B6C61; Fri, 4 Feb 2022 20:41:40 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BAE7620B6C61 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1644036100; bh=qvj5Om9AUZFmE/p7iY3aN4udarmTr5VsIrwfdBlFLhI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sTkVN+nuieIcmEN9Dsog/d4dDAQJReH/4zCtqBznmNQyH+0g7IfcZuWCvuxxtxmhU q9x+vM6GHT0fNHFlpCliTW+jtS5rkRFJEDuwLSH9/7dSY9o7S2H2GF/5LMQsOM1Vvg uc11OPWDuR/163+14kD3HsztTfeOjG0t6IqA2ALE= Date: Fri, 4 Feb 2022 20:41:40 -0800 From: Tyler Retzlaff To: "Ananyev, Konstantin" Cc: "navasile@linux.microsoft.com" , "Richardson, Bruce" , "david.marchand@redhat.com" , "dev@dpdk.org" , "dmitry.kozliuk@gmail.com" , "dmitrym@microsoft.com" , "khot@microsoft.com" , "navasile@microsoft.com" , "ocardona@microsoft.com" , "Kadam, Pallavi" , "roretzla@microsoft.com" , "talshn@nvidia.com" , "thomas@monjalon.net" Subject: Re: [PATCH v18 2/8] eal: add thread attributes Message-ID: <20220205044140.GA7734@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 Fri, Feb 04, 2022 at 07:21:10PM +0000, Ananyev, Konstantin wrote: > > Implement thread attributes for: > > * thread affinity > > * thread priority > > Implement functions for managing thread attributes. > > > > Priority is represented through an enum that allows for two levels: > > - RTE_THREAD_PRIORITY_NORMAL > > - RTE_THREAD_PRIORITY_REALTIME_CRITICAL > > > > Affinity is described by the rte_cpuset_t type. > > > > An rte_thread_attr_t object can be set to the default values > > by calling rte_thread_attr_init(). > > > > Signed-off-by: Narcisa Vasile > > --- > > lib/eal/common/rte_thread.c | 46 ++++++++++++++++++ > > lib/eal/include/rte_thread.h | 91 ++++++++++++++++++++++++++++++++++++ > > lib/eal/version.map | 4 ++ > > lib/eal/windows/rte_thread.c | 44 +++++++++++++++++ > > 4 files changed, 185 insertions(+) > > > > diff --git a/lib/eal/common/rte_thread.c b/lib/eal/common/rte_thread.c > > index 92a7451b0a..27ad1c7eb0 100644 > > --- a/lib/eal/common/rte_thread.c > > +++ b/lib/eal/common/rte_thread.c > > @@ -9,6 +9,7 @@ > > #include > > > > #include > > +#include > > #include > > #include > > #include > > @@ -33,6 +34,51 @@ rte_thread_equal(rte_thread_t t1, rte_thread_t t2) > > return pthread_equal((pthread_t)t1.opaque_id, (pthread_t)t2.opaque_id); > > } > > > > +int > > +rte_thread_attr_init(rte_thread_attr_t *attr) > > +{ > > + RTE_VERIFY(attr != NULL); > > As a generic one, here and everywhere: > Please don't use RTE_VERIFY() for checking input function parameters. > We don't want to panic in case of just invalid parameter from user. i ask this question again. what useful thing will the user application do when handling -EINVAL or rte_errno = EINVAL is returned for incorrectly supplied parameters? again, there should be a mechanism that allows a policy for how these non-recoverable errors are handled rather than defaulting to tossing it over the fence and expecting the application to do something sensible when the only thing it could do is conclusively more complicated than having passed the correct parameters in the first place. more often then not application programmers will ignore superfluous return values from functions like this resulting in the bug remaining longer and the state / reason being lost. please reconsider.