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 40B724600E; Tue, 7 Jan 2025 15:20:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D8B5140BA4; Tue, 7 Jan 2025 15:20:49 +0100 (CET) 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 478FD40676 for ; Tue, 7 Jan 2025 15:20:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736259647; 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=GglZKm//n+jRic+eQwwXBs43kajYk8UGqENFffYJhxo=; b=f57rp+coB45IYRH0lailTs3nxmeOaBgh9XnyKWlD+a+Slo7mktKLIQHlA/BzZX4tUGzP1i S4/18DJQ8yp4ftGcCRA6NhQcpy7D0kIrW8jFErm8UMo+dO8idfyOF40jiI9fPLi1DLIl3Z Hx5ZDkArr5h8I0kJAcPGzw+94MXdYrU= 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-286-x2joZOhnMGm0a-zoz5Xt0Q-1; Tue, 07 Jan 2025 09:20:46 -0500 X-MC-Unique: x2joZOhnMGm0a-zoz5Xt0Q-1 X-Mimecast-MFC-AGG-ID: x2joZOhnMGm0a-zoz5Xt0Q Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-30220c5ca63so62132191fa.3 for ; Tue, 07 Jan 2025 06:20:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736259645; x=1736864445; 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=GglZKm//n+jRic+eQwwXBs43kajYk8UGqENFffYJhxo=; b=jGJH3dwV9TJeUaQ301zCKCjigZOwrctJ1nmVmOEvhqfgiTR0WnbNb4nh45C7CRYuNa ypxJLEKbSRM5Y6TSxyVY3biwjznqY2dRfG6p+iSTKbKmzifLeNzyUmwodrv43KWfqgsq JkAGfphOtvEnSTj3NMxGRaRYn+YwxfjBw3YK6HKGeQnaojkteb0B78vIEA6MmtLzVCRd mhLERF14hHeuQqfVKubyZhVns4tr4A/+CwU7qVlTWCQgC81B4AB8Yf/7jQw3tkKWe/UE iDHMrcB7STvCAP7Hvj3hkKMOwABaLHNB/jwu8yLWddiMqaFwgf7TLe/PpZpQlWpVpoPJ 32RA== X-Forwarded-Encrypted: i=1; AJvYcCXZAj+D5v6hWmjMLVoj0jTJYq6bRPg1C8d1tUG6ZYJ/yhnsvnNP+uS6y664M1/j867jUEo=@dpdk.org X-Gm-Message-State: AOJu0Yzl4JLRcmqoOPQxSO2elPhfKc6LK0BdWppKZFTsHZckgCsz6vzW /pDZD9lb3hVpTlVPzSWcb8d0Qxcyvc7mSiEU1ElGb+zqvqykPJXk7x2v2ml68P3SwmvMRDiadAu 8zw2bzBpAg8XYUUEsfGpLhWQme1UxKtUOIbf8yrKl6pXKRSX7xSdXWcVYoCiylF+gzrZvbYNRVP 1xUMjQNe3KIdZCLRg= X-Gm-Gg: ASbGnctmPsR3ENkzMlFTydpRy1EGp1Erj/Byev1AOhrG7qlnf5GU/ZXzc6/Kqnc1gJp 3unPKlzORJ+r2G/4JodNwBcrovIZ+Ja4u9UaeX2fX X-Received: by 2002:a05:6512:2807:b0:540:1f7d:8bc0 with SMTP id 2adb3069b0e04-5422956bf88mr18028883e87.49.1736259644848; Tue, 07 Jan 2025 06:20:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJYlCgwT8Bmke4o9a1veTB2q8HwtZw8iLKPHiObV+rCjxmlOyJ1OaSlsakWzgtWqh4lut5ldXYRkOXJZ+3QH8= X-Received: by 2002:a05:6512:2807:b0:540:1f7d:8bc0 with SMTP id 2adb3069b0e04-5422956bf88mr18028871e87.49.1736259644388; Tue, 07 Jan 2025 06:20:44 -0800 (PST) MIME-Version: 1.0 References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1735670291-23224-1-git-send-email-andremue@linux.microsoft.com> <1735670291-23224-2-git-send-email-andremue@linux.microsoft.com> In-Reply-To: <1735670291-23224-2-git-send-email-andremue@linux.microsoft.com> From: David Marchand Date: Tue, 7 Jan 2025 15:20:32 +0100 Message-ID: Subject: Re: [PATCH v8 01/29] devtools: check packed attributes To: Andre Muezerie Cc: roretzla@linux.microsoft.com, aman.deep.singh@intel.com, anatoly.burakov@intel.com, bruce.richardson@intel.com, byron.marohn@intel.com, conor.walsh@intel.com, cristian.dumitrescu@intel.com, david.hunt@intel.com, dev@dpdk.org, dsosnowski@nvidia.com, gakhil@marvell.com, jerinj@marvell.com, jingjing.wu@intel.com, kirill.rybalchenko@intel.com, konstantin.v.ananyev@yandex.ru, matan@nvidia.com, mb@smartsharesystems.com, orika@nvidia.com, radu.nicolau@intel.com, ruifeng.wang@arm.com, sameh.gobriel@intel.com, sivaprasad.tummala@amd.com, skori@marvell.com, stephen@networkplumber.org, suanmingm@nvidia.com, vattunuru@marvell.com, viacheslavo@nvidia.com, vladimir.medvedkin@intel.com, yipeng1.wang@intel.com X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: NX6gYKGhc42i2gRINj0HzraBPCQ2s-FR7tKrv8YNUOU_1736259645 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 Andre, On Tue, Dec 31, 2024 at 7:39=E2=80=AFPM Andre Muezerie wrote: > > Ensure __rte_packed_begin and __rte_packed_end show up in pairs > when checking patches. > > Signed-off-by: Andre Muezerie > Acked-by: Tyler Retzlaff > --- > devtools/checkpatches.sh | 43 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 43 insertions(+) > > diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh > index 4a8591be22..7868f5e522 100755 > --- a/devtools/checkpatches.sh > +++ b/devtools/checkpatches.sh > @@ -202,6 +202,14 @@ check_forbidden_additions() { # > -f $(dirname $(readlink -f $0))/check-forbidden-tokens.aw= k \ > "$1" || res=3D1 > > + # forbid use of __rte_packed_begin with enums > + awk -v FOLDERS=3D'lib drivers app examples' \ > + -v EXPRESSIONS=3D'enum.*__rte_packed_begin' \ > + -v RET_ON_FAIL=3D1 \ > + -v MESSAGE=3D'Using __rte_packed_begin with enum is not a= llowed' \ > + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.aw= k \ > + "$1" || res=3D1 > + > # forbid use of experimental build flag except in examples > awk -v FOLDERS=3D'lib drivers app' \ > -v EXPRESSIONS=3D'-DALLOW_EXPERIMENTAL_API allow_experime= ntal_apis' \ > @@ -362,6 +370,33 @@ check_aligned_attributes() { # > return $res > } > > +check_packed_attributes() { # > + res=3D0 > + > + if [ $(grep -E '^\+.*__rte_packed_begin' "$1" | \ > + grep -vE '\' | \ > + grep -vE '\= ' | \ > + grep -vE '\<__rte_cache_aligned[[:space:]]*__rte_= packed_begin\>' | \ > + grep -vE '\<__rte_cache_min_aligned[[:space:]]*__= rte_packed_begin\>' | \ > + grep -vE '\<__rte_aligned\(.*\)[[:space:]]*__rte_= packed_begin\>' | \ > + wc -l) !=3D 0 ]; then > + echo "Please use __rte_packed_begin only after struct, un= ion," \ > + " __rte_cache_aligned, __rte_cache_min_aligned o= r __rte_aligned." > + res=3D1 > + fi This part lgtm. > + > + begin_count=3D$(grep '__rte_packed_begin' "$1" | \ > + wc -l) > + end_count=3D$(grep '__rte_packed_end' "$1" | \ > + wc -l) > + if [ $begin_count !=3D $end_count ]; then > + echo "__rte_packed_begin and __rte_packed_end mismatch. T= hey should always be used in pairs." > + res=3D1 > + fi This part is problematic. The check is applied on a patch: a __rte_packed_* token (let's imagine __rte_packed_begin) may be involved without an associated change on its counterpart token (__rte_packed_end). Let me show an example: $ git show commit 655cfe433ab6f4fb8c92fec44ea5e1f689055201 (HEAD -> pack_v8_dma) Author: David Marchand Date: Tue Jan 7 15:13:26 2025 +0100 plop plop Signed-off-by: David Marchand diff --git a/lib/net/rte_ip6.h b/lib/net/rte_ip6.h index 92558a124a..686c12220b 100644 --- a/lib/net/rte_ip6.h +++ b/lib/net/rte_ip6.h @@ -461,7 +461,7 @@ rte_ether_mcast_from_ipv6(struct rte_ether_addr *mac, const struct rte_ipv6_addr /** * IPv6 Header */ -struct __rte_aligned(2) __rte_packed_begin rte_ipv6_hdr { +struct __rte_aligned(2) __rte_packed_begin rte_ipv6_hdr /* A useful comment, isn't it? */ { union { rte_be32_t vtc_flow; /**< IP version, traffic class & flow label. */ __extension__ $ ./devtools/checkpatches.sh -n1 ### [PATCH] plop __rte_packed_begin and __rte_packed_end should always be used in pairs. 0/1 valid patch I don't think there is a way to accurately catch wrongly paired tokens. The only good way is having most extensive Windows builds in the CI, isn't = it? --=20 David Marchand