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 DF3E3A0C3F for ; Tue, 11 May 2021 04:12:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB6B1406A3; Tue, 11 May 2021 04:12:11 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 974B54003C; Tue, 11 May 2021 04:12:09 +0200 (CEST) IronPort-SDR: h7SxiROCuso8zus8seQdYpacifz6wCsTUFyTFUX6KtDKRUcoLLpqVJmpGMqt7fyq0r/8rB5zRJ fH3qmgmK8Uqg== X-IronPort-AV: E=McAfee;i="6200,9189,9980"; a="197351312" X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="197351312" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2021 19:12:08 -0700 IronPort-SDR: DiwGyIlaTFE8bkkEkYvM8qp6wRHHGMta9sDsAuHO7w+IbUxFYAWCgLgHdvOeAg8nAKf+Fbhzkl QxPCG+VS94tw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="624488512" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga005.fm.intel.com with ESMTP; 10 May 2021 19:12:08 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 10 May 2021 19:12:08 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Mon, 10 May 2021 19:12:08 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Mon, 10 May 2021 19:12:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oSG2oJDkUeH7jDL4AcSCf/qOknxao8tNomf6+Hrfpb/LQHWz8T9t6Hqk8kKcmwRHOkv8lYLbXG5bqR8Fo7llBok50RrGWb2rAnAagshvW/37B0QE1shtnUNePrKWOVM5XafM8RzvE4wiqYmJqooy1zFub5tihbrkHnfC9xfv6Sqfy/WuHFyKO8qvKjf5jN0YqxsFiZRyvHlod8n/+gQv9NYnknok4encEACKe83nI2tAqD07H6thgBH4TAYnJZUQuGHiK48DbsIEn3zpvNoW96SkygksWwrteIc8MpfyUMjSewe9MkEqyhWEWL+i8Uxzo8K3Pg8uRPMG5OP55k1JXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/VQs9ArsQ1MZFuHQ7YJvjGnEMR2htLzH5Le1GcIlGw8=; b=XtNE502vsXH/3THXmPn7dZMAi+Bmh8sBkBb9KnOnWgWpxDjspwQsxKe13YOE6WZelg071ufdKjgq5phgFKbrX+r9lTpE4lThwWh3AbrdM7537BAsO3rg3/6qvezFWxa5b73ZiKLmFNrLRI7/PsPN3VBHc+PMqU16DECfmqiHCw/NM/c+LspR7p1d1hZx24CrhraKYIZuQ5/5S3L9QopqMexLogDKfz2U0zVC85AyQJSiozBU7gTT0nZKrvtvSZj3CHdQWpqMZ4urc/UzKnzuoYL5MZpm1V1M6/84MxzRKo4riByWNSrwNiZYWQ06WqjbbIngJ2NWwKjZtlkX/Dw/RQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/VQs9ArsQ1MZFuHQ7YJvjGnEMR2htLzH5Le1GcIlGw8=; b=nLiySDEVfCPm8KeHR3r6/0bcLLgTx1L7tilNeR0N2KZXZTkHGcPgU9rNQD+LgLQcip4VXjn77uPU2XFZ4v1CT+9hBcvW6QOu9hu1BvHM1+xfJH2PexAbSgrmi5SxG0ALWHoOgCUz+PsaSZ4OBipCkuD2g1ckRZBk52L22LggdiE= Received: from BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) by BN6PR11MB1971.namprd11.prod.outlook.com (2603:10b6:404:ff::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Tue, 11 May 2021 02:12:05 +0000 Received: from BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::2dfc:3be2:c305:6346]) by BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::2dfc:3be2:c305:6346%6]) with mapi id 15.20.4108.031; Tue, 11 May 2021 02:12:05 +0000 From: "Wang, Haiyue" To: "pbhagavatula@marvell.com" , "david.marchand@redhat.com" , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , Jiawen Wu , Jian Wang , "Chautru, Nicolas" , Thomas Monjalon , "Yigit, Ferruh" , Andrew Rybchenko CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 2/2] eal: fix side effects in ptr align macros Thread-Index: AQHXRdRdxXcJzxJzZES0IhVxYyPnU6rdhwOQ Date: Tue, 11 May 2021 02:12:05 +0000 Message-ID: References: <20210510140214.2627-1-pbhagavatula@marvell.com> <20210510194008.403-1-pbhagavatula@marvell.com> <20210510194008.403-2-pbhagavatula@marvell.com> In-Reply-To: <20210510194008.403-2-pbhagavatula@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.0.76 authentication-results: marvell.com; dkim=none (message not signed) header.d=none;marvell.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.53] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8a7098df-106e-427b-df13-08d914222c93 x-ms-traffictypediagnostic: BN6PR11MB1971: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: i04Qft6ZPmoDbVuGbetgheTgknyaG5yjAZ8ntbP0szEqFWbhszKUhEhDZ5JSgEwj+kPbW2MPMC9aGlJAPZOFjQ8jRWDtMjwhFjGerVJTt+/XHwAiB8rQ/fNKvislZehtm25xwB8o/AzySMjJIxDCxU4VemraH6onu4pe2XHd4Rs/+tNHfXa7dNdXjEQotxx01V6JehrRWlSEtPzg8W8EwgdVYJEEUuMrf6gKzADs9EugXhrr2Qv3OqvDb98EMn9tzes8+DJm2qzW97mnH9TwRzFwZCrdaa32B50GO+kCvYZDLFX2WdSWes/5Mn4gYZevBpOBLHanHoNUZQTpkWtE+3IJgLglOi0SJxGJlFXp/i4lfnC5JuQSx89p5lp6ZaT31354wu3cceYNwRNP9mTcUag7zIJELhUV3skIc6fx21i2CzfHhzPZnTPohHfL4B8BTdZWbTGRsuzZH7Vh9q72Jxnfe+BRmYRjMV3VgA/+16upqgs4r56Dwl3lqeTfziox7veRDoKPHPOYLgkwRUI3OdbQO/AXv73u89vpMq4OnxKZDBOJ4xHOSSDaN8qTFiqiB+3MR5NpMtFPbOGFXSWIGAEs/Kxc2GtarzRWu+IbyeH44fuKojmKRsCANnjSiw1vmeLKNIPNE7yBrFm5C2ZRX7+3uwqLYmyOIGWUW4Qw4FM= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR11MB3795.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(376002)(39860400002)(346002)(366004)(136003)(66946007)(921005)(26005)(76116006)(9686003)(110136005)(316002)(7416002)(4326008)(64756008)(8676002)(478600001)(54906003)(33656002)(52536014)(55016002)(66556008)(2906002)(66446008)(8936002)(83380400001)(6506007)(53546011)(71200400001)(66476007)(86362001)(5660300002)(38100700002)(122000001)(7696005)(186003)(56340200001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?HWzz9qoMZA/onin/2J4SynFl30i7NFiia2RtRskJAsVBHp9Ia6u4Yv31+POE?= =?us-ascii?Q?yUH6dgaVyOi+VhuXFThwHA6wAyjsW/KrXhXAIf2mabK/N3PBui+8Xpyb+2t9?= =?us-ascii?Q?ON2HzFvsj6yGoC01qas9d496A4CBlXwSOYl1ZKh8FC8zw5YeD8cR57M7OA7t?= =?us-ascii?Q?Pojsv5BRPYxT1T27XAy8trAoLbg7tioUiqqWlaxBZ9/vx+9wwDE9ffMBSdqo?= =?us-ascii?Q?ieKsvvpDWsxDE0i8ZWZQXNq6LH1138Ioyg6tR95sOO4JE2raFUPlAiA7kDfg?= =?us-ascii?Q?dcSywGveLJBbnbkXDmSoVZxpR/75xFsbWWrKBGoOvOp5x7rOAniqzg2yYdCR?= =?us-ascii?Q?soaL5ns9agyhZ0gJhBq1banD8v/+guhMJRArNTKvzkKa8EXJQoSLhgDH9var?= =?us-ascii?Q?1IXUGMcj11dPO+J2Azu4fKCT1gMATAN0Y5vMMF59fP4LDnbNp9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Dt0I?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3795.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a7098df-106e-427b-df13-08d914222c93 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 May 2021 02:12:05.7828 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: UqFiF7dMN12k7bXPGnxYvn9DI783yHRSt2cZnHhHgvjNkc8CZkBIa60yjS+ugyYyUUrvWyZQ2vAWj9S0EVeJKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1971 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v3 2/2] eal: fix side effects in ptr align macros X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" > -----Original Message----- > From: pbhagavatula@marvell.com > Sent: Tuesday, May 11, 2021 03:40 > To: david.marchand@redhat.com; Wang, Haiyue ; Mata= n Azrad ; > Shahaf Shuler ; Viacheslav Ovsiienko ; Jiawen Wu > ; Jian Wang ; Chautru, = Nicolas > ; Thomas Monjalon ; Yigit= , Ferruh > ; Andrew Rybchenko > Cc: dev@dpdk.org; Pavan Nikhilesh ; stable@dpdk= .org > Subject: [dpdk-dev] [PATCH v3 2/2] eal: fix side effects in ptr align mac= ros >=20 > From: Pavan Nikhilesh >=20 > Avoid expanding parameters inside RTE_*_ALIGN macros. > Update common_autotest to detect macro side effects. > Workaround static arrays relying on RTE_ALIGN macros. >=20 > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org >=20 > Signed-off-by: Pavan Nikhilesh > Signed-off-by: David Marchand > --- > app/test/test_common.c | 6 ++++++ > drivers/net/e1000/e1000_ethdev.h | 7 ++++--- > drivers/net/ixgbe/ixgbe_ethdev.h | 6 ++++-- > drivers/net/mlx5/mlx5_rxtx_vec.h | 7 ++++--- > drivers/net/txgbe/txgbe_ethdev.h | 6 ++++-- > examples/bbdev_app/main.c | 2 +- > lib/eal/include/rte_common.h | 17 +++++++++++++---- > lib/ethdev/rte_eth_ctrl.h | 5 +++-- > 8 files changed, 39 insertions(+), 17 deletions(-) >=20 > diff --git a/app/test/test_common.c b/app/test/test_common.c > index 0dbb87e741..9efe3b10f9 100644 > --- a/app/test/test_common.c > +++ b/app/test/test_common.c > @@ -69,6 +69,12 @@ test_macros(int __rte_unused unused_parm) > TEST_SIDE_EFFECT_2(RTE_PTR_ADD, void *, size_t); > TEST_SIDE_EFFECT_2(RTE_PTR_DIFF, void *, void *); > TEST_SIDE_EFFECT_2(RTE_PTR_SUB, void *, size_t); > + TEST_SIDE_EFFECT_2(RTE_PTR_ALIGN, void *, size_t); > + TEST_SIDE_EFFECT_2(RTE_PTR_ALIGN_CEIL, void *, size_t); > + TEST_SIDE_EFFECT_2(RTE_PTR_ALIGN_FLOOR, void *, size_t); > + TEST_SIDE_EFFECT_2(RTE_ALIGN, unsigned int, unsigned int); > + TEST_SIDE_EFFECT_2(RTE_ALIGN_CEIL, unsigned int, unsigned int); > + TEST_SIDE_EFFECT_2(RTE_ALIGN_FLOOR, unsigned int, unsigned int); > TEST_SIDE_EFFECT_2(RTE_ALIGN_MUL_CEIL, unsigned int, unsigned int); > TEST_SIDE_EFFECT_2(RTE_ALIGN_MUL_FLOOR, unsigned int, unsigned int); > TEST_SIDE_EFFECT_2(RTE_ALIGN_MUL_NEAR, unsigned int, unsigned int); > diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_e= thdev.h > index 3b4d9c3ee6..155d825d89 100644 > --- a/drivers/net/e1000/e1000_ethdev.h > +++ b/drivers/net/e1000/e1000_ethdev.h > @@ -332,9 +332,10 @@ struct igb_eth_syn_filter_ele { > }; >=20 > #define IGB_FLEX_FILTER_MAXLEN 128 /**< bytes to use in flex filter. */ > -#define IGB_FLEX_FILTER_MASK_SIZE \ > - (RTE_ALIGN(IGB_FLEX_FILTER_MAXLEN, CHAR_BIT) / CHAR_BIT) > - /**< mask bytes in flex filter. */ > +#define IGB_FLEX_FILTER_MASK_SIZE = \ > + (RTE_ALIGN_FLOOR(IGB_FLEX_FILTER_MAXLEN + (CHAR_BIT - 1), CHAR_BIT) / = \ > + CHAR_BIT) > +/**< mask bytes in flex filter. */ >=20 Since: RTE_ALIGN --> RTE_ALIGN_CEIL(val, align) --> RTE_ALIGN_FLOOR(...) Why only change 'RTE_ALIGN_CEIL', but then call 'RTE_ALIGN_FLOOR' directly = ? Sorry, can't get the point. : - ( Why not change 'RTE_ALIGN' if it has issue ? >=20 > diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h > index a142596587..6acd067b5c 100644 > --- a/lib/eal/include/rte_common.h > +++ b/lib/eal/include/rte_common.h > @@ -294,8 +294,13 @@ static void __attribute__((destructor(RTE_PRIO(prio)= ), used)) func(void) > * point to an address no lower than the first parameter. Second paramet= er > * must be a power-of-two value. > */ > -#define RTE_PTR_ALIGN_CEIL(ptr, align) \ > - RTE_PTR_ALIGN_FLOOR((typeof(ptr))RTE_PTR_ADD(ptr, (align) - 1), align) > +#define RTE_PTR_ALIGN_CEIL(ptr, align) = \ > + __extension__({ = \ > + typeof(ptr) _pc =3D (ptr); \ > + typeof(align) _ac =3D (align); \ > + RTE_PTR_ALIGN_FLOOR((typeof(ptr))RTE_PTR_ADD(_pc, _ac - 1), \ > + _ac); \ > + }) >=20 > /** > * Macro to align a value to a given power-of-two. The resultant value > @@ -303,8 +308,12 @@ static void __attribute__((destructor(RTE_PRIO(prio)= ), used)) func(void) > * than the first parameter. Second parameter must be a power-of-two > * value. > */ > -#define RTE_ALIGN_CEIL(val, align) \ > - RTE_ALIGN_FLOOR(((val) + ((typeof(val)) (align) - 1)), align) > +#define RTE_ALIGN_CEIL(val, align) = \ > + __extension__({ = \ > + typeof(val) _vc =3D (val); \ > + typeof(val) _ac =3D (typeof(val))(align); \ > + RTE_ALIGN_FLOOR((_vc + _ac - 1), _ac); \ > + }) >=20 > /** > * Macro to align a pointer to a given power-of-two. The resultant > diff --git a/lib/ethdev/rte_eth_ctrl.h b/lib/ethdev/rte_eth_ctrl.h > index 42652f9cce..863e56170b 100644 > --- a/lib/ethdev/rte_eth_ctrl.h > +++ b/lib/ethdev/rte_eth_ctrl.h > @@ -431,8 +431,9 @@ enum rte_fdir_mode { > }; >=20 > #define UINT64_BIT (CHAR_BIT * sizeof(uint64_t)) > -#define RTE_FLOW_MASK_ARRAY_SIZE \ > - (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT64_BIT)/UINT64_BIT) > +#define RTE_FLOW_MASK_ARRAY_SIZE = \ > + (RTE_ALIGN_FLOOR(RTE_ETH_FLOW_MAX + (UINT64_BIT - 1), UINT64_BIT) / = \ > + UINT64_BIT) >=20 > /** > * A structure used to get the information of flow director filter. > -- > 2.17.1