All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jia Yu <jyu-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
To: Olivier MATZ
	<olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>,
	Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: "dev-VfR2kkLFssw@public.gmane.org" <dev-VfR2kkLFssw@public.gmane.org>
Subject: Re: lib: include rte_memory.h for __rte_cache_aligned
Date: Tue, 9 Dec 2014 09:11:24 +0000	[thread overview]
Message-ID: <D0ABFADB.2E144%jyu@vmware.com> (raw)
In-Reply-To: <5486B87E.5010404-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

Yes, Olivier¹s observation is consistent with ours. Compilation didn¹t
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¹s better to explicitly include rte_memory.h to avoid
the problem.

Thanks,
Jia



On 12/9/14, 12:53 AM, "Olivier MATZ" <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> 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 <jyu-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
>>>
>> 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
>

  parent reply	other threads:[~2014-12-09  9:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07 17:28 [PATCH] lib: include rte_memory.h for __rte_cache_aligned Jia Yu
     [not found] ` <1415381289-43291-1-git-send-email-jyu-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2014-11-10  9:46   ` Thomas Monjalon
2014-11-17 19:07     ` Jia Yu
2014-12-08 15:04   ` Neil Horman
     [not found]     ` <20141208150401.GB3907-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-12-09  8:53       ` Olivier MATZ
     [not found]         ` <5486B87E.5010404-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-12-09  9:11           ` Jia Yu [this message]
2014-12-09 15:22           ` Neil Horman
     [not found]             ` <20141209152204.GD28871-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-12-10 19:09               ` Jia Yu
     [not found]                 ` <D0ADD64A.2E3F8%jyu-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2014-12-11  0:28                   ` Neil Horman
     [not found]                     ` <20141211002838.GA24240-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-12-11  0:36                       ` Thomas Monjalon
2014-12-11 14:17                         ` Neil Horman
     [not found]                           ` <20141211141727.GC28213-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-12-11 21:14                             ` Thomas Monjalon
2014-12-11  0:51               ` 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=D0ABFADB.2E144%jyu@vmware.com \
    --to=jyu-pghwnbhtmq7qt0dzr+alfa@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
    --cc=olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.