From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Burakov, Anatoly" Subject: Re: [PATCH] memory: fix alignment in eal_get_virtual_area() Date: Mon, 16 Jul 2018 13:58:00 +0100 Message-ID: References: <1528916894-1991-1-git-send-email-dariuszx.stojaczyk@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: stable@dpdk.org To: Dariusz Stojaczyk , dev@dpdk.org Return-path: In-Reply-To: <1528916894-1991-1-git-send-email-dariuszx.stojaczyk@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > 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. Thomas, could you please revert this patch? -- Thanks, Anatoly