DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Stojaczyk, DariuszX" <dariuszx.stojaczyk@intel.com>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] memory: fix alignment in eal_get_virtual_area()
Date: Mon, 16 Jul 2018 13:29:29 +0000	[thread overview]
Message-ID: <FBE7E039FA50BF47A673AD0BD3CD56A84619CCB2@HASMSX106.ger.corp.intel.com> (raw)
In-Reply-To: <c8586b27-e2af-fb25-3bbf-962855c3520b@intel.com>


> -----Original Message-----
> From: Burakov, Anatoly
> Sent: Monday, July 16, 2018 2:58 PM
> To: Stojaczyk, DariuszX <dariuszx.stojaczyk@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: Re: [PATCH] memory: fix alignment in eal_get_virtual_area()
> 
> On 13-Jun-18 8:08 PM, Dariusz Stojaczyk wrote:
> > Although the alignment mechanism works as intended, the
> > `no_align` bool flag was set incorrectly. We were aligning
> > buffers that didn't need extra alignment, and weren't
> > aligning ones that really needed it.
> >
> > Fixes: b7cc54187ea4 ("mem: move virtual area function in common directory")
> > Cc: anatoly.burakov@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
> > ---
> >   lib/librte_eal/common/eal_common_memory.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/common/eal_common_memory.c
> b/lib/librte_eal/common/eal_common_memory.c
> > index 4f0688f..a7c89f0 100644
> > --- a/lib/librte_eal/common/eal_common_memory.c
> > +++ b/lib/librte_eal/common/eal_common_memory.c
> > @@ -70,7 +70,7 @@ eal_get_virtual_area(void *requested_addr, size_t *size,
> >   	 * system page size is the same as requested page size.
> >   	 */
> >   	no_align = (requested_addr != NULL &&
> > -		((uintptr_t)requested_addr & (page_sz - 1)) == 0) ||
> > +		((uintptr_t)requested_addr & (page_sz - 1))) ||
> >   		page_sz == system_page_sz;
> >
> >   	do {
> >
> 
> This patch is wrong - no alignment should be performed if address is
> already alighed, e.g. if requested_addr & (page_sz - 1) == 0. The
> original code was correct.

If we provide an aligned address with ADDR_IS_HINT flag and OS decides not to use it, we end up with potentially unaligned address that needs to be manually aligned and that's what this patch does. If the requested address wasn't aligned to the provided page_sz, why would we bother aligning it manually?

Maybe there's additional case I'm not seeing, but this patch should not be reverted.

D.

> 
> Thomas, could you please revert this patch?
> 
> --
> Thanks,
> Anatoly

  reply	other threads:[~2018-07-16 13:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13 19:08 Dariusz Stojaczyk
2018-06-14  7:29 ` Burakov, Anatoly
2018-07-12 21:52   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-07-16 12:58 ` [dpdk-dev] " Burakov, Anatoly
2018-07-16 13:29   ` Stojaczyk, DariuszX [this message]
2018-07-16 14:01     ` Burakov, Anatoly
2018-07-16 14:16       ` Burakov, Anatoly
2018-07-17  9:53         ` Stojaczyk, DariuszX
2018-07-17  9:22       ` Xu, Qian Q
2018-07-17  9:25         ` Burakov, Anatoly

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=FBE7E039FA50BF47A673AD0BD3CD56A84619CCB2@HASMSX106.ger.corp.intel.com \
    --to=dariuszx.stojaczyk@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.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 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).