From patchwork Fri Oct 6 10:29:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 132358 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB61D426CF; Fri, 6 Oct 2023 12:29:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4D1D4069F; Fri, 6 Oct 2023 12:29:41 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id DAD24402F2 for ; Fri, 6 Oct 2023 12:29:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696588180; x=1728124180; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ei7d9M+DuI02gFcMoP3zATXJlEYtUJNYaTkR4SoQOSM=; b=QaQxNIyoCvC5H0k1qgXpsQVyAJCL/KznXUK8nFlgOu80XHrEcdNVQbOF nGMec621Is1Fm+OYEBHI9EW9ZA3rsA8HAJWQ2mvin1JQtbYM3JdUlH7Ur jEUreXN6prCrZ5iBMSH0fGEoDxyfjw4EwY7ufRHZR4pT2SCDO2ouXUx92 c1zmR8xHegXhcWMT5sXpH9BvimdD+dQ9YP/e8F26IitiJgU3U1P3KI1CD uPmmq4KS8ITzhnEbrtMJtd4INevcRWJOaL08wIwQtlerMAsUEjvRKF4FI /7LAnWPVFvPpivhY3+r0OUqeCKtdtVICqJP1ENQY2o671IjbtjixDogvQ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="382591444" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="382591444" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2023 03:29:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="1083407315" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="1083407315" Received: from silpixa00401385.ir.intel.com ([10.237.214.135]) by fmsmga005.fm.intel.com with ESMTP; 06 Oct 2023 03:29:36 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , =?utf-8?q?Morten_Br=C3=B8?= =?utf-8?q?rup?= , Jerin Jacob Subject: [PATCH v4] eventdev: ensure 16-byte alignment for events Date: Fri, 6 Oct 2023 11:29:32 +0100 Message-Id: <20231006102932.164630-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231005115101.12276-1-bruce.richardson@intel.com> References: <20231005115101.12276-1-bruce.richardson@intel.com> MIME-Version: 1.0 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 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ørup Acked-by: Jerin Jacob --- v4: change _Static_assert to static_assert for fwd compatibility moved size check on event structure to C file from header file v3: Fix spelling mistake in RN entry rebase on latest eventdev tree HEAD v2: added release note entry for ABI change added structure comment on 16-byte size and alignment added static assert for structure size --- doc/guides/rel_notes/release_23_11.rst | 4 ++++ lib/eventdev/rte_eventdev.c | 3 +++ lib/eventdev/rte_eventdev.h | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index 0903046b0c..33fed3e433 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -209,6 +209,10 @@ ABI Changes fields, to move ``rxq`` and ``txq`` fields, to change the size of ``reserved1`` and ``reserved2`` fields. +* The ``rte_event`` structure, used by eventdev library and DPDK "event" class drivers, + is now 16-byte aligned, as well as being 16-bytes in size. + In previous releases, the structure only required 8-byte alignment. + Known Issues ------------ diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c index 95373bbaad..adc9751cef 100644 --- a/lib/eventdev/rte_eventdev.c +++ b/lib/eventdev/rte_eventdev.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -28,6 +29,8 @@ #include "eventdev_pmd.h" #include "eventdev_trace.h" +static_assert(sizeof(struct rte_event) == 16, "Event structure size is not 16-bytes in size"); + static struct rte_eventdev rte_event_devices[RTE_EVENT_MAX_DEVS]; struct rte_eventdev *rte_eventdevs = rte_event_devices; diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h index 2ea98302b8..758ee83a3f 100644 --- a/lib/eventdev/rte_eventdev.h +++ b/lib/eventdev/rte_eventdev.h @@ -1284,6 +1284,8 @@ struct rte_event_vector { /** * The generic *rte_event* structure to hold the event attributes * for dequeue and enqueue operation + * + * This structure must be kept at 16-bytes in size, and has 16-byte alignment. */ struct rte_event { /** WORD0 */ @@ -1356,7 +1358,7 @@ struct rte_event { struct rte_event_vector *vec; /**< Event vector pointer. */ }; -}; +} __rte_aligned(16); /* Ethdev Rx adapter capability bitmap flags */ #define RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT 0x1