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 8D87A45B56; Wed, 16 Oct 2024 22:55:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5053B4021F; Wed, 16 Oct 2024 22:55:37 +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 0947F40144 for ; Wed, 16 Oct 2024 22:55:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729112135; 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=+8kitFPMMCHKC2Bbyxan49uHEBaGMsKxpsfEjk2dD8c=; b=UcLSq7gTKHLN3YJviHN9nQ5xhYQ+OGqq2ylrtX+0FqpTcOfjI8LGR3HzBOgSdBW9T+PiTY UCRSE6X1S9697QhmeCXKz+qrqS5qqRwiQL1VEjXcT+AJc0e/kPeBlwgEEF5J7QIlaCAn9I xLCouI5BJvwbMcw4fDvmcl/M3icZOrc= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-388-NVu9Dp90NImJbb1ZPVbGUg-1; Wed, 16 Oct 2024 16:55:32 -0400 X-MC-Unique: NVu9Dp90NImJbb1ZPVbGUg-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2fb50150039so1810991fa.2 for ; Wed, 16 Oct 2024 13:55:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729112131; x=1729716931; 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=+8kitFPMMCHKC2Bbyxan49uHEBaGMsKxpsfEjk2dD8c=; b=umsXsvl52aGPFcaayzTsFoYVacu1s0k2csHw+ARYZdeBdvFW9jReMjKkQvW8S2GWI1 3J2pBRnIe8CYtyiRG1NRLPvFrfZeWhIpkeFREBn3YOV/BKbITIGwgr6bXPF1k4cU+iF4 3AmG7JrwQ2oiNNLE1cCWUDvdzWPG+y3er6fNf0mREwTZV5O+W9HPdczX68LrkEcujKDK KqwyxUvT6Qoo0+2Ey+PfpiU/HMQeKEpsQmwv4c23t6ThyEkMXD/MRMW2/Dufl83+d83h IY9QSAlNPkXf5R3oYCWAvXs7qnSGZ6dKNxWAu0mG4ZNMQJiVh+j4b5EQKMny6TqN8nj6 NJvQ== X-Forwarded-Encrypted: i=1; AJvYcCWnm0Hyh4oeer8xkHGSEc8lmjYbr5YkkJ2APRCqPgAQQLb6XQ5hwsnFYgRnEeh5fDccyTQ=@dpdk.org X-Gm-Message-State: AOJu0YwnK8elD7bMDrdmq8sqVwqfDTlqtaeJWjxNIiXDqWq+V+eKE1Ep Ux08ZBmEMXOywDZrM2TIrsmGCAwBg4uBhyGnMqEm5YRBNHQjiIgFqnOrvjbUeTERYQOVc4ZPkve kozz+wytFNmxdkMUcgwbbfwpvmi0pHZhIh1x4yMIJCHCD+OD2crzYeQSa2gk0UtPe8eckBu+gGz rRxkv/RoBzF1C0/OE= X-Received: by 2002:a2e:82ca:0:b0:2fb:2ebf:3259 with SMTP id 38308e7fff4ca-2fb3f197c72mr60092851fa.13.1729112130654; Wed, 16 Oct 2024 13:55:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IED4uDTRnSouJxWVmRmp4adS63sVxfORSViPkrrCcZbCmTkj1U0U021mmGMUVfZF3tNSIGtaE+MDiVjPBOXm5s= X-Received: by 2002:a2e:82ca:0:b0:2fb:2ebf:3259 with SMTP id 38308e7fff4ca-2fb3f197c72mr60092811fa.13.1729112130190; Wed, 16 Oct 2024 13:55:30 -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> <20241016083925.719a6b0c@hermes.local> In-Reply-To: <20241016083925.719a6b0c@hermes.local> From: David Marchand Date: Wed, 16 Oct 2024 22:55:18 +0200 Message-ID: Subject: Re: [PATCH 2/2] devtools: forbid the use of ffs compiler builtins To: Stephen Hemminger Cc: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , dev@dpdk.org, =?UTF-8?Q?Mattias_R=C3=B6nnblom?= 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 On Wed, Oct 16, 2024 at 5:39=E2=80=AFPM Stephen Hemminger wrote: > > On Wed, 16 Oct 2024 17:32:27 +0200 > David Marchand wrote: > > > On Wed, Oct 16, 2024 at 5:04=E2=80=AFPM Stephen Hemminger > > wrote: > > > > > > On Wed, 16 Oct 2024 15:54:11 +0200 > > > Mattias R=C3=B6nnblom 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 . > > > > > > > > Signed-off-by: Mattias R=C3=B6nnblom > > > > Suggested-by: David Marchand > > > > > > 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 n= ow. > > > > Are you ok if we go with this patch as is, in a first step? > > > > > > Examples of direct use of builtin > app/dumpcap/main.c: log2 =3D sizeof(size) * 8 - __builtin_clz= l(size - 1); > app/test-dma-perf/benchmark.c: __builtin_ia32_cl= flush(data + offset); > drivers/bus/fslmc/qbman/include/compat.h:#define likely(x) _= _builtin_expect(!!(x), 1) > drivers/bus/fslmc/qbman/include/compat.h:#define unlikely(x) _= _builtin_expect(!!(x), 0) > > drivers/common/nfp/nfp_platform.h:#define __bf_shf(x) (__builtin_= ffsll(x) - 1) > drivers/crypto/ccp/ccp_dev.c: first_zero =3D __builtin_ffsl(~wo= rd); > app/test/test_memcpy_perf.c: if (__builtin_constant_p(n)) > > drivers/net/bonding/rte_eth_bond_pmd.c: if (__builtin_pop= countl(link_speeds) !=3D 2) { > > > Think that direct use of __builitin_expect should be flagged. > And the lots of __builtin_in mlx5 should also be flagged. Yes, we should fix those, but that's beyond the bitops check. I'll go ahead with current series for now. --=20 David Marchand