Skip to contentSkip to conversation

printk: fixes

GIT PULL In review Frederic Weisbecker 3 participants 8 messages Mar 14, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Ingo,

Please pull the following printk regression fixes from:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
printk/urgent

HEAD: c45a372bdfc0115147afb7eea11313dc057c817e

Thanks.

---
Frederic Weisbecker (1):
printk: Provide a wake_up_klogd() off-case

James Hogan (1):
irq_work.h: fix warning when CONFIG_IRQ_WORK=n

 include/linux/irq_work.h |    2 +-
 include/linux/kernel.h   |    1 -
 include/linux/printk.h   |    6 +++
 kernel/printk.c          |   80 ++++++++++++++++++++++-----------------------
 4 files changed, 46 insertions(+), 43 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/2 irq_work.h: fix warning when CONFIG_IRQ_WORK=n

From: James Hogan <[email protected]>

A randconfig caught repeated compiler warnings when CONFIG_IRQ_WORK=n due to the definition of a non-inline static function in <linux/irq_work.h>:

include/linux/irq_work.h +40 : warning: 'irq_work_needs_cpu' defined but not used

Make it inline to supress the warning. This is caused by the following commit:

Commit 00b42959106a9ca1c2899e591ae4e9a83ad6af05 ("irq_work: Don't stop the tick with pending works") merged in v3.9-rc1.

Cc Frederic Weisbecker <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Paul Gortmaker <[email protected]>
---
 include/linux/irq_work.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/irq_work.h +1 -1
index f5dbce5..6601702 100644
@@ -37,7 +37,7 @@ void irq_work_sync(struct irq_work *work);
 #ifdef CONFIG_IRQ_WORK
 bool irq_work_needs_cpu(void);
 #else
-static bool irq_work_needs_cpu(void) { return false; }
+static inline bool irq_work_needs_cpu(void) { return false; }
 #endif
 
 #endif /* _LINUX_IRQ_WORK_H */
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/2 printk: Provide a wake_up_klogd() off-case

In reply to Frederic Weisbecker

wake_up_klogd() is useless when CONFIG_PRINTK=n because neither printk() nor printk_sched() are in use and there are actually no waiter on log_wait waitqueue. It should be a stub in this case for users like bust_spinlocks().

Otherwise this results in this warning when CONFIG_PRINTK=n and CONFIG_IRQ_WORK=n:

	kernel/built-in.o In function `wake_up_klogd':
	(.text.wake_up_klogd+0xb4): undefined reference to `irq_work_queue'

To fix this, provide an off-case for wake_up_klogd() when CONFIG_PRINTK=n.

There is much more from console_unlock() and other console related code in printk.c that should be moved under CONFIG_PRINTK. But for now, focus on a minimal fix as we passed the merged window already.

Cc James Hogan <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Andrew Morton <[email protected]>
---
 include/linux/kernel.h |    1 -
 include/linux/printk.h |    6 +++
 kernel/printk.c        |   80 +++++++++++++++++++++++------------------------
 3 files changed, 45 insertions(+), 42 deletions(-)
include/linux/kernel.h +0 -1
index 80d3687..79fdd80 100644
@@ -390,7 +390,6 @@ extern struct pid *session_of_pgrp(struct pid *pgrp);
 unsigned long int_sqrt(unsigned long);
 
 extern void bust_spinlocks(int yes);
-extern void wake_up_klogd(void);
 extern int oops_in_progress;		/* If set, an oops, panic(), BUG() or die() is in progress */
 extern int panic_timeout;
 extern int panic_on_oops;
include/linux/printk.h +6 -0
index 1249a54..822171f 100644
@@ -134,6 +134,8 @@ extern int printk_delay_msec;
 extern int dmesg_restrict;
 extern int kptr_restrict;
 
+extern void wake_up_klogd(void);
+
 void log_buf_kexec_setup(void);
 void __init setup_log_buf(int early);
 #else
@@ -162,6 +164,10 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies,
 	return false;
 }
 
+static inline void wake_up_klogd(void)
+{
+}
+
 static inline void log_buf_kexec_setup(void)
 {
 }
kernel/printk.c +39 -41

104 lines not on this page · raw message

Signature · 1 line
1.7.5.4
maintainer
#3 lore raw

Re: [PATCH 2/2] printk: Provide a wake_up_klogd() off-case

