Re: [RFC patch] spindep: add cross cache lines checking

2012-03-08 Thread Alex Shi
On Thu, 2012-03-08 at 08:13 +0100, Ingo Molnar wrote: > * Alex Shi wrote: > > > On Wed, 2012-03-07 at 14:39 +0100, Ingo Molnar wrote: > > > * Alex Shi wrote: > > > > > > > > I think the check should be (__alignof__(lock) < > > > > > __alignof__(rwlock_t)), otherwise it will still pass when >

Re: [RFC patch] spindep: add cross cache lines checking

2012-03-07 Thread Ingo Molnar
* Alex Shi wrote: > On Wed, 2012-03-07 at 14:39 +0100, Ingo Molnar wrote: > > * Alex Shi wrote: > > > > > > I think the check should be (__alignof__(lock) < > > > > __alignof__(rwlock_t)), otherwise it will still pass when > > > > you have structure with attribute((packed,aligned(2))) > > >

Re: [RFC patch] spindep: add cross cache lines checking

2012-03-07 Thread Alex Shi
> > 1, it is alignof bug for default gcc on my fc15 and Ubuntu 11.10 etc? > > > > struct sub { > > int raw_lock; > > char a; > > }; > > struct foo { > > struct sub z; > > int slk; > > char y; > > }__attribute__((packed)); > > > > struct foo f1; > > > > __

Re: [RFC patch] spindep: add cross cache lines checking

2012-03-07 Thread Alex Shi
On Wed, 2012-03-07 at 14:39 +0100, Ingo Molnar wrote: > * Alex Shi wrote: > > > > I think the check should be (__alignof__(lock) < > > > __alignof__(rwlock_t)), otherwise it will still pass when > > > you have structure with attribute((packed,aligned(2))) > > > > reasonable! > > > > >> 1, it

Re: [RFC patch] spindep: add cross cache lines checking

2012-03-07 Thread Ingo Molnar
* Alex Shi wrote: > > I think the check should be (__alignof__(lock) < > > __alignof__(rwlock_t)), otherwise it will still pass when > > you have structure with attribute((packed,aligned(2))) > > reasonable! > > >> 1, it is alignof bug for default gcc on my fc15 and Ubuntu 11.10 etc? > >> >

Re: [RFC patch] spindep: add cross cache lines checking

2012-03-07 Thread Alex Shi
> I think the check should be (__alignof__(lock) < __alignof__(rwlock_t)), > otherwise it will still pass when you have structure with > attribute((packed,aligned(2))) reasonable! > >> 1, it is alignof bug for default gcc on my fc15 and Ubuntu 11.10 etc? >> >> struct sub { >> int raw

Re: [RFC patch] spindep: add cross cache lines checking

2012-03-07 Thread Arnd Bergmann
On Wednesday 07 March 2012, Alex Shi wrote: > Understand. thx. So is the following checking that your wanted? > === > diff --git a/include/linux/rwlock.h b/include/linux/rwlock.h > index bc2994e..64828a3 100644 > --- a/include/linux/rwlock.h > +++ b/include/linux/rwlock.h > @@ -21,10 +21,12 @@ >

Re: [RFC patch] spindep: add cross cache lines checking

2012-03-07 Thread Alex Shi
On Tue, 2012-03-06 at 09:32 +, Arnd Bergmann wrote: > On Tuesday 06 March 2012, Alex Shi wrote: > > I have one concern and one questions here: > > concern: maybe the lock is in a well designed 'packed' struct, and it is > > safe for cross lines issue. but __alignof__ will return 1; > > > > str