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 888CD4333B; Wed, 15 Nov 2023 19:14:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2DB8E402B7; Wed, 15 Nov 2023 19:14:11 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 63223402B2 for ; Wed, 15 Nov 2023 19:14:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700072049; x=1731608049; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=UyoWBckVbVJt4vR1o+8HcN+BC2AkxuHVajuG4OPYe9M=; b=V1Y13r3c6rAK0Yg3hGD8/DLbraxy4OaEejUdf7PeQiQ/HUQzt/eJ135W UW+nLM7JX+yXMCaw4Ljdbbj3g1DDDrl8ticyy3TnvLFfrMvQN0Adm0k/B BulMoag26WsQQMvcY/aipGiTTPetTXMPYhyjBxOS801b9hF5fBYsJLKyD rJgDNcQUydH3mPJpR628gmJZH1vi41GtpLBXzRWCViO34yckZchdfyQZm eF9CDUR1iYDE/ltj+1yxvl4sSuJ1kJfQggT1bav56V7hARx3ydzVCO9r7 t7RRBW/A7hsOuO0mEOO26eRpANEtraxHTHKGrH3HU1QVuCg9TvpznPZ2G Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="381320233" X-IronPort-AV: E=Sophos;i="6.03,305,1694761200"; d="scan'208";a="381320233" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2023 10:14:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="855727023" X-IronPort-AV: E=Sophos;i="6.03,305,1694761200"; d="scan'208";a="855727023" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by FMSMGA003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 15 Nov 2023 10:14:07 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 15 Nov 2023 10:14:06 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Wed, 15 Nov 2023 10:14:06 -0800 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.41) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Wed, 15 Nov 2023 10:14:05 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CP/vnC5IF7921sTWHs/smnHtpGAoCaV/SGZTs0q+JcgbbLJ7pQFnxL0rzXLVJThW7zgTGKlyvC3dEETQQ0g9jCbqdsMUUX6NBAiySJ9ZwEoDsyB0rPZEGak5w4xyBKb/mv5k50hw5x+SRKOvQPg0rd5Lc6vqyJooUhkntkeKkfyVdszSXQusbWCpMSd/YcFlPQpXq7FGB02hwAM6QO01Y5fJwsTjPnW4CH7T94e0WxC3H0/MFU8kvbRfo1xurucbXNi0LZ03WrIB7fRrPphHBb6trEBmRcP9Y8P734T3SYeUWqnACEsMmRstOYPW+3hTnvXup1hr3n6ktu6DF9RjfA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OkQwXx5zr8ZZfg5ptogKXIYEBaF34uhvJY0P/w1LldM=; b=fLNUHtUJOUxQsy/5xMI9mQsGQ78CsRrvAGfTJVSgZPmOuo0tbbNNS7U2YXohxc0+VyGcy+LZfQkSDDkIfpepl8Jmjjuh9Hg8IyAn6JFA0/v1dFTxYnofrR5XsWjuI6ig2rvSg8m+EsePpJoiqFo6ce2DknjMO57m7kIc3gJ2J99/6m9if4CXBzGYTAKvwqzpV6zuMqNmDyNcX0jh9NUN0bMOupfVZO0r1e7TOPQIka4E9WSXDT/c4sOSoSjyxIQD9mAyh8LdWbDr8Woebz+MIdG0+Rl4p4xJ/nq11hdQPbe/aVzbZeyHc7yERzhftwtN4yCnECaX+InK1PakH/h0sw== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by SA2PR11MB4859.namprd11.prod.outlook.com (2603:10b6:806:f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.17; Wed, 15 Nov 2023 18:14:02 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::8645:d921:ce8a:12ba]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::8645:d921:ce8a:12ba%5]) with mapi id 15.20.6977.029; Wed, 15 Nov 2023 18:14:02 +0000 Date: Wed, 15 Nov 2023 18:13:55 +0000 From: Bruce Richardson To: Tyler Retzlaff CC: , Mattias =?iso-8859-1?Q?R=F6nnblom?= , Anatoly Burakov , David Christensen , Harry van Haaren , Konstantin Ananyev , Min Zhou , "Ruifeng Wang" , Stanislaw Kardach Subject: Re: [PATCH] eal: use C11 alignas instead of GCC attribute aligned Message-ID: References: <1700069997-4399-1-git-send-email-roretzla@linux.microsoft.com> <1700069997-4399-2-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1700069997-4399-2-git-send-email-roretzla@linux.microsoft.com> X-ClientProxiedBy: DB9PR05CA0030.eurprd05.prod.outlook.com (2603:10a6:10:1da::35) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SA2PR11MB4859:EE_ X-MS-Office365-Filtering-Correlation-Id: f03297d8-0db5-4c9a-7040-08dbe606a553 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fstAMcUy8fNWZqEY/97hYmTW4eYhZ9w8+R/uHqixjHnwsNq/lex40fe3aFDvvwyRSwHQWazZWktAzT4o7CR8u9H6VoNjZYfoyHiBYXDGDUNcG1/4KW6CzdGgidRWIkjUI6zrdO6G6o3d3gr5swkQ4wr4JYhiPdG8KNkHEYzh5kPsUVpY4iUzeduHjfrDEGB7WYuj6YKmAd7jvKm0x7ynQRosJhobW1FNlPlJGf42Sw7BEt60OIYHvrhME3wubCH/4CemtfBFLcdGLpRgkUTx14w+B1g6lBb5AHA63u5MMAELPOJEBKAyGLF6ROe4Aiipj6epDROKxRI4H2ijRO1OPkPZBqloh0GF+J8X3GNW8hdOfscfGBw9QFZoz+CVTxpXObnhBP2sGuOX07VXBj6xmnIz1ai0I8tH0/97cgCu6QKURmwR1KAOQyclB34h9rvToZbjXDBLE5LAhm147EXJL7dadPq/EnQNLU3veTcQSmwlES7rI86nF1cFigc4EN6KWuSjdRIyFd7e6qEIrx2mW7QMLs3hIPDC8ZxnAL1TE3lJnnPbdvGIq6PP4B6W0956 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(346002)(39860400002)(376002)(366004)(136003)(230922051799003)(64100799003)(451199024)(1800799009)(186009)(6506007)(44832011)(6512007)(38100700002)(2906002)(26005)(82960400001)(83380400001)(86362001)(41300700001)(5660300002)(66556008)(478600001)(6916009)(316002)(66476007)(54906003)(66946007)(6486002)(6666004)(4326008)(8936002)(8676002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?EkBbWnuF8wFpG0/DzbhqXpA2QbpYKd25DTxMqEVd2QFG0C4lv7dk8NlOApR/?= =?us-ascii?Q?y9nfwJQpGDyhCFE7STKzrKuFPs0RiWIP+caoXyfHTR0YqLiKPpSX42XRa43S?= =?us-ascii?Q?FUsEc6Q7pY9NExyTnL8ruSbG3bFCryGw8KwhN9mFo3HzsaSK/gzAw43gPFwm?= =?us-ascii?Q?PblZSy4mTx/NN3ofgwFSs4AcmqZjkOhkTmNIw4phV1wL6sWW1p283aBYLkeD?= =?us-ascii?Q?3w1uBOtz+/i9EM7VzPlhLtFoYEIWmf3f0o605SLLfqgQevvVUVkC/xLRX/ss?= =?us-ascii?Q?j0iqcojVh4ogsczzc9wGtawYB0Ltn+ZNWySDQBIskKubVhGF4boP5vs1mZpk?= =?us-ascii?Q?8xc2QzA5HxUMnqetTdAHu1kxm3cD/Gc52qbJMhSoSa22L3mBUbV7j10ZhvPT?= =?us-ascii?Q?zObebVWyUNtcsiwO7zbNMWbPhFPB4x6kzhFfJl8IOihpqpHSb2wg0FDlV1MI?= =?us-ascii?Q?KT+BdoQzYfNOYmL6HwguGOc1tx8DAfmedLXrEAVm6HHYDtqOv0boEVGcTypW?= =?us-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/0k1lwV6tdeW0ntB9D9H1beYV2U?= =?us-ascii?Q?jxTdjVVt4/OykWwCVKrzzDO3iwnE01n1gXMys2KmK2IOdES1ganD9f6Vx5C+?= =?us-ascii?Q?qwEl72eUcIZiUlbHz2fesS9YnnXYlfKGQGmoCRJJqaZB5ZM7KpN9XWtSadBj?= =?us-ascii?Q?+D2Rs4IKtR3GlY9zZuoSo4E4+2ppUXlixm9K/oRZdTL1JIeJm9aOFpsAs9Wx?= =?us-ascii?Q?Sg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: f03297d8-0db5-4c9a-7040-08dbe606a553 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2023 18:14:02.3113 (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: De6sUSGSaDlSpIb8ubjS8NxFeqQJl2qF4grwlDMlY/JWgCo7h2iL1RMl96Uxp2fak6TqbMyJMkXV5qfkiso+3Rcu+HMWaMbDXLt4zOzNXRk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB4859 X-OriginatorOrg: intel.com 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, Nov 15, 2023 at 09:39:57AM -0800, Tyler Retzlaff wrote: > Now that we have enabled C11 replace the use of __rte_cache_aligned > and __rte_aligned(n) with alignas(RTE_CACHE_LINE_SIZE) and > __rte_aligned(n) respectively. alignas(n) > > Signed-off-by: Tyler Retzlaff > --- > lib/eal/arm/include/rte_vect.h | 4 +++- > lib/eal/common/malloc_elem.h | 4 +++- > lib/eal/common/malloc_heap.h | 4 +++- > lib/eal/common/rte_keepalive.c | 4 +++- > lib/eal/common/rte_random.c | 5 ++++- > lib/eal/common/rte_service.c | 7 +++++-- > lib/eal/include/generic/rte_atomic.h | 4 +++- > lib/eal/loongarch/include/rte_vect.h | 7 +++++-- > lib/eal/ppc/include/rte_vect.h | 5 ++++- > lib/eal/riscv/include/rte_vect.h | 4 +++- > lib/eal/x86/include/rte_vect.h | 4 +++- > lib/eal/x86/rte_power_intrinsics.c | 8 ++++++-- > 12 files changed, 45 insertions(+), 15 deletions(-) > > diff --git a/lib/eal/arm/include/rte_vect.h b/lib/eal/arm/include/rte_vect.h > index 8cfe4bd..c7a3b2e 100644 > --- a/lib/eal/arm/include/rte_vect.h > +++ b/lib/eal/arm/include/rte_vect.h > @@ -5,6 +5,7 @@ > #ifndef _RTE_VECT_ARM_H_ > #define _RTE_VECT_ARM_H_ > > +#include > #include > #include "generic/rte_vect.h" > #include "rte_debug.h" > @@ -25,13 +26,14 @@ > #define XMM_MASK (XMM_SIZE - 1) > > typedef union rte_xmm { > + alignas(16) > xmm_t x; > uint8_t u8[XMM_SIZE / sizeof(uint8_t)]; This may seem minor but I really don't like the indentation style used for these alignas statements. To a casual glance they look like elements in the struct. The previous macros were nice is that it was hard to mistake them for anything other than additional info on the struct. Couple of suggestions: 1. Put them on the same line as the definition of the first element. The downside is that we lose the (as here) implication that it's the struct being aligned more than just the first element. 2. Alternatively, how about putting the alignas on the same line as the struct/union e.g. struct rte_xyz { alignas(16) ... } In this case, or perhaps generally, perhaps we want to define rte_aliases with underscores for these alignas to further visually separate them. Thoughts? /Bruce