Quoted 34 lines · On Thu, 14 Mar 2013 15:26:29 +0100 Frederic Weisbecker <[email protected]>…

wake_up_klogd() is useless when CONFIG_PRINTK=n because neither printk() nor printk_sched() are in use and there are actually no waiter on log_wait waitqueue. It should be a stub in this case for users like bust_spinlocks().

Otherwise this results in this warning when CONFIG_PRINTK=n and CONFIG_IRQ_WORK=n:

	kernel/built-in.o In function `wake_up_klogd':
	(.text.wake_up_klogd+0xb4): undefined reference to `irq_work_queue'

To fix this, provide an off-case for wake_up_klogd() when CONFIG_PRINTK=n.

There is much more from console_unlock() and other console related code in printk.c that should be moved under CONFIG_PRINTK. But for now, focus on a minimal fix as we passed the merged window already.

include/linux/kernel.h +0 -1
@@ -390,7 +390,6 @@ extern struct pid *session_of_pgrp(struct pid *pgrp);
 unsigned long int_sqrt(unsigned long);
 
 extern void bust_spinlocks(int yes);
-extern void wake_up_klogd(void);
 extern int oops_in_progress;		/* If set, an oops, panic(), BUG() or die() is in progress */
 extern int panic_timeout;
 extern int panic_on_oops;
include/linux/printk.h +0 -0
index 1249a54..822171f 100644

include/linux/printk.h extern int printk_delay_msec; · line 138

Quoted 5 lines
include/linux/printk.h +2 -0
@@ -134,6 +134,8 @@ extern int printk_delay_msec;
 extern int dmesg_restrict;
 extern int kptr_restrict;
 
+extern void wake_up_klogd(void);
+

Given this, it would be prudent to include printk.h in bust_spinlocks.c. printk.h currently gets included by kernel.h, but that doesn't actually seem necessary - nothing in kernel.h calls printk().

(I pity anyone who tries to remove that include from kernel.h ;))

lib/bust_spinlocks.c renamed from lib/bust_spinlocks.c~printk-provide-a-wake_up_klogd-off-case-fix +1 -2
@@ -8,6 +8,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/printk.h>
 #include <linux/spinlock.h>
 #include <linux/tty.h>
 #include <linux/wait.h>
@@ -28,5 +29,3 @@ void __attribute__((weak)) bust_spinlock
 			wake_up_klogd();
 	}
 }
-
-

_

#4 lore raw

Re: [PATCH 2/2] printk: Provide a wake_up_klogd() off-case

2013/3/14 Andrew Morton <[email protected]>:

Quoted 47 lines · On Thu, 14 Mar 2013 15:26:29 +0100 Frederic Weisbecker <[email protected]>…
Quoted 35 lines

wake_up_klogd() is useless when CONFIG_PRINTK=n because neither printk() nor printk_sched() are in use and there are actually no waiter on log_wait waitqueue. It should be a stub in this case for users like bust_spinlocks().

Otherwise this results in this warning when CONFIG_PRINTK=n and CONFIG_IRQ_WORK=n:

kernel/built-in.o In function `wake_up_klogd':
(.text.wake_up_klogd+0xb4): undefined reference to `irq_work_queue'

To fix this, provide an off-case for wake_up_klogd() when CONFIG_PRINTK=n.

There is much more from console_unlock() and other console related code in printk.c that should be moved under CONFIG_PRINTK. But for now, focus on a minimal fix as we passed the merged window already.

include/linux/kernel.h +0 -1
@@ -390,7 +390,6 @@ extern struct pid *session_of_pgrp(struct pid *pgrp);
 unsigned long int_sqrt(unsigned long);
 
 extern void bust_spinlocks(int yes);
-extern void wake_up_klogd(void);
 extern int oops_in_progress;         /* If set, an oops, panic(), BUG() or die() is in progress */
 extern int panic_timeout;
 extern int panic_on_oops;
include/linux/printk.h +0 -0
index 1249a54..822171f 100644

include/linux/printk.h extern int printk_delay_msec; · line 138

Quoted 5 lines
include/linux/printk.h +2 -0
@@ -134,6 +134,8 @@ extern int printk_delay_msec;
 extern int dmesg_restrict;
 extern int kptr_restrict;
 
+extern void wake_up_klogd(void);
+

