From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-outbound-1.vmware.com (smtp-outbound-1.vmware.com [208.91.2.12]) by dpdk.org (Postfix) with ESMTP id D32158079 for ; Tue, 9 Dec 2014 10:10:58 +0100 (CET) Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 25D8C290E1; Tue, 9 Dec 2014 01:10:56 -0800 (PST) Received: from EX13-CAS-011.vmware.com (EX13-CAS-011.vmware.com [10.113.191.63]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 212321947C; Tue, 9 Dec 2014 01:10:56 -0800 (PST) Received: from EX13-MBX-025.vmware.com (10.113.191.45) by EX13-MBX-011.vmware.com (10.113.191.31) with Microsoft SMTP Server (TLS) id 15.0.913.22; Tue, 9 Dec 2014 01:10:55 -0800 Received: from EX13-MBX-018.vmware.com (10.113.191.38) by EX13-MBX-025.vmware.com (10.113.191.45) with Microsoft SMTP Server (TLS) id 15.0.913.22; Tue, 9 Dec 2014 01:10:37 -0800 Received: from EX13-MBX-018.vmware.com ([fe80::7cdc:b1ba:f507:8b02]) by EX13-MBX-018.vmware.com ([fe80::7cdc:b1ba:f507:8b02%15]) with mapi id 15.00.0913.011; Tue, 9 Dec 2014 01:11:25 -0800 From: Jia Yu To: Olivier MATZ , Neil Horman Thread-Topic: [dpdk-dev] lib: include rte_memory.h for __rte_cache_aligned Thread-Index: AQHQEvhzYMLEPOj5i0yXp5tnw6bPhpyHe1IA//9+oQA= Date: Tue, 9 Dec 2014 09:11:24 +0000 Message-ID: References: <1415381289-43291-1-git-send-email-jyu@vmware.com> <20141208150401.GB3907@localhost.localdomain> <5486B87E.5010404@6wind.com> In-Reply-To: <5486B87E.5010404@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.113.160.246] Content-Type: text/plain; charset="iso-8859-1" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Tue, 09 Dec 2014 09:10:59 -0000 Yes, Olivier=B9s observation is consistent with ours. Compilation didn=B9t complain if rte_memory.h is not included. Currently, the lib files indirectly included rte_mbuf.h or rte_mempool.h. These two header files already included rte_memory.h. Therefore without this patch, things still work (as validated by parole). For good practice, it=B9s better to explicitly include rte_memory.h to avoi= d the problem. Thanks, Jia On 12/9/14, 12:53 AM, "Olivier MATZ" wrote: >Hi Neil, > >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 >