From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id 50D5F7E79 for ; Thu, 11 Dec 2014 01:51:29 +0100 (CET) Received: by mail-wg0-f52.google.com with SMTP id x12so5064256wgg.25 for ; Wed, 10 Dec 2014 16:51:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=2C2iRG8dri0qVV1s7qHaXXeLTBXi0xjxAmTa7G6GlZQ=; b=FG1NwaEHAlpUe/eRbJSOWpRzUYM5IF2IVceuK+R57sj748XeZ/VH+4ffYvCDb9mM1I F6PpNQPmWDAT6615YenQxUpaJ+EtDgR+hPmdnUG4zxQ+Bw/C66LLjHur5bFtNYRacvfa oUyStmgqbesSCo93WO+DGYV9KZM2uBtLDlzeT/lFcP6fafsgSkazxyYO67ZDgoXqmpJh blDxJ/1LIf2w2J7dMXQffmReC4XW0/YErEolh2MzzJ49lMduz5I9nGt5r0az2Mua0H4R eaJUDQ554INAb6GyaSBfLsrm+5xB7svpuKEP5ZIuCNMsupzyz6Tc7siav2E0dxBgLeVa 4YIQ== X-Gm-Message-State: ALoCoQnPolkQfblAJIb908eRXg5ADgh942+NZ36nVT5ZNklP2nPoEYwHHv+64bI19EyE5znG8H67 X-Received: by 10.194.80.38 with SMTP id o6mr10951588wjx.126.1418259089136; Wed, 10 Dec 2014 16:51:29 -0800 (PST) Received: from xps13.localnet ([88.249.222.12]) by mx.google.com with ESMTPSA id n3sm781023wiw.5.2014.12.10.16.51.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Dec 2014 16:51:28 -0800 (PST) From: Thomas Monjalon To: Jia Yu Date: Thu, 11 Dec 2014 01:51:01 +0100 Message-ID: <1519285.2rmHEkrl95@xps13> Organization: 6WIND User-Agent: KMail/4.14.3 (Linux/3.17.4-1-ARCH; KDE/4.14.3; x86_64; ; ) In-Reply-To: <20141209152204.GD28871@hmsreliant.think-freely.org> References: <1415381289-43291-1-git-send-email-jyu@vmware.com> <5486B87E.5010404@6wind.com> <20141209152204.GD28871@hmsreliant.think-freely.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] lib: include rte_memory.h for __rte_cache_aligned 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: Thu, 11 Dec 2014 00:51:29 -0000 2014-12-09 10:22, Neil Horman: > On Tue, Dec 09, 2014 at 09:53:18AM +0100, Olivier MATZ wrote: > > On 12/08/2014 04:04 PM, Neil Horman wrote: > > >On Fri, Nov 07, 2014 at 09:28:09AM -0800, Jia Yu wrote: > > >>Include rte_memory.h for lib files that use __rte_cache_aligned > > >>attribute. > > >> > > >>Signed-off-by: Jia Yu > > >> > > >Why? I presume there was a build break or something. Please repost with a > > >changelog that details what this patch is for. > > >Neil > > > > I don't know if Yu's issue was the same, but I had a very "fun" issue > > with __rte_cache_aligned in my application. Consider the following code: > > > > struct per_core_foo { > > ... > > } __rte_cache_aligned; > > > > struct global_foo { > > struct per_core_foo foo[RTE_MAX_CORE]; > > }; > > > > If __rte_cache_aligned is not defined (rte_memory.h is not included), > > the code compiles but the structure is not aligned... it defines the > > structure and creates a global variable called __rte_cache_aligned. > > And this can lead to really bad things if this code is in a .h that > > is included by files that may or may not include rte_memory.h > > > > I have no idea about how we could prevent this issue, except using > > __attribute__((aligned(CACHE_LINE))) instead of __rte_cache_aligned. > > > > Anyway this could probably explain the willing to include rte_memory.h > > everywhere. > > > > Regards, > > Olivier > > So, that is a great explination, and would be good to have in the changelog. Acked-by: Thomas Monjalon Applied with Olivier's explanation. Thanks -- Thomas