Given this, it would be prudent to include printk.h in bust_spinlocks.c. printk.h currently gets included by kernel.h, but that doesn't actually seem necessary - nothing in kernel.h calls printk().

Quoted 1 line

(I pity anyone who tries to remove that include from kernel.h ;))

Right, I doubt this will ever happen ;-)

Still, thanks for the fix!

#5 lore raw

Re: [PATCH 2/2] printk: Provide a wake_up_klogd() off-case

In reply to Andrew Morton
Quoted 47 lines · Andrew Morton
Quoted 34 lines · On Thu, 14 Mar 2013 15:26:29 +0100 Frederic Weisbecker <[email protected]>…

wake_up_klogd() is useless when CONFIG_PRINTK=n because neither printk() nor printk_sched() are in use and there are actually no waiter on log_wait waitqueue. It should be a stub in this case for users like bust_spinlocks().

Otherwise this results in this warning when CONFIG_PRINTK=n and CONFIG_IRQ_WORK=n:

kernel/built-in.o In function `wake_up_klogd':
(.text.wake_up_klogd+0xb4): undefined reference to `irq_work_queue'

To fix this, provide an off-case for wake_up_klogd() when CONFIG_PRINTK=n.

There is much more from console_unlock() and other console related code in printk.c that should be moved under CONFIG_PRINTK. But for now, focus on a minimal fix as we passed the merged window already.

include/linux/kernel.h +0 -1
@@ -390,7 +390,6 @@ extern struct pid *session_of_pgrp(struct pid *pgrp);
 unsigned long int_sqrt(unsigned long);
 
 extern void bust_spinlocks(int yes);
-extern void wake_up_klogd(void);
 extern int oops_in_progress;         /* If set, an oops, panic(), BUG() or die() is in progress */
 extern int panic_timeout;
 extern int panic_on_oops;
include/linux/printk.h +0 -0
index 1249a54..822171f 100644

include/linux/printk.h extern int printk_delay_msec; · line 138

Quoted 5 lines
include/linux/printk.h +2 -0
@@ -134,6 +134,8 @@ extern int printk_delay_msec;
 extern int dmesg_restrict;
 extern int kptr_restrict;
 
+extern void wake_up_klogd(void);
+

Given this, it would be prudent to include printk.h in bust_spinlocks.c. printk.h currently gets included by kernel.h, but that doesn't actually seem necessary - nothing in kernel.h calls printk().

Quoted 1 line

(I pity anyone who tries to remove that include from kernel.h ;))

Why did you have to say that? Now I'm inclined to poke at it and just see how bad it really is when I pull on that loose thread...

P.
--

Quoted 24 lines
lib/bust_spinlocks.c renamed from lib/bust_spinlocks.c~printk-provide-a-wake_up_klogd-off-case-fix +1 -2
@@ -8,6 +8,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/printk.h>
 #include <linux/spinlock.h>
 #include <linux/tty.h>
 #include <linux/wait.h>
@@ -28,5 +29,3 @@ void __attribute__((weak)) bust_spinlock
                        wake_up_klogd();
        }
 }
-
-

_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#6 lore raw

Re: [PATCH 2/2] printk: Provide a wake_up_klogd() off-case

2013/3/14 Paul Gortmaker <[email protected]>:

Quoted 49 lines
Quoted 47 lines · Andrew Morton
Quoted 34 lines · On Thu, 14 Mar 2013 15:26:29 +0100 Frederic Weisbecker <[email protected]>…

wake_up_klogd() is useless when CONFIG_PRINTK=n because neither printk() nor printk_sched() are in use and there are actually no waiter on log_wait waitqueue. It should be a stub in this case for users like bust_spinlocks().

Otherwise this results in this warning when CONFIG_PRINTK=n and CONFIG_IRQ_WORK=n:

kernel/built-in.o In function `wake_up_klogd':
(.text.wake_up_klogd+0xb4): undefined reference to `irq_work_queue'

To fix this, provide an off-case for wake_up_klogd() when CONFIG_PRINTK=n.

There is much more from console_unlock() and other console related code in printk.c that should be moved under CONFIG_PRINTK. But for now, focus on a minimal fix as we passed the merged window already.

