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 0EC83426CF; Fri, 6 Oct 2023 12:35:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8AECC402F2; Fri, 6 Oct 2023 12:35:31 +0200 (CEST) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id AB2B9402A8 for ; Fri, 6 Oct 2023 12:35:30 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id B81F120602; Fri, 6 Oct 2023 12:35:29 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH v3] eventdev: ensure 16-byte alignment for events Date: Fri, 6 Oct 2023 12:35:26 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9EF04@smartserver.smartshare.dk> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH v3] eventdev: ensure 16-byte alignment for events Thread-Index: Adn4Pj94bMp8mPteQEyYqo9v8r4TJgAAZqBA References: <20231005115101.12276-1-bruce.richardson@intel.com> <20231006094527.73867-1-bruce.richardson@intel.com> <98CBD80474FA8B44BF855DF32C47DC35E9EF03@smartserver.smartshare.dk> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Bruce Richardson" Cc: , "Jerin Jacob" 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 > From: Bruce Richardson [mailto:bruce.richardson@intel.com] > Sent: Friday, 6 October 2023 12.17 ev: ensure 16-byte alignment for events >=20 > On Fri, Oct 06, 2023 at 12:13:54PM +0200, Morten Br=F8rup wrote: > > > From: Bruce Richardson [mailto:bruce.richardson@intel.com] > > > Sent: Friday, 6 October 2023 11.45 > > > > > > The event structure in DPDK is 16-bytes in size, and events are > > > regularly passed as parameters directly rather than being passed = as > > > pointers. To help compiler optimize correctly, we can explicitly = request > > > 16-byte alignment for events, which means that we should be able > > > to do aligned vector loads/stores (e.g. with SSE or Neon) when = working > > > with those events. > > > > > > Signed-off-by: Bruce Richardson > > > Acked-by: Morten Br=F8rup > > > Acked-by: Jerin Jacob > > > > > > --- > > > > [...] > > > > > +_Static_assert(sizeof(struct rte_event) =3D=3D 16, "Event = structure size is > not 16-bytes in size"); > > > > Thank you for adding this extra check. We should have more of these. > > > > NB: _Static_assert is deprecated in C23 [1], so for forward = compatibility, > you could use static_assert (which is available in ) = instead. Nice > to have; feel free to ignore this comment. > > > Is the availability in assert.h backward compatible with C11, since = the > link you posted seems to imply that "static_assert" is only from C23 > onwards? Yes, the link mentions "static_assert" being available for C11 as a = convenience macro in assert.h. I had to read the link very carefully to get this. I guess I'm not the = only one. :-) I don't object to moving it to the .c file. However, I think it's = convenient for readability to have the static_assert close to the thing = it checks, and/or close to any code that relies on the assumption it = checks.