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 DAA8D43BE8; Mon, 26 Feb 2024 12:13:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A238D402C8; Mon, 26 Feb 2024 12:13:45 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by mails.dpdk.org (Postfix) with ESMTP id 307A040144 for ; Mon, 26 Feb 2024 12:13:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708946025; x=1740482025; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=T0I0PxBcY7gtNglH0hVFtZ9IDcRljaqoaT03qas5U8o=; b=S7NxaAlrXthpoyUbimTrU8eJDLrmc/9Bvc7t/9jEVUI/KLb8eG/LfVAV TAtaLAsGhAw9ZvdNS2Y+UCwseMSbce89bM6NBtuZIjAyeQwfYFwUVcIJ4 +GAMxNkXTBS9txM531wpO/LmJl5nSx2NAOCXq3vxvmwHQRl3/DThO9qTY H3T03Jk5hcM9sQ+rt6F1a6PtT3FknWAVEtkkpaBP7Ro+ZIdkSyrIKfh+L jzwK/GyzWzsi0yTYBfWyqRs4LbMhso0N+4Wgb+orCqI1/BibUK08xckJ9 FgJ5slhHfpZq2Rfx6dbAaqf8F90iitOKpzRIjfOs5MbsDSn4Hk8HOY2ny w==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="14658086" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="14658086" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 03:13:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="29814008" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmviesa002.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 26 Feb 2024 03:13:43 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 26 Feb 2024 03:13:42 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 26 Feb 2024 03:13:42 -0800 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.40) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 26 Feb 2024 03:13:42 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GpLCrjO/JMDGVyDjW+MSj8CjrbzGwGUSpP9iV91t4Nhd0Nuie+PRR1BokggvSKJxkq3vqMb3UwzLfY+IXbqEOHKDbf/BnJT0lqbyeZzH1Y73F9QcEITavh4QTAtwXzNI+CN+Q55ZN3TYYrYWCFO4CTLEAiDXDFJxHIKBP/pnHBl1Gp9ihWh6QGIH+czyhaHX7sIGwATdTG+yodZuWWHW0LZN9hJQqY5QRjy7Rjm+npilCWguG2ViOtF7PMhYNDB4/C5a6fR2j4ciuYDE25zb2itx7HIbC19WvoEwiMDaVAkpYANMoQSAydbRxyC3tm9CE3ftH8WgHWrQ7/w0NlLlRg== 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=oGJXKzT0qLM56DqySPEZleI2p/tGMWeW2sJ+dgeXW+E=; b=SEkDFr5xLux7ioXHRDFdA5a8nxizGR5Nw2QbI+RivMA2iilOzUDnEDv2taAc8CumfAjQJyyEbX9yoCf/qOqB5REJoJsiL6JrdqJhwq2npC94uWeH89kLMsAskY7BqVM8QyFqTfJEKw+66qZvfDwYDdZP+i94vSpc9IOTKvHtpUDswhxX+v9yGSNmjLAq1wwkz4zJEAd3OZ+P9BrBIif+sdqvnE6fsS2heW8hDKzwUkfSciVZj5mLNHRrVLKhZ3BHBHSCYDs7dKNvBP81AN/OMwxjD/RMhpC9LFc+xr9ubKA4JXbbv24yYppVIpUkMN+t4YqAtpmG3Q9X5V1v2zRlww== 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 DS0PR11MB7508.namprd11.prod.outlook.com (2603:10b6:8:152::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.13; Mon, 26 Feb 2024 11:13:40 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::d10:3009:a8d3:1d2e]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::d10:3009:a8d3:1d2e%7]) with mapi id 15.20.7339.024; Mon, 26 Feb 2024 11:13:40 +0000 Date: Mon, 26 Feb 2024 11:13:32 +0000 From: Bruce Richardson To: Tyler Retzlaff CC: , Andrew Rybchenko , "Chengwen Feng" , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , "Sameh Gobriel" , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang Subject: Re: [PATCH v5 01/39] eal: use C11 alignas Message-ID: References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1708715054-22386-1-git-send-email-roretzla@linux.microsoft.com> <1708715054-22386-2-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1708715054-22386-2-git-send-email-roretzla@linux.microsoft.com> X-ClientProxiedBy: DU7P195CA0003.EURP195.PROD.OUTLOOK.COM (2603:10a6:10:54d::19) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|DS0PR11MB7508:EE_ X-MS-Office365-Filtering-Correlation-Id: ba36b53f-3e92-48c1-9082-08dc36bbfc29 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /UBoyfrCAc2UTCe4dvm4ttaOIjsp2czlsnsCGnAIMsVv//bCyFY/Mp0f7iGDMsoOXkXFV7LjhjPxw2Wfw/B0AZx0QzYey4IsbY43B6SOTCBowOF8h2s7odD/oy92jz+Be0ky7pspgDISKzWOdZHBtyr01s01uwkLDh2CDCFRNhrIBK2zu/3shCFI7JzyypPFXipEqZYKersr2A/W98ced2CNib5E728bGNbHZEGKVy3v+FVUVRIYZJ9nrbEijo4B2WinWAXDB+d/7q1JDmBvpCyPMr9ngsgCsLGUkvYhVjiQIxPMGoqmRevErYPqTM85xa0F7qOfahQgfz7e554zFLGkAppmw9OocFETXVEYFZcdrxokad62FkMox8veNwaZhZO3IvRkk6f1nOJjYhWmbGotpLtCxL3HnrfrY+8d2jl1tMCI6sJBMYRdmlx8eNx7cpA4vnph4etCFc2EI+utflLiFympxmN8ao+LMw2Yy38w9f2IW68gVNgtd1zw8XM4CeRakTKWOeb5tLZK8lcJZdZWXTonZ0c/a5n3RKYiYbO2MkQzJulQ7LqTBfLTohHeIjoUWq08YFAAm6OwybL0cMkYTG7DOtiW3JNS1SfgdfPiG1qa2Uetpg06gH82Df95 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); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?SCMIeo+ETWIenD+HcYIMcEuogqgkZqwT3RmZUNKO9lHIGE8CnTJhtxN45g?= =?iso-8859-1?Q?Rtq/NNBaUUsChAhEka2tPL8FaW00CdRkYY+1A/5kn+rxQbd/vkLfpLSsKU?= =?iso-8859-1?Q?pNwzvHumDr9Dq/Omi5vDeU+r6iugYiIMtk+SSuCeiDAr/KHg180ZmMAnHD?= =?iso-8859-1?Q?KnmPnRo1PCzb4JgoHNnsBQZ1Br2Ed7f8vsMHXBZ0QCPjYPx6vZzd8qaIx9?= =?iso-8859-1?Q?QeRYFicqUhHX6AitNlQSvDhjjryFdK9Cpv4Wvsm94jWRZiZS5Qdx/OqqZ1?= =?iso-8859-1?Q?VXMN/FN9QPtSku2hFc5hxzK2xYE2KLOygrtfYB+jf5W83fJeC3cYhFeUsy?= =?iso-8859-1?Q?j05RZLNpICvyiHQcaiM+ccW6SYxPfLuPKniG4XaQKMisMowbMKPncQSA6L?= =?iso-8859-1?Q?nHmfW0moWYskx0T2AGL/n+SaVkmQxkmnPmxMStqxY2bpLYEK1QL6Iu8usS?= =?iso-8859-1?Q?Fy2J8QJYWq6sa6K7QlXgNzVtHfiDtbhg1WRdeQoQfQ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ba0O35D6VUPVsKegsg7fKuAGZthgfeuAOUK7e+DXWY0?= =?iso-8859-1?Q?+v5I7DRbrhW752icMZ7QWWX4/0G19NCjQKGYBqmY3T4ObHlSy063WDGDKK?= =?iso-8859-1?Q?OJkykOLHiVsp5PhUiRN3KAEew9Px+TRbKG8G/HmKs+p7o0ZPbqho02aZ3h?= =?iso-8859-1?Q?7YfSz3APnscYZBOeyv7VOg/7F+tjbHgHRReJp0+g65dKSfy3ZPuHGlpEnp?= =?iso-8859-1?Q?Qjoqzt1BOU1tMCm9HjYlsN/f2uUsFGNREwsAWZ5WvCJ+5EvovsEhU0cw?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: ba36b53f-3e92-48c1-9082-08dc36bbfc29 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 11:13:39.9704 (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: N00mOxmfFahADnXz9DvIb6wFnyZvZ1ZgvvO/It5TgnG4BlQ9zjVfa16dO+BDo32rSZhZTZ9Q8f8mZ83lu5tZxOmlEAurTiQZtOs8EXJx/Hw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB7508 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 Fri, Feb 23, 2024 at 11:03:36AM -0800, Tyler Retzlaff wrote: > The current location used for __rte_aligned(a) for alignment of types > and variables is not compatible with MSVC. There is only a single > location accepted by both toolchains. > > For variables standard C11 offers alignas(a) supported by conformant > compilers i.e. both MSVC and GCC. > > For types the standard offers no alignment facility that compatibly > interoperates with C and C++ but may be achieved by relocating the > placement of __rte_aligned(a) to the aforementioned location accepted > by all currently supported toolchains. > > To allow alignment for both compilers do the following: > > * Expand __rte_aligned(a) to __declspec(align(a)) when building > with MSVC. > > * Move __rte_aligned from the end of {struct,union} definitions to > be between {struct,union} and tag. > > The placement between {struct,union} and the tag allows the desired > alignment to be imparted on the type regardless of the toolchain being > used for all of GCC, LLVM, MSVC compilers building both C and C++. > > * Replace use of __rte_aligned(a) on variables/fields with alignas(a). > > Signed-off-by: Tyler Retzlaff > Acked-by: Morten Brørup > --- > 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 | 3 ++- > lib/eal/common/rte_random.c | 4 ++-- > lib/eal/common/rte_service.c | 8 ++++---- > lib/eal/include/generic/rte_atomic.h | 4 ++-- > lib/eal/include/rte_common.h | 23 +++++++++++++++-------- > lib/eal/loongarch/include/rte_vect.h | 8 ++++---- > lib/eal/ppc/include/rte_vect.h | 4 ++-- > lib/eal/riscv/include/rte_vect.h | 4 ++-- > lib/eal/x86/include/rte_vect.h | 4 ++-- > lib/eal/x86/rte_power_intrinsics.c | 10 ++++++---- > 13 files changed, 47 insertions(+), 37 deletions(-) > Just to chime in with one additional benefit of this change - it will prevent static analysers, IDEs and doxygen[1] from ever mistaking the __rte_aligned tag at the end of a struct define as being a variable definition. In the absence of a macro definition from our DPDK header files this defines a variable called __rte_cache_aligned (as in [1]!): struct xyz { } __rte_cache_aligned; while this just gives an error to let you know the definiton is missing: struct __rte_cache_aligned xyz { }; Acked-by: Bruce Richardson [1] http://doc.dpdk.org/api/structrte__ring.html#a43d0b019eced25dc6c357f3b4f0f47e5