linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: paul.gortmaker@windriver.com (Paul Gortmaker)
To: linux-arm-kernel@lists.infradead.org
Subject: Circular dependency between <linux/kernel.h> and <asm/bug.h> on ARM
Date: Wed, 4 Jan 2012 22:43:56 -0500	[thread overview]
Message-ID: <CAP=VYLpP393c0MYxPPR2j6jkLyyUQWjQBWg3RfbpJyuWxi+psA@mail.gmail.com> (raw)
In-Reply-To: <20120103144538.GU2914@n2100.arm.linux.org.uk>

On Tue, Jan 3, 2012 at 9:45 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Sun, Jan 01, 2012 at 11:01:27PM -0800, Olof Johansson wrote:
>> On Sun, Jan 1, 2012 at 6:44 PM, Ben Hutchings <ben@decadent.org.uk> wrote:
>> > Commit 87e040b6456fd3416a1f6831c1eedaef5c0a94ff ("ARM: 7017/1: Use
>> > generic BUG() handler") makes BUG() use BUILD_BUG_ON(). ?However,
>> > BUILD_BUG_ON() is not defined in <linux/bug.h> but in <linux/kernel.h>.
>> >
>> > arch/include/asm/bug.h does not include <linux/kernel.h> and *cannot* do
>> > so because the latter already includes <asm/bug.h>.
>>
>> Sure it can, but it's not ideal. Since the BUILD_BUG_ON is only used
>> in bug.h in a #define, it will be resolved below the includes of
>> either so there should be no ordering issue between the two.
>
> I disagree - we should not be creating circular dependencies. ?This
> creates a mess, and uncertain results. ?For instance, if we include
> linux/bug.h or asm/bug.h before linux/kernel.h has been included,
> then we end up with linux/kernel.h being parsed without a definition
> for BUG_ON().
>
> However, if linux/kernel.h is included first, we start parsing that,
> include asm/bug.h, asm/bug.h then includes linux/kernel.h which produces
> an empty file, and then we continue parsing asm/bug.h _without_
> BUILD_BUG_ON() defined.
>
> So, adding linux/kernel.h does _not_ solve the problem. ?It solves the
> problem for _some_ cases only.
>
>> > Maybe BUILD_BUG_ON() should be moved out to a header of its own, or else
>> > this particular use should be moved to some other file. ?This needs to
>> > be fixed somehow, as it obviously leads to build failures, e.g.:
>> >
>> > https://buildd.debian.org/status/fetch.php?pkg=linux-2.6&arch=armel&ver=3.2~rc7-1~experimental.1&stamp=1325142904
>>
>> Or perhaps moving BUILD_BUG_ON to include/linux/bug.h?
>
> and change linux/kernel.h to include linux/bug.h rather than asm/bug.h.

Actually, kernel.h doesn't need to include any variant of bug.h at all.

I started on cleaning this up a few weeks back, but didn't have the time
to get it ready for 3.3 -- so my intent is to do so for linux-next that will
be the 3.4 release.  The Work In Progress can be seen here:

http://git.kernel.org/?p=linux/kernel/git/paulg/linux.git;a=shortlog;h=refs/heads/bug.h-cleanup-WIP

I only mention it here since I'd hate to see anyone waste time on
duplicating work that is already done.

Thanks,
Paul.

---

>
>> The quickest fix for now might be to take out the BUILD_BUG_ON(),
>> especially so close to 3.2-final.
>
> I think just remove the BUILD_BUG_ON. ?Other architectures have done
> without it, so I see no reason we can't do as well.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at ?http://www.tux.org/lkml/

  parent reply	other threads:[~2012-01-05  3:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-02  2:44 Circular dependency between <linux/kernel.h> and <asm/bug.h> on ARM Ben Hutchings
2012-01-02  7:01 ` Olof Johansson
2012-01-02 18:54   ` Simon Glass
2012-01-03 14:45   ` Russell King - ARM Linux
2012-01-03 18:33     ` Simon Glass
2012-01-05  3:43     ` Paul Gortmaker [this message]
2012-01-06  4:12       ` Simon Glass

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='CAP=VYLpP393c0MYxPPR2j6jkLyyUQWjQBWg3RfbpJyuWxi+psA@mail.gmail.com' \
    --to=paul.gortmaker@windriver.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).