Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1649612 > unrolled thread

[PATCH 1/1] bug: fix problem including <linux.bug.h> from linux/kernel.h

Started byIan Abbott <abbotti@mev.co.uk>
First post2017-05-24 15:30 +0200
Last post2017-05-25 01:20 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/1] bug: fix problem including <linux.bug.h> from linux/kernel.h Ian Abbott <abbotti@mev.co.uk> - 2017-05-24 15:30 +0200
    Re: [PATCH 1/1] bug: fix problem including <linux.bug.h> from linux/kernel.h Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2017-05-24 15:40 +0200
      Re: [PATCH 1/1] bug: fix problem including <linux.bug.h> from  linux/kernel.h Ian Abbott <abbotti@mev.co.uk> - 2017-05-24 18:10 +0200
    [PATCH v2] bug: fix problem including <linux/bug.h> from linux/kernel.h Ian Abbott <abbotti@mev.co.uk> - 2017-05-24 18:10 +0200
      Re: [PATCH v2] bug: fix problem including <linux/bug.h> from  linux/kernel.h Ian Abbott <abbotti@mev.co.uk> - 2017-05-25 01:20 +0200

#1649612 — [PATCH 1/1] bug: fix problem including <linux.bug.h> from linux/kernel.h

FromIan Abbott <abbotti@mev.co.uk>
Date2017-05-24 15:30 +0200
Subject[PATCH 1/1] bug: fix problem including <linux.bug.h> from linux/kernel.h
Message-ID<tKEwp-2RX-1@gated-at.bofh.it>
If "include/linux/kernel.h" includes <linux/bug.h>, a circular
dependency is introduced when "include/asm-generic/bug.h" includes
<linux/kernel.h>.  This results in build breakage when something
includes <asm/bug.h> before <linux/kernel.h> for architectures that
select `CONFIG_GENERIC_BUG` because `struct bug_entry` is not fully
declared (not declared at all in fact) before its members are accessed
by `is_warning_bug()`.

To avoid this problem, remove the inclusion of <linux/kernel.h> from
"include/asm-generic/bug.h", but include <linux/types.h> from
"include/linux/bug.h" because it needs the `bool` type.

A consequence of this change is that since most bug-related,
function-link macros (`BUG()`, `WARN()` etc.) make use of facilities
provided by <linux/kernel.h>, something else needs to include that
before those macros are called.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 include/asm-generic/bug.h | 1 -
 include/linux/bug.h       | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 87191357d303..074a66de47f6 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -12,7 +12,6 @@
 #endif
 
 #ifndef __ASSEMBLY__
-#include <linux/kernel.h>
 
 #ifdef CONFIG_BUG
 
diff --git a/include/linux/bug.h b/include/linux/bug.h
index 687b557fc5eb..68692b775343 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -3,6 +3,7 @@
 
 #include <asm/bug.h>
 #include <linux/compiler.h>
