From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id D01F6C5CE for ; Mon, 4 May 2015 11:50:19 +0200 (CEST) Received: from was59-1-82-226-113-214.fbx.proxad.net ([82.226.113.214] helo=[192.168.0.10]) by mail.droids-corp.org with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YpD5G-00050J-S1; Mon, 04 May 2015 11:54:46 +0200 Message-ID: <554740D1.4050104@6wind.com> Date: Mon, 04 May 2015 11:50:09 +0200 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.5.0 MIME-Version: 1.0 To: Cyril Chemparathy , dev@dpdk.org References: <1430324134-25654-1-git-send-email-cchemparathy@ezchip.com> In-Reply-To: <1430324134-25654-1-git-send-email-cchemparathy@ezchip.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 00/10] Improve cast alignment for strict aligned machines X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 May 2015 09:50:20 -0000 Hi Cyril, On 04/29/2015 06:15 PM, Cyril Chemparathy wrote: > This series contains a few improvements that allow the DPDK code base to build > properly on machines that enforce strict pointer cast alignment constraints. > > When dealing with packet data which could be arbitrarily aligned, we get the > compiler to do the right thing by (a) making sure that header types are > packed, and (b) introducing and using unaligned_uint(16|32|64)_t types when > upcasting from byte pointers. > > In a few other instances, we know apriori that the pointer cast cannot > possibly break alignment. This applies to the changes in mempool, hash, mbuf, > and the ethdev stats code. Here, we simply silence the compiler by casting > through (void *) using the RTE_PTR_(ADD|SUB) macros. > > Finally, we introduce a new rte_pktmbuf_mtod_offset() helper to return a type > casted pointer to an offset within the packet data. This replaces the > following commonly used pattern: > (struct foo *)(rte_pktmbuf_mtod(m, char *) + offset) > with: > rte_pktmbuf_mtod_offset(m, struct foo *, offset) > To ensure consistency, the above transform was applied throughout the code > base using the coccinelle semantic patching tool. > Before diving into the patches, I'm wondering if adding aligned(1) or (packed) attribute at some places would have a performance impact on supported architectures (Intel or IBM Power). Did you manage to test it? Regards, Olivier