- To: Ingo Molnar <mingo@xxxxxxx>
- Subject: Re: [RFC patch] spindep: add cross cache lines checking
- From: Alex Shi <alex.shi@xxxxxxxxx>
- Date: Tue, 06 Mar 2012 14:18:22 +0800
- Cc: Arnd Bergmann <arnd@xxxxxxxx>, "tglx@xxxxxxxxxxxxx" <tglx@xxxxxxxxxxxxx>, "mingo@xxxxxxxxxx" <mingo@xxxxxxxxxx>, hpa@xxxxxxxxx, akpm@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx, andi.kleen@xxxxxxxxx, gcc-help@xxxxxxxxxxx
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1331619532; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date: Message-ID:Mime-Version:Content-Transfer-Encoding:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=0mHR+qd6CoetzegSBdcUtRc3Yxw=; b=dWsiRuMszCXXK+FiF65m8rovtCruNTrZxVfxjMZFntyLW4TSS689nYNuSlUnb9 b+9ij5JKml9nWFK82NSSErMqYYPfiUNT20XoL5V2LMSPcioKL7h1OCMZlPkNWc0f rkV/xNYLHStZP1tR3PA8C4xvJXf70+u890Ka5qB54qn3I=
- In-reply-to: <1331014414.18835.254.camel@debian>
Resend for correct tglx's address. Sorry!
> > >
> > > Have you tried making this a compile-time check using
> > > __alignof__? I would say that any spinlock in a packed data
> > > structure is basically a bug, even more so on most other
> > > architectures besides x86.
>
> 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;
>
> struct abc{
> raw_spinlock_t lock1;
> char a;
> char b;
> }__attribute__((packed));
>
> Since the lock is the first object of struct, usually it is well placed.
>
> question: I am a idiot on gcc, I tried some parameters of gcc " --param
> l1-cache-line-size=1 -mno-align-double" and can not make a cross lines
> variable without 'packed' structure, but I still don't find a grantee
> why gcc can avoid the cross line variable if it's not in 'packed'
> structure?
>
> > agreed.
> >
> > Thanks,
> >
> > Ingo
>
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]