+#include <linux/types.h>
 
 enum bug_trap_type {
 	BUG_TRAP_TYPE_NONE = 0,
-- 
2.11.0

[toc] | [next] | [standalone]


#1649620

FromRasmus Villemoes <linux@rasmusvillemoes.dk>
Date2017-05-24 15:40 +0200
Message-ID<tKEG6-2V1-15@gated-at.bofh.it>
In reply to#1649612
On 24 May 2017 at 15:21, Ian Abbott <abbotti@mev.co.uk> wrote:
> If "include/linux/kernel.h" includes <linux/bug.h>, a circular
> dependency is introduced

Then don't. Can't we just create linux/build_bug.h and have that
contain the BUILD_BUG related macros - they're really completely
unrelated to all the asm-cruft bug.h needs to know about. build_bug.h
can then include compiler.h and not much else to figure out how it may
implement its macros. Then kernel.h can include build_bug.h, and we
don't force each and every translation unit to include bug.h and
everything that then pulls in. We just got rid of a lot of header
bloat, let's try to keep it that way.

Rasmus

[toc] | [prev] | [next] | [standalone]


#1649737 — Re: [PATCH 1/1] bug: fix problem including <linux.bug.h> from linux/kernel.h

FromIan Abbott <abbotti@mev.co.uk>
Date2017-05-24 18:10 +0200
SubjectRe: [PATCH 1/1] bug: fix problem including <linux.bug.h> from linux/kernel.h
Message-ID<tKH1g-4vB-21@gated-at.bofh.it>
In reply to#1649620
On 24/05/17 14:37, Rasmus Villemoes wrote:
> On 24 May 2017 at 15:21, Ian Abbott <abbotti@mev.co.uk> wrote:
>> If "include/linux/kernel.h" includes <linux/bug.h>, a circular
>> dependency is introduced
>
> Then don't. Can't we just create linux/build_bug.h and have that
> contain the BUILD_BUG related macros - they're really completely
> unrelated to all the asm-cruft bug.h needs to know about. build_bug.h
> can then include compiler.h and not much else to figure out how it may
> implement its macros. Then kernel.h can include build_bug.h, and we
> don't force each and every translation unit to include bug.h and
> everything that then pulls in. We just got rid of a lot of header
> bloat, let's try to keep it that way.

Thanks, I'll take a look at that.  In the meantime, I noticed the title 
line of this patch contains a nasty typo, so I'll send a v2 patch to fix 
that.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

[toc] | [prev] | [next] | [standalone]


#1649736 — [PATCH v2] bug: fix problem including <linux/bug.h> from linux/kernel.h

FromIan Abbott <abbotti@mev.co.uk>
Date2017-05-24 18:10 +0200
Subject[PATCH v2] bug: fix problem including <linux/bug.h> from linux/kernel.h
Message-ID<tKH1g-4vB-17@gated-at.bofh.it>
In reply to#1649612
If "include/linux/kernel.h" includes <linux/bug.h>, a circular
dependency is introduced when "include/asm-generic/bug.h" includes
<linux/kernel.h>.  This results in build breakage when something
includes <asm/bug.h> before <linux/kernel.h> for architectures that
select `CONFIG_GENERIC_BUG` because `struct bug_entry` is not fully
declared (not declared at all in fact) before its members are accessed
by `is_warning_bug()`.

To avoid this problem, remove the inclusion of <linux/kernel.h> from
"include/asm-generic/bug.h", but include <linux/types.h> from
"include/linux/bug.h" because it needs the `bool` type.

A consequence of this change is that since most bug-related,
function-link macros (`BUG()`, `WARN()` etc.) make use of facilities
provided by <linux/kernel.h>, something else needs to include that
before those macros are called.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
v2: Fix typo in patch subject line.
---
 include/asm-generic/bug.h | 1 -
 include/linux/bug.h       | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 87191357d303..074a66de47f6 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -12,7 +12,6 @@
 #endif
 
 #ifndef __ASSEMBLY__
-#include <linux/kernel.h>
 
 #ifdef CONFIG_BUG
 
diff --git a/include/linux/bug.h b/include/linux/bug.h
index 687b557fc5eb..68692b775343 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -3,6 +3,7 @@
 
 #include <asm/bug.h>
 #include <linux/compiler.h>
+#include <linux/types.h>
 
 enum bug_trap_type {
 	BUG_TRAP_TYPE_NONE = 0,
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1650013 — Re: [PATCH v2] bug: fix problem including <linux/bug.h> from linux/kernel.h

FromIan Abbott <abbotti@mev.co.uk>
Date2017-05-25 01:20 +0200
SubjectRe: [PATCH v2] bug: fix problem including <linux/bug.h> from linux/kernel.h
Message-ID<tKNJn-dX-5@gated-at.bofh.it>
In reply to#1649736
On 2017-05-24 17:06, Ian Abbott wrote:
> If "include/linux/kernel.h" includes <linux/bug.h>, a circular
> dependency is introduced when "include/asm-generic/bug.h" includes
> <linux/kernel.h>.  This results in build breakage when something
> includes <asm/bug.h> before <linux/kernel.h> for architectures that
> select `CONFIG_GENERIC_BUG` because `struct bug_entry` is not fully
> declared (not declared at all in fact) before its members are accessed
> by `is_warning_bug()`.
>
> To avoid this problem, remove the inclusion of <linux/kernel.h> from
> "include/asm-generic/bug.h", but include <linux/types.h> from
> "include/linux/bug.h" because it needs the `bool` type.
>
> A consequence of this change is that since most bug-related,
> function-link macros (`BUG()`, `WARN()` etc.) make use of facilities
> provided by <linux/kernel.h>, something else needs to include that
> before those macros are called.
>
> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Michal Nazarewicz <mina86@mina86.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> ---
> v2: Fix typo in patch subject line.
> ---
>  include/asm-generic/bug.h | 1 -
>  include/linux/bug.h       | 1 +
>  2 files changed, 1 insertion(+), 1 deletion(-)

This patch and its previous version can be dropped now, since the patch 
that caused the breakage that this patch fixes up 
(<https://lkml.org/lkml/2017/5/23/641>) has been dropped (for now). 
I'll avoid the breakage in the way suggested by Rasmus in 
<https://lkml.org/lkml/2017/5/24/553>.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web