linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] printk: tie printk_once / printk_deferred_once into .data.once for reset
@ 2019-04-13  2:11 Paul Gortmaker
  2019-04-15  2:32 ` Sergey Senozhatsky
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Gortmaker @ 2019-04-13  2:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Andi Kleen, Petr Mladek, Sergey Senozhatsky,
	Steven Rostedt, Andrew Morton

In commit b1fca27d384e ("kernel debug: support resetting WARN*_ONCE")
we got the opportunity to reset state on the one shot messages,
without having to reboot.

However printk_once (printk_deferred_once) live in a different file
and didn't get the same kind of update/conversion, so they remain
unconditionally one shot, until the system is rebooted.

For example, we currently have:

  sched/rt.c: printk_deferred_once("sched: RT throttling activated\n");

..which could reasonably be tripped as someone is testing and tuning
a new system/workload and their task placements.  For consistency, and
to avoid reboots in the same vein as the original commit, we make these
two instances of _once the same as the WARN*_ONCE instances are.

Cc: Andi Kleen <ak@linux.intel.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 Documentation/clearing-warn-once.txt | 2 +-
 include/linux/printk.h               | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/clearing-warn-once.txt b/Documentation/clearing-warn-once.txt
index 5b1f5d547be1..c68598b31428 100644
--- a/Documentation/clearing-warn-once.txt
+++ b/Documentation/clearing-warn-once.txt
@@ -1,5 +1,5 @@
 
-WARN_ONCE / WARN_ON_ONCE only print a warning once.
+WARN_ONCE / WARN_ON_ONCE / printk_once only emit a message once.
 
 echo 1 > /sys/kernel/debug/clear_warn_once
 
diff --git a/include/linux/printk.h b/include/linux/printk.h
index d7c77ed1a4cb..84ea4d094af3 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -347,7 +347,7 @@ extern int kptr_restrict;
 #ifdef CONFIG_PRINTK
 #define printk_once(fmt, ...)					\
 ({								\
-	static bool __print_once __read_mostly;			\
+	static bool __section(.data.once) __print_once;		\
 	bool __ret_print_once = !__print_once;			\
 								\
 	if (!__print_once) {					\
@@ -358,7 +358,7 @@ extern int kptr_restrict;
 })
 #define printk_deferred_once(fmt, ...)				\
 ({								\
-	static bool __print_once __read_mostly;			\
+	static bool __section(.data.once) __print_once;		\
 	bool __ret_print_once = !__print_once;			\
 								\
 	if (!__print_once) {					\
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] printk: tie printk_once / printk_deferred_once into .data.once for reset
  2019-04-13  2:11 [PATCH] printk: tie printk_once / printk_deferred_once into .data.once for reset Paul Gortmaker
@ 2019-04-15  2:32 ` Sergey Senozhatsky
  2019-04-15 12:34   ` Petr Mladek
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2019-04-15  2:32 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Andi Kleen, Petr Mladek, Sergey Senozhatsky,
	Steven Rostedt, Andrew Morton

On (04/12/19 22:11), Paul Gortmaker wrote:
> In commit b1fca27d384e ("kernel debug: support resetting WARN*_ONCE")
> we got the opportunity to reset state on the one shot messages,
> without having to reboot.

Didn't know that.

> However printk_once (printk_deferred_once) live in a different file
> and didn't get the same kind of update/conversion, so they remain
> unconditionally one shot, until the system is rebooted.
> 
> For example, we currently have:
> 
>   sched/rt.c: printk_deferred_once("sched: RT throttling activated\n");
> 
> ..which could reasonably be tripped as someone is testing and tuning
> a new system/workload and their task placements.  For consistency, and
> to avoid reboots in the same vein as the original commit, we make these
> two instances of _once the same as the WARN*_ONCE instances are.

Looks OK to me.

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] printk: tie printk_once / printk_deferred_once into .data.once for reset
  2019-04-15  2:32 ` Sergey Senozhatsky
@ 2019-04-15 12:34   ` Petr Mladek
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2019-04-15 12:34 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Paul Gortmaker, linux-kernel, Andi Kleen, Sergey Senozhatsky,
	Steven Rostedt, Andrew Morton

On Mon 2019-04-15 11:32:16, Sergey Senozhatsky wrote:
> On (04/12/19 22:11), Paul Gortmaker wrote:
> > In commit b1fca27d384e ("kernel debug: support resetting WARN*_ONCE")
> > we got the opportunity to reset state on the one shot messages,
> > without having to reboot.
> 
> Didn't know that.
> 
> > However printk_once (printk_deferred_once) live in a different file
> > and didn't get the same kind of update/conversion, so they remain
> > unconditionally one shot, until the system is rebooted.
> > 
> > For example, we currently have:
> > 
> >   sched/rt.c: printk_deferred_once("sched: RT throttling activated\n");
> > 
> > ..which could reasonably be tripped as someone is testing and tuning
> > a new system/workload and their task placements.  For consistency, and
> > to avoid reboots in the same vein as the original commit, we make these
> > two instances of _once the same as the WARN*_ONCE instances are.
> 
> Looks OK to me.
> 
> Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

The patch has been commited into printk.git, branch for-5.2.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-15 12:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-13  2:11 [PATCH] printk: tie printk_once / printk_deferred_once into .data.once for reset Paul Gortmaker
2019-04-15  2:32 ` Sergey Senozhatsky
2019-04-15 12:34   ` Petr Mladek

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).