From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D04EB45B51;
	Wed, 16 Oct 2024 17:32:44 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 9860D40150;
	Wed, 16 Oct 2024 17:32:44 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.129.124])
 by mails.dpdk.org (Postfix) with ESMTP id DC26D400D6
 for <dev@dpdk.org>; Wed, 16 Oct 2024 17:32:42 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1729092762;
 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=W94qNEGMbckzIFPnDN5MBnbwwCgRW0bZPcTYJYS4i8o=;
 b=DbZ7HJ1ex3sOISBZOIChZop18AabDimlBSrmZETUMxp4bA+HHVaAbGfagrRA02sMgeYQJx
 ssrCNbFHwmJ5ko1A4qkagQdLTjuwXaJMiHqcPYHKgUyvEtQnjb4iNQicWOLJjPaIJFuZ8v
 LjZACXK6HmjRqFlpRFHXqatHx5fkgFQ=
Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com
 [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
 us-mta-43-huGXzYZ1OCCMitx0AG4eSg-1; Wed, 16 Oct 2024 11:32:40 -0400
X-MC-Unique: huGXzYZ1OCCMitx0AG4eSg-1
Received: by mail-lj1-f198.google.com with SMTP id
 38308e7fff4ca-2fb652f40f1so7081581fa.2
 for <dev@dpdk.org>; Wed, 16 Oct 2024 08:32:40 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1729092759; x=1729697559;
 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=W94qNEGMbckzIFPnDN5MBnbwwCgRW0bZPcTYJYS4i8o=;
 b=F5MImjq+T9YacDB5Go3/xTx5KsiJSCEOCfOtGScTEzn0FvcGBAGGcyZMJnfWM7duv6
 lxHKqRAcxTipgA8yhw4mikNHmnVXiLjrLj+KTtBBFRHDk4BAbtnW/eOl67Z107RCg5zw
 Ma+gj7+j4VU3xhmNX9QMIqoklXB3qwm6dnDSM4S4fltdRynHp+S4l2zkhppDOLIOmcmo
 m/jnytKPYjBhHwQrCE69P8yy1ZQrGCXyC/65BYAOhkDG1hCuOuTDYAZI23KYOjNU49bZ
 +k1Csv/wTch8UKqNBY22yaP7ogambw/QLKQMgqB2PJIhNqqvl5bWyT2yE4rIWQaUVw57
 GlOw==
X-Forwarded-Encrypted: i=1;
 AJvYcCX9cyj0Dd8LnOiOt/m2ry+huJLBZD/s0Jizdzw+9I6T2h23lavm9aqhS3drejy6/DkVbWM=@dpdk.org
X-Gm-Message-State: AOJu0Yw1VuKmKa1lLL3PIO4P+GF86ehJnSXuncbXiE/7Q9nLiHJ2IuPL
 q8jQC9Mz1yU7jOIjFXjkxkF8RcbFn8tMxw4/M7C2jMSwLSwZcJUWsWRESeSz0aVGjNBkwShmA0A
 pYu1jn6Ixh+O17+Dj5r+OprieQSE01uZRxscLtzJtLb+TLyP9o9xS55iJ8dbGtt5csHky1+aahv
 0lHO4h6jCpDOsrXr4=
X-Received: by 2002:a2e:8891:0:b0:2f3:eeab:7f17 with SMTP id
 38308e7fff4ca-2fb3f30d16fmr56983031fa.41.1729092758876; 
 Wed, 16 Oct 2024 08:32:38 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IGVhKxr6b2bbESR4bhE7+CadqYYJ0OZSSl3n0tBgYffC6/bU1hTNcCtktsd3cUNe0dZe3vBpUW/TWGRGHh/uIw=
X-Received: by 2002:a2e:8891:0:b0:2f3:eeab:7f17 with SMTP id
 38308e7fff4ca-2fb3f30d16fmr56982921fa.41.1729092758393; Wed, 16 Oct 2024
 08:32:38 -0700 (PDT)
MIME-Version: 1.0
References: <20241016135411.827850-1-mattias.ronnblom@ericsson.com>
 <20241016135411.827850-2-mattias.ronnblom@ericsson.com>
 <20241016080424.3f614ac2@hermes.local>
In-Reply-To: <20241016080424.3f614ac2@hermes.local>
From: David Marchand <david.marchand@redhat.com>
Date: Wed, 16 Oct 2024 17:32:27 +0200
Message-ID: <CAJFAV8wfUHV5DWm4XZyOE2JxymNqLYqBBu4otVMzhBLFxqwhWg@mail.gmail.com>
Subject: Re: [PATCH 2/2] devtools: forbid the use of ffs compiler builtins
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com>, 
 dev@dpdk.org, =?UTF-8?Q?Mattias_R=C3=B6nnblom?= <hofors@lysator.liu.se>
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Wed, Oct 16, 2024 at 5:04=E2=80=AFPM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> On Wed, 16 Oct 2024 15:54:11 +0200
> Mattias R=C3=B6nnblom <mattias.ronnblom@ericsson.com> wrote:
>
> > Extend checkpatches.sh to detect the use of __builtin_(ffs|ffsll).
> >
> > These intrinsics are not available in MSVC, and there are perfectly
> > serviceable alternatives in <rte_bitops.h>.
> >
> > Signed-off-by: Mattias R=C3=B6nnblom <mattias.ronnblom@ericsson.com>
> > Suggested-by: David Marchand <david.marchand@redhat.com>
>
> Shouldn't this apply to all _builtin_ functions.
>
> There are a lot of drivers still doing this.

- The updated check here is about use of __builtin_XXX instead of DPDK
bit count ops.
So when you refer to all builtin functions, there may be other
builtins related to bit count we are missing, but at least the current
patch is better than before.


- On the larger topic of refusing *any* __builtin_, some use of them
are "legit" under compiler checks.
So the check would have to skip headers where wrappers are provided to
the rest of DPDK.
This seems possible, but a larger and probably more tricky change for now.

Are you ok if we go with this patch as is, in a first step?


--=20
David Marchand