From patchwork Wed Sep 13 10:34:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 131376 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D369C42588; Wed, 13 Sep 2023 12:36:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 473D3402EE; Wed, 13 Sep 2023 12:36:17 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by mails.dpdk.org (Postfix) with ESMTP id 9BB30402EE for ; Wed, 13 Sep 2023 12:36:16 +0200 (CEST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 610BC320091C; Wed, 13 Sep 2023 06:36:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 13 Sep 2023 06:36:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1694601374; x=1694687774; bh=9KmtH2xdcVmEydycKsOW5EgSK9TiWdCDs/c RCnJvKQE=; b=S3zvQ56ovK+dqRnF3GrwR5VdTibe0gYAU6LovIfTj7QD1mdNUJl 1iTziNvSlKZsMmMFYtj7Qbn/9T+IvcaXcBwP+MyP/pMMx/0oZBoHr/nvr15yF+zv 4QtwFl192HbhYOiuHZ27L+MGmDvoIxoA6zIZN+v36Ez7vwoc8FzgCKlep/PeobG+ rOI4O8yXjSIueccT8722h9JCiZ7VaBercYlLmtdLuNKi8SCOmOdexR8tcZa4ee2N 10rTf249uws7P9m4z/R/seufNeTXdW0PZ4onMDUTuPRZ7Uub2L/H7/zrs9rk0zTy FzUeGtl/sKiNKpIAjuD1xlrfSeyuvC7Rurg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1694601374; x=1694687774; bh=9KmtH2xdcVmEydycKsOW5EgSK9TiWdCDs/c RCnJvKQE=; b=WXAAWiwtTz/SqipnVpR5svGwhF3GHH3n6kntbqNd2/zFKAikCX4 I0sBDNHlKUuQVI2eqFPHUOMVpA0yxU/WHCdpxQaoFSH00qCOCP55IDpOVR2wrftL 2LxmTEFs2NCXQehwGrTMQheXRmf923kWzXItK8SXGbvoynG77VEuN54+p3Z0o4Kr 9p+tld6+G1cUIhQ48gnrG+FzsRRsdI4jSum9tw3YTyHB2rKYRxn5Wa1V720LsNfF hG30HF5OFT99zKY6YgAK3Zdn2RWlYg4Xct01FBZT3wDAR567TuNF7qHZ7Qi0kqZa RAxTWT/ICTSRp7SR62E4RD3qQ0CgJd0fgDg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeikedgvdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpefvhhho mhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqne cuggftrfgrthhtvghrnheptdeiffffgeefteelhfekueetueduffejgfelvedtieejudek gfevheetheehgeejnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilh hfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Sep 2023 06:36:12 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: Tyler Retzlaff , David Marchand , Ferruh Yigit , =?utf-8?q?Morten_Br=C3=B8rup?= Subject: [PATCH v2 01/11] devtools: warn when adding some pthread calls Date: Wed, 13 Sep 2023 12:34:20 +0200 Message-ID: <20230913103600.1935292-2-thomas@monjalon.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230913103600.1935292-1-thomas@monjalon.net> References: <20230906162226.1618088-1-thomas@monjalon.net> <20230913103600.1935292-1-thomas@monjalon.net> MIME-Version: 1.0 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 All pthread functions below have an equivalent in rte_thread API: - pthread_create - pthread_join - pthread_detach - pthread_setname_np - pthread_set_name_np - pthread_setaffinity_np - pthread_attr_setinheritsched - pthread_attr_setschedpolicy Usage of these functions will be raised to encourage rte_thread adoption. The pthread functions for locks and cancel are still allowed. Signed-off-by: Thomas Monjalon Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- v2: replace (|_) with _? --- devtools/checkpatches.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index 55fabc5458..ec9d232393 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -119,6 +119,14 @@ check_forbidden_additions() { # -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 + # refrain from using some pthread functions + awk -v FOLDERS="lib drivers app examples" \ + -v EXPRESSIONS="pthread_(create|join|detach|set(_?name_np|affinity_np)|attr_set(inheritsched|schedpolicy))\\\(" \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Using pthread functions, prefer rte_thread' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + # forbid use of __reserved which is a reserved keyword in Windows system headers awk -v FOLDERS="lib drivers app examples" \ -v EXPRESSIONS='\\<__reserved\\>' \