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 0341642534; Thu, 7 Sep 2023 10:20:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8DAFB402AF; Thu, 7 Sep 2023 10:20:34 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 298624026C for ; Thu, 7 Sep 2023 10:20:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694074832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7v2Gd9kCGdelpKkgQM8C6RfTF3Q1PNaWFv00YnLsvG4=; b=BOTO4d92cmpPvr7j/NY9f6XA3Q/RuNDNG5Dirdhp7Y/CI+iuesxCFr2WiS+rYxESxVuLfc WyVVWmyuZqpONqRVUBNY2qI5D389FVNYNXcbiBhq0TWUszwvtdd0RonldUIf4erDIxWrL7 BqVe0pq6V+gY4Q7iidiwLCV5e31S+rs= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-362-rnI_eONIPOGtZIPw-EtRVw-1; Thu, 07 Sep 2023 04:20:31 -0400 X-MC-Unique: rnI_eONIPOGtZIPw-EtRVw-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2b6ff15946fso7470201fa.2 for ; Thu, 07 Sep 2023 01:20:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694074830; x=1694679630; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7v2Gd9kCGdelpKkgQM8C6RfTF3Q1PNaWFv00YnLsvG4=; b=gmO5i5ilcVR80nq6l77iNpCPzBumBPu/yhDw+eg4+09blMhBBsDa+zpbuUfasRLe0s q5J51xt6xmj5DTwiQIBxxBra7zlRyz05dQGgaOUW3ybl3AguNUyeJOk5E0MZUxUWE3VM 6QdSSzfAlxooOFpaQ56qvhDwDmL/TLUi8wWOfMlsCg+VNzajcBL55ntZOB1YocPMZHdP BKvZwqTd29n23JznRzGJkFxIBzIRRfIWrX1ca8FlXEychXyRg9eyCeeQ5oNWs6BRNXHO cQdAejGx0X5D0S5BiC9PR5mOswFNwxT8PxMTqOxXu9g7xyyBCIsADCneOqH5A1zXsrn+ r/5w== X-Gm-Message-State: AOJu0YzPjZ6U0FP2XC5tV5p9tdkNk/ZR3QgFT5+f2n7Vf+/8DP70YwbW gkUmm8lKb0ut/kJWG6JazqieGeo1XdG9RZ/BkYk0YSs1Mh1ICph24FKmDTbfIe+NV3BYeRDAikL 8zvFg1fyiVLGdmJuU3ao= X-Received: by 2002:a05:651c:11:b0:2b8:4100:b565 with SMTP id n17-20020a05651c001100b002b84100b565mr4354786lja.15.1694074830059; Thu, 07 Sep 2023 01:20:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjDLyfN8a/PFPExgfefnkuAZfpTA+/B+PjkpFTzX4xQCki7us+W/N4GV0FUhga2/b9SMgE0UmpY23dCUZixMI= X-Received: by 2002:a05:651c:11:b0:2b8:4100:b565 with SMTP id n17-20020a05651c001100b002b84100b565mr4354775lja.15.1694074829729; Thu, 07 Sep 2023 01:20:29 -0700 (PDT) MIME-Version: 1.0 References: <20230906162226.1618088-1-thomas@monjalon.net> <20230906162226.1618088-2-thomas@monjalon.net> In-Reply-To: <20230906162226.1618088-2-thomas@monjalon.net> From: David Marchand Date: Thu, 7 Sep 2023 10:20:18 +0200 Message-ID: Subject: Re: [PATCH 01/11] devtools: warn when adding some pthread calls To: Thomas Monjalon Cc: dev@dpdk.org, Tyler Retzlaff , Ferruh Yigit X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Hello Thomas, On Wed, Sep 6, 2023 at 6:22=E2=80=AFPM Thomas Monjalon wrote: > > 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 > --- > devtools/checkpatches.sh | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh > index 55fabc5458..131ffbcebe 100755 > --- a/devtools/checkpatches.sh > +++ b/devtools/checkpatches.sh > @@ -119,6 +119,14 @@ check_forbidden_additions() { # > -f $(dirname $(readlink -f $0))/check-forbidden-tokens.aw= k \ > "$1" || res=3D1 > > + # refrain from using some pthread functions > + awk -v FOLDERS=3D"lib drivers app examples" \ > + -v EXPRESSIONS=3D"pthread_(create|join|detach|set((|_)nam= e_np|affinity_np)|attr_set(inheritsched|schedpolicy))\\\(" \ I remember some awk (was it Alpine Linux? or FreeBSD ?..) does not like empty pattern like (|plop). For this case here, it is better (and kind of more readable) to use _? > + -v RET_ON_FAIL=3D1 \ > + -v MESSAGE=3D'Using pthread functions, prefer rte_thread'= \ > + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.aw= k \ > + "$1" || res=3D1 > + > # forbid use of __reserved which is a reserved keyword in Windows= system headers > awk -v FOLDERS=3D"lib drivers app examples" \ > -v EXPRESSIONS=3D'\\<__reserved\\>' \ > -- > 2.42.0 > --=20 David Marchand