lkml.org 
[lkml]   [2011]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] DEBUGFS: Add per cpu counters
From
Date
On Tue, 2011-12-13 at 14:56 -0800, Andi Kleen wrote:
>
> > > +struct debugfs_counter {
> > > + unsigned __percpu *ptr;
> > > + const char *fn;
> > > + const char *name;
> > > +} __attribute__((aligned(sizeof(char *))));
> > > +

> >
> > See commit 654986462 for details.
>
> Doesn't give a lot of details actually. Which target?
>
> Note that my structure only has pointers, so there is not a lot
> of potential for "evil" alignment.

We hit this with trace events as well, and your structure does have an
evil alignment, it's 3 pointers, which is not a base 2 number. Thus,
there were some compilers that liked to add padding to make the
alignment a power of 2. That is, between two sections of files we ended
up with something like:


.section file1
.ptra1
.ptra2
.ptra3
.ptrb1
.ptrb2
.ptrb3
.ptrc1
.ptrc2
.ptrc3
.ptrd1
.ptrd2
.ptrd3
.ptre1
.ptre2
.ptre3
<space>
.section file2
.ptrf1
.ptrf2
.ptrf3
[...]



It didn't happen often, heck, trace events and tracepoints were like
this for sometime before this blew up in our faces.

From what I've seen is that 1 or 2 longs will pack nicely, but anything
else (except for maybe 4, 8, 16, etc) will run a risk of crashing.

-- Steve




\
 
 \ /
  Last update: 2011-12-14 00:11    [W:0.043 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site