From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id C77BD7D0D for ; Fri, 2 Jun 2017 22:12:15 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jun 2017 13:12:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,286,1493708400"; d="scan'208";a="269567651" Received: from dverkamp-desk2.ch.intel.com ([143.182.137.94]) by fmsmga004.fm.intel.com with ESMTP; 02 Jun 2017 13:12:14 -0700 From: Daniel Verkamp To: dev@dpdk.org Cc: Daniel Verkamp Date: Fri, 2 Jun 2017 13:12:13 -0700 Message-Id: <20170602201213.51143-1-daniel.verkamp@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170602200337.50743-1-daniel.verkamp@intel.com> References: <20170602200337.50743-1-daniel.verkamp@intel.com> Subject: [dpdk-dev] [PATCH v2] ring: use aligned memzone allocation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jun 2017 20:12:16 -0000 rte_memzone_reserve() provides cache line alignment, but struct rte_ring may require more than cache line alignment: on x86-64, it needs 128-byte alignment due to PROD_ALIGN and CONS_ALIGN, which are 128 bytes, but cache line size is 64 bytes. Fixes runtime warnings with UBSan enabled. Fixes: d9f0d3a1ffd4 ("ring: remove split cacheline build setting") Signed-off-by: Daniel Verkamp --- v2: fixed checkpatch warnings lib/librte_ring/rte_ring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_ring/rte_ring.c b/lib/librte_ring/rte_ring.c index 5f98c33..6f58faf 100644 --- a/lib/librte_ring/rte_ring.c +++ b/lib/librte_ring/rte_ring.c @@ -189,7 +189,8 @@ rte_ring_create(const char *name, unsigned count, int socket_id, /* reserve a memory zone for this ring. If we can't get rte_config or * we are secondary process, the memzone_reserve function will set * rte_errno for us appropriately - hence no check in this this function */ - mz = rte_memzone_reserve(mz_name, ring_size, socket_id, mz_flags); + mz = rte_memzone_reserve_aligned(mz_name, ring_size, socket_id, + mz_flags, __alignof__(*r)); if (mz != NULL) { r = mz->addr; /* no need to check return value here, we already checked the -- 2.9.4