From: Ingo Molnar <mingo@elte.hu>
To: Alex Shi <alex.shi@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
gcc@gcc.gnu.org, tglx@linutronix.de,
"mingo@redhat.com" <mingo@redhat.com>,
hpa@zytor.com, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, x86@kernel.org,
andi.kleen@intel.com, gcc-help@gcc.gnu.org
Subject: Re: [RFC patch] spindep: add cross cache lines checking
Date: Wed, 7 Mar 2012 14:39:37 +0100 [thread overview]
Message-ID: <20120307133937.GB12676@elte.hu> (raw)
In-Reply-To: <4F575F09.3010107@intel.com>
* Alex Shi <alex.shi@intel.com> 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?
> >>
> >> struct sub {
> >> int raw_lock;
> >> char a;
> >> };
> >> struct foo {
> >> struct sub z;
> >> int slk;
> >> char y;
> >> }__attribute__((packed));
> >>
> >> struct foo f1;
> >>
> >> __alignof__(f1.z.raw_lock) is 4, but its address actually can align on
> >> one byte.
> >
> > That looks like correct behavior, because the alignment of
> > raw_lock inside of struct sub is still 4. But it does mean
> > that there can be cases where the compile-time check is not
> > sufficient, so we might want the run-time check as well, at
> > least under some config option.
>
> what's your opinion of this, Ingo?
Dunno. How many real bugs have you found via this patch?
Thanks,
Ingo
next prev parent reply other threads:[~2012-03-07 13:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-05 3:20 [RFC patch] spin_lock: " Alex Shi
2012-03-05 3:24 ` Alex Shi
2012-03-05 5:43 ` [RFC patch] spindep: " Alex Shi
2012-03-05 5:48 ` Alex Shi
2012-03-05 9:41 ` Arnd Bergmann
2012-03-05 10:43 ` Ingo Molnar
2012-03-06 6:13 ` Alex Shi
2012-03-06 6:18 ` Alex Shi
2012-03-06 9:32 ` Arnd Bergmann
2012-03-07 8:23 ` Alex Shi
2012-03-07 11:54 ` Arnd Bergmann
2012-03-07 13:13 ` Alex Shi
2012-03-07 13:39 ` Ingo Molnar [this message]
2012-03-08 2:21 ` Alex Shi
2012-03-08 7:13 ` Ingo Molnar
2012-03-09 1:20 ` Alex Shi
2012-03-08 2:30 ` Alex Shi
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=20120307133937.GB12676@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=alex.shi@intel.com \
--cc=andi.kleen@intel.com \
--cc=arnd@arndb.de \
--cc=gcc-help@gcc.gnu.org \
--cc=gcc@gcc.gnu.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®