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 1D7FA43D05; Wed, 20 Mar 2024 16:43:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E46542E46; Wed, 20 Mar 2024 16:39:17 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 726AA42D2B for ; Wed, 20 Mar 2024 16:38:33 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id BFBAD20B4902; Wed, 20 Mar 2024 08:38:21 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BFBAD20B4902 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1710949103; bh=bZBr3JX1i1gD+5Ew99wNpLJ6OUDVkGp/dr9W0KBTmUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ml++lwSwihr3DScWwvDZFPe/98rILEO39iUO/WYcvf93xqs6UKvqkeOLch6+fjidU 9LWNDk+jPPPw1oLYIghNQggu9dEKaoOkkVoV0JXYNodvXpq78GtDfoeKXfHC8fr52s ZhlPKc0uAfDRbrrY5arwZ9Vdt0WRPy+RjWeXrYD0= From: Tyler Retzlaff To: dev@dpdk.org Cc: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , "Min Hu (Connor)" , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Abdullah Sevincer , Ajit Khaparde , Akhil Goyal , Alok Prasad , Amit Bernstein , Anatoly Burakov , Andrew Boyer , Andrew Rybchenko , Ankur Dwivedi , Anoob Joseph , Ashish Gupta , Ashwin Sekhar T K , Bruce Richardson , Byron Marohn , Chaoyong He , Chas Williams , Chenbo Xia , Chengwen Feng , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Devendra Singh Rawat , Ed Czeck , Evgeny Schemeilin , Fan Zhang , Gagandeep Singh , Guoyang Zhou , Harman Kalra , Harry van Haaren , Hemant Agrawal , Honnappa Nagarahalli , Hyong Youb Kim , Jakub Grajciar , Jerin Jacob , Jian Wang , Jiawen Wu , Jie Hai , Jingjing Wu , John Daley , John Miller , Joyce Kong , Junfeng Guo , Kai Ji , Kevin Laatz , Kiran Kumar K , Konstantin Ananyev , Lee Daly , Liang Ma , Liron Himi , Long Li , Maciej Czekaj , Matan Azrad , Matt Peters , Maxime Coquelin , Michael Shamis , Nagadheeraj Rottela , Nicolas Chautru , Nithin Dabilpuram , Ori Kam , Pablo de Lara , Pavan Nikhilesh , Peter Mccarthy , Radu Nicolau , Rahul Lakkireddy , Rakesh Kudurumalla , Raveendra Padasalagi , Reshma Pattan , Ron Beider , Ruifeng Wang , Sachin Saxena , Selwin Sebastian , Shai Brandes , Shepard Siegel , Shijith Thotton , Sivaprasad Tummala , Somnath Kotur , Srikanth Yalavarthi , Stephen Hemminger , Steven Webster , Suanming Mou , Sunil Kumar Kori , Sunil Uttarwar , Sunila Sahu , Tejasree Kondoj , Viacheslav Ovsiienko , Vikas Gupta , Volodymyr Fialko , Wajeeh Atrash , Wisam Jaddo , Xiaoyun Wang , Yipeng Wang , Yisen Zhuang , Yuying Zhang , Zhangfei Gao , Zhirun Yan , Ziyang Xuan , Tyler Retzlaff Subject: [PATCH 42/83] event/opdl: move alignment attribute on types Date: Wed, 20 Mar 2024 08:37:35 -0700 Message-Id: <1710949096-5786-43-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1710949096-5786-1-git-send-email-roretzla@linux.microsoft.com> References: <1710949096-5786-1-git-send-email-roretzla@linux.microsoft.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 Move location of __rte_aligned(a) to new conventional location. The new placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for both C and C++. Additionally, it avoids confusion by Doxygen when generating documentation. Signed-off-by: Tyler Retzlaff --- drivers/event/opdl/opdl_evdev.h | 6 +++--- drivers/event/opdl/opdl_ring.c | 19 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/event/opdl/opdl_evdev.h b/drivers/event/opdl/opdl_evdev.h index 1ca166b..176990e 100644 --- a/drivers/event/opdl/opdl_evdev.h +++ b/drivers/event/opdl/opdl_evdev.h @@ -234,15 +234,15 @@ struct opdl_evdev { uint32_t nb_q_md; /* Internal queues - one per logical queue */ - struct opdl_queue - queue[RTE_EVENT_MAX_QUEUES_PER_DEV] __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) struct opdl_queue + queue[RTE_EVENT_MAX_QUEUES_PER_DEV]; uint32_t nb_queues; struct opdl_stage_meta_data s_md[OPDL_PORTS_MAX]; /* Contains all ports - load balanced and directed */ - struct opdl_port ports[OPDL_PORTS_MAX] __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) struct opdl_port ports[OPDL_PORTS_MAX]; uint32_t nb_ports; uint8_t q_map_ex_to_in[OPDL_INVALID_QID]; diff --git a/drivers/event/opdl/opdl_ring.c b/drivers/event/opdl/opdl_ring.c index da5ea02..e87ffd5 100644 --- a/drivers/event/opdl/opdl_ring.c +++ b/drivers/event/opdl/opdl_ring.c @@ -43,7 +43,7 @@ enum dep_type { * Care is needed when accessing and the layout is important, especially to * limit the adjacent cache-line HW prefetcher from impacting performance. */ -struct shared_state { +struct __rte_cache_aligned shared_state { /* Last known minimum sequence number of dependencies, used for multi * thread operation */ @@ -54,7 +54,7 @@ struct shared_state { struct opdl_stage *stage; /* back pointer */ uint32_t tail; /* Tail sequence number */ char _pad3[RTE_CACHE_LINE_SIZE * 2]; -} __rte_cache_aligned; +}; /* A structure to keep track of "unfinished" claims. This is only used for * stages that are threadsafe. Each lcore accesses its own instance of this @@ -63,7 +63,7 @@ struct shared_state { * forward the shared tail when the shared tail matches the tail value recorded * here. */ -struct claim_manager { +struct __rte_cache_aligned claim_manager { uint32_t num_to_disclaim; uint32_t num_claimed; uint32_t mgr_head; @@ -72,13 +72,13 @@ struct claim_manager { uint32_t head; uint32_t tail; } claims[OPDL_DISCLAIMS_PER_LCORE]; -} __rte_cache_aligned; +}; /* Context for each stage of opdl_ring. * Calculations on sequence numbers need to be done with other uint32_t values * so that results are modulus 2^32, and not undefined. */ -struct opdl_stage { +struct __rte_cache_aligned opdl_stage { struct opdl_ring *t; /* back pointer, set at init */ uint32_t num_slots; /* Number of slots for entries, set at init */ uint32_t index; /* ID for this stage, set at init */ @@ -99,14 +99,13 @@ struct opdl_stage { /* Direct dependencies of this stage */ struct shared_state **deps; /* Other stages read this! */ - struct shared_state shared __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) struct shared_state shared; /* For managing disclaims in multi-threaded processing stages */ - struct claim_manager pending_disclaims[RTE_MAX_LCORE] - __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) struct claim_manager pending_disclaims[RTE_MAX_LCORE]; uint32_t shadow_head; /* Shadow head for single-thread operation */ uint32_t queue_id; /* ID of Queue which is assigned to this stage */ uint32_t pos; /* Atomic scan position */ -} __rte_cache_aligned; +}; /* Context for opdl_ring */ struct opdl_ring { @@ -120,7 +119,7 @@ struct opdl_ring { /* Stages indexed by ID */ struct opdl_stage *stages; /* Memory for storing slot data */ - uint8_t slots[0] __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) uint8_t slots[0]; }; -- 1.8.3.1