From: Bruce Richardson <bruce.richardson@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, olivier.matz@6wind.com
Subject: Re: [dpdk-dev] [PATCH] eal: fix 64bit address alignment in 32-bit builds
Date: Fri, 28 Apr 2017 10:32:03 +0100 [thread overview]
Message-ID: <20170428093202.GB14648@bricha3-MOBL3.ger.corp.intel.com> (raw)
In-Reply-To: <2039188.oPr2FiSFIW@xps>
On Fri, Apr 28, 2017 at 11:21:27AM +0200, Thomas Monjalon wrote:
> 28/04/2017 11:03, Bruce Richardson:
> > On Fri, Apr 28, 2017 at 10:56:56AM +0200, Thomas Monjalon wrote:
> > > 28/04/2017 10:15, Bruce Richardson:
> > > > On i686 builds, the uint64_t type is 64-bits in size but is aligned to
> > > > 32-bits only. This causes mbuf fields for rearm_data to not be 16-byte
> > > > aligned on 32-bit builds, which causes errors with some vector PMDs which
> > > > expect the rearm data to be aligned as on 64-bit.
> > > >
> > > > Given that we cannot use the extra space in the data structures anyway, as
> > > > it's already used on 64-bit builds, we can just force alignment of physical
> > > > address structure members to 8-bytes in all cases. This has no effect on
> > > > 64-bit systems, but fixes the updated PMDs on 32-bit.
> > >
> > > I agree to align on 64-bit in mbuf.
> > >
> > > > Fixes: f4356d7ca168 ("net/i40e: eliminate mbuf write on rearm")
> > > > Fixes: f160666a1073 ("net/ixgbe: eliminate mbuf write on rearm")
> > > [...]
> > > > --- a/lib/librte_eal/common/include/rte_memory.h
> > > > +++ b/lib/librte_eal/common/include/rte_memory.h
> > > > -typedef uint64_t phys_addr_t; /**< Physical address definition. */
> > > > +/** Physical address definition. */
> > > > +typedef uint64_t phys_addr_t __rte_aligned(sizeof(uint64_t));
> > >
> > > Why setting this constraint for everyone?
> > >
> > Well, it only has an effect on 32-bit builds, and unless there is a
> > problem, I don't see why not always align them to the extra 8 bytes. If
> > this does cause an issue, I'm happy enough to use #ifdefs, but in the
> > absense of a confirmed problem, I'd rather keep the code clean.
>
> Is it expected for everyone to have every physical addresses aligned on 64?
> I think it can be weird for some applications.
> Why do you think it is cleaner than adding the alignment to the mbuf fields?
>
I'm ok to redo the patch to only make the change to the mbuf value.
However, when researching this, I discovered that gcc apparently already
aligns all non-structure-member uint64_t values on an 8-byte boundary on
32-bit x86 anyway*. [Don't know if this also applies e.g. to 32-bit arm,
but I wouldn't be surprised if it did.] That means the scope of this
only applies to structures with phys_addr values, so it's not a huge
scope.
*Ref: https://gcc.gnu.org/ml/gcc/2009-06/msg00333.html
> PS: It is yet another macro which is not rte_ prefixed.
>
Yes. Not going to fix that in this patch though!
So, do you want a V2 to limit the alignment change to the phys_addr in
the mbuf, rather than generally to physical addresses? I prefer the way
I have it here, but I'm ok to change.
Regards,
/Bruce
next prev parent reply other threads:[~2017-04-28 9:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-28 8:15 Bruce Richardson
2017-04-28 8:19 ` Bruce Richardson
2017-04-28 8:56 ` Thomas Monjalon
2017-04-28 9:03 ` Bruce Richardson
2017-04-28 9:21 ` Thomas Monjalon
2017-04-28 9:32 ` Bruce Richardson [this message]
2017-04-28 9:56 ` Olivier Matz
2017-04-28 10:14 ` Bruce Richardson
2017-04-28 13:10 ` [dpdk-dev] [PATCH v2] mbuf: " Bruce Richardson
2017-04-30 19:40 ` Thomas Monjalon
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=20170428093202.GB14648@bricha3-MOBL3.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.com \
--cc=thomas@monjalon.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).