All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olivier MATZ <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
To: Cyril Chemparathy
	<cchemparathy-d5a29ZRxExrQT0dZR+AlfA@public.gmane.org>,
	dev-VfR2kkLFssw@public.gmane.org
Subject: Re: [PATCH 00/10] Improve cast alignment for strict aligned machines
Date: Mon, 04 May 2015 11:50:09 +0200	[thread overview]
Message-ID: <554740D1.4050104@6wind.com> (raw)
In-Reply-To: <1430324134-25654-1-git-send-email-cchemparathy-d5a29ZRxExrQT0dZR+AlfA@public.gmane.org>

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

  parent reply	other threads:[~2015-05-04  9:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 16:15 [PATCH 00/10] Improve cast alignment for strict aligned machines Cyril Chemparathy
     [not found] ` <1430324134-25654-1-git-send-email-cchemparathy-d5a29ZRxExrQT0dZR+AlfA@public.gmane.org>
2015-04-29 16:15   ` [PATCH 01/10] eal: add and use unaligned integer types Cyril Chemparathy
2015-06-19 15:58     ` Olivier MATZ
2015-06-19 17:18       ` Cyril Chemparathy
2015-04-29 16:15   ` [PATCH 02/10] mempool: silence -Wcast-align on pointer arithmetic Cyril Chemparathy
2015-04-29 16:15   ` [PATCH 03/10] hash: " Cyril Chemparathy
2015-04-29 16:15   ` [PATCH 04/10] mbuf: " Cyril Chemparathy
2015-04-29 16:15   ` [PATCH 05/10] ethdev: " Cyril Chemparathy
2015-04-29 16:15   ` [PATCH 06/10] app/test-pmd: pack simple_gre_hdr Cyril Chemparathy
2015-04-29 16:15   ` [PATCH 07/10] app/test: use struct ether_addr instead of a byte array cast Cyril Chemparathy
2015-04-29 16:15   ` [PATCH 08/10] librte_mbuf: Add rte_pktmbuf_mtod_offset() Cyril Chemparathy
2015-06-19 15:58     ` Olivier MATZ
2015-06-19 17:18       ` Cyril Chemparathy
2015-04-29 16:15   ` [PATCH 09/10] librte_mbuf: Add transform for rte_pktmbuf_mtod_offset() Cyril Chemparathy
2015-04-29 16:15   ` [PATCH 10/10] librte_mbuf: Apply mtod-offset.cocci transform Cyril Chemparathy
2015-05-04  9:50   ` Olivier MATZ [this message]
     [not found]     ` <554740D1.4050104-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-05-04 17:26       ` [PATCH 00/10] Improve cast alignment for strict aligned machines Cyril Chemparathy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=554740D1.4050104@6wind.com \
    --to=olivier.matz-pdr9zngts4eavxtiumwx3w@public.gmane.org \
    --cc=cchemparathy-d5a29ZRxExrQT0dZR+AlfA@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.