From patchwork Wed Sep 13 11:28:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 131387 X-Patchwork-Delegate: david.marchand@redhat.com 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 0ECE042588; Wed, 13 Sep 2023 13:45:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 510AC4069F; Wed, 13 Sep 2023 13:45:05 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by mails.dpdk.org (Postfix) with ESMTP id DCAF84069F for ; Wed, 13 Sep 2023 13:45:03 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 9D18E3200974; Wed, 13 Sep 2023 07:45:02 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 13 Sep 2023 07:45:03 -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= 1694605502; x=1694691902; bh=9KmtH2xdcVmEydycKsOW5EgSK9TiWdCDs/c RCnJvKQE=; b=u4YMEtAOVaRcSpensk7sLSa9yVHABgq1UJWhZkeYWboTGvA9iIK D1hoBflDiSqdKXQzUJkkGH2nNNzUTdGMVx5vqueToLdZk7x+4Hiq8Iluj58Qeobs tjFd6NSq2n5U9U7+tPUmHbg3Lfablou0dM1fz9lIOM07a2736JGLrakk90JIZPsW RTRJ9ZcAzltdZUskWVJjzZlc1vRzJPurmPJ0juuvjpRYtuJLssiV2O8yUf6/iFjR fmVHYRL13DpTg624RSlmyfZHmxX8tthjkcUJDIHoYaBUQ3wR9SrEZbHomZeFVyJi Z49J1Xi6+XwqHRvNKrl7718U3stc5nYgXDA== 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= 1694605502; x=1694691902; bh=9KmtH2xdcVmEydycKsOW5EgSK9TiWdCDs/c RCnJvKQE=; b=L9fNaSDfUKhS2lEckSnYJE+kG+qMkr4hBTD5XAWYsSZw2c7XTt3 jIoZdTEwg3oCuR4BlzsSsS6oXWsBEfh6ABhhR5UXtxxLky0/x7KwWoLqeTGYYJaV ATUA1EyjlxW9Ve60Tv3E1LrAn433kP5QTO/qdtXcUdTgEK9ZSgvE0Kvt6VvuaYAg ap7CDta/kc6N95crGpy9Z0nwADTu2r2/lp8BponJjeI8ACdYO/pxvAQ1rxHt3jpf O5qgPv/SHkaigXYu+08rx6fqQzbxVPqHdaFxkQqAy/kLXCD6wqrY5t8CoawpCO+Y hn7cUA9ye3bkvaCQuB95KtQE4qVTcWNqTAg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeikedggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpefvhhho mhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqne cuggftrfgrthhtvghrnheptdeiffffgeefteelhfekueetueduffejgfelvedtieejudek gfevheetheehgeejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Sep 2023 07:45:00 -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 v3 01/11] devtools: warn when adding some pthread calls Date: Wed, 13 Sep 2023 13:28:14 +0200 Message-ID: <20230913114351.1940459-2-thomas@monjalon.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230913114351.1940459-1-thomas@monjalon.net> References: <20230906162226.1618088-1-thomas@monjalon.net> <20230913114351.1940459-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\\>' \