include/linux/kernel.h +0 -1
@@ -390,7 +390,6 @@ extern struct pid *session_of_pgrp(struct pid *pgrp);
 unsigned long int_sqrt(unsigned long);
 
 extern void bust_spinlocks(int yes);
-extern void wake_up_klogd(void);
 extern int oops_in_progress;         /* If set, an oops, panic(), BUG() or die() is in progress */
 extern int panic_timeout;
 extern int panic_on_oops;
include/linux/printk.h +0 -0
index 1249a54..822171f 100644

include/linux/printk.h extern int printk_delay_msec; · line 138

Quoted 5 lines
include/linux/printk.h +2 -0
@@ -134,6 +134,8 @@ extern int printk_delay_msec;
 extern int dmesg_restrict;
 extern int kptr_restrict;
 
+extern void wake_up_klogd(void);
+

Given this, it would be prudent to include printk.h in bust_spinlocks.c. printk.h currently gets included by kernel.h, but that doesn't actually seem necessary - nothing in kernel.h calls printk().

Quoted 4 lines
Quoted 1 line

(I pity anyone who tries to remove that include from kernel.h ;))

Why did you have to say that? Now I'm inclined to poke at it and just see how bad it really is when I pull on that loose thread...

$ git grep "#include <linux/printk.h>" | cut -d: -f1 | uniq | wc -l
29
$ git grep printk | cut -d: -f1 | uniq | wc -l
6689

There is roughly 6689 - 29 = 6660 files to modify :)

#7 lore raw

Re: [PATCH 2/2] printk: Provide a wake_up_klogd() off-case

Quoted 55 lines · Frederic Weisbecker

2013/3/14 Paul Gortmaker <[email protected]>:

Quoted 49 lines
Quoted 47 lines · Andrew Morton
Quoted 34 lines · On Thu, 14 Mar 2013 15:26:29 +0100 Frederic Weisbecker <[email protected]>…

wake_up_klogd() is useless when CONFIG_PRINTK=n because neither printk() nor printk_sched() are in use and there are actually no waiter on log_wait waitqueue. It should be a stub in this case for users like bust_spinlocks().

Otherwise this results in this warning when CONFIG_PRINTK=n and CONFIG_IRQ_WORK=n:

kernel/built-in.o In function `wake_up_klogd':
(.text.wake_up_klogd+0xb4): undefined reference to `irq_work_queue'

To fix this, provide an off-case for wake_up_klogd() when CONFIG_PRINTK=n.

There is much more from console_unlock() and other console related code in printk.c that should be moved under CONFIG_PRINTK. But for now, focus on a minimal fix as we passed the merged window already.

include/linux/kernel.h +0 -1
@@ -390,7 +390,6 @@ extern struct pid *session_of_pgrp(struct pid *pgrp);
 unsigned long int_sqrt(unsigned long);
 
 extern void bust_spinlocks(int yes);
-extern void wake_up_klogd(void);
 extern int oops_in_progress;         /* If set, an oops, panic(), BUG() or die() is in progress */
 extern int panic_timeout;
 extern int panic_on_oops;
include/linux/printk.h +0 -0
index 1249a54..822171f 100644

include/linux/printk.h extern int printk_delay_msec; · line 138

Quoted 5 lines
include/linux/printk.h +2 -0
@@ -134,6 +134,8 @@ extern int printk_delay_msec;
 extern int dmesg_restrict;
 extern int kptr_restrict;
 
+extern void wake_up_klogd(void);
+

Given this, it would be prudent to include printk.h in bust_spinlocks.c. printk.h currently gets included by kernel.h, but that doesn't actually seem necessary - nothing in kernel.h calls printk().

Quoted 4 lines
Quoted 1 line

(I pity anyone who tries to remove that include from kernel.h ;))

Why did you have to say that? Now I'm inclined to poke at it and just see how bad it really is when I pull on that loose thread...

Quoted 7 lines
$ git grep "#include <linux/printk.h>" | cut -d: -f1 | uniq | wc -l
29
$ git grep printk | cut -d: -f1 | uniq | wc -l
6689

There is roughly 6689 - 29 = 6660 files to modify :)

That is the worst case scenario. If we start by fixing existing headers that actually reference printk (like linux/fs.h) first, then we shouldn't have
to mine down into all those stand-alone C files. At least I think that
may possibly be the case.... ;) Remains to be seen at this point.

Paul.
--

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/