All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
@ 2018-07-19 10:15 ` Thomas Zimmermann
  0 siblings, 0 replies; 21+ messages in thread
From: Thomas Zimmermann @ 2018-07-19 10:15 UTC (permalink / raw)
  To: rostedt, pmladek, linux-fbdev, sergey.senozhatsky, b.zolnierkie,
	dri-devel, hdegoede, akpm, sergey.senozhatsky.work
  Cc: Thomas Zimmermann

Hi,

this is version 3 of the WARN_CONSOLE_UNLOCKED patch set. The
macro prints a warning if the console's critical sections are
entered without holding the console lock. This patch set allows
to disable the warnings while debugging the console.

In the original approach, WARN_CONSOLE_UNLOCKED was disabled by
setting ignore_console_lock_warning of type bool. As suggested by
Petr Mladek, the new implementation is based on atomic_t and allows
multiple threads to manipulate the warning state concurrently.

With version 3, the patch set now includes the patch for introducing
ignore_console_lock_warning. This patch superseds all previous patches
of the same purpose.

Best regards
Thomas

v3:
	- implement ignore_console_lock_warning with atomic_t
v2:
	- restore ignore_console_lock_warning if lock_fb_info() fails

Thomas Zimmermann (2):
  console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
  fbdev/core: Disable console-lock warnings when fb.lockless_register_fb
    is set

 drivers/video/fbdev/core/fbmem.c | 13 +++++++++----
 include/linux/console.h          | 14 +++++++++-----
 kernel/printk/printk.c           |  3 +++
 3 files changed, 21 insertions(+), 9 deletions(-)

--
2.18.0


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

* [PATCH v3 0/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
@ 2018-07-19 10:15 ` Thomas Zimmermann
  0 siblings, 0 replies; 21+ messages in thread
From: Thomas Zimmermann @ 2018-07-19 10:15 UTC (permalink / raw)
  To: rostedt, pmladek, linux-fbdev, sergey.senozhatsky, b.zolnierkie,
	dri-devel, hdegoede, akpm, sergey.senozhatsky.work
  Cc: Thomas Zimmermann

Hi,

this is version 3 of the WARN_CONSOLE_UNLOCKED patch set. The
macro prints a warning if the console's critical sections are
entered without holding the console lock. This patch set allows
to disable the warnings while debugging the console.

In the original approach, WARN_CONSOLE_UNLOCKED was disabled by
setting ignore_console_lock_warning of type bool. As suggested by
Petr Mladek, the new implementation is based on atomic_t and allows
multiple threads to manipulate the warning state concurrently.

With version 3, the patch set now includes the patch for introducing
ignore_console_lock_warning. This patch superseds all previous patches
of the same purpose.

Best regards
Thomas

v3:
	- implement ignore_console_lock_warning with atomic_t
v2:
	- restore ignore_console_lock_warning if lock_fb_info() fails

Thomas Zimmermann (2):
  console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
  fbdev/core: Disable console-lock warnings when fb.lockless_register_fb
    is set

 drivers/video/fbdev/core/fbmem.c | 13 +++++++++----
 include/linux/console.h          | 14 +++++++++-----
 kernel/printk/printk.c           |  3 +++
 3 files changed, 21 insertions(+), 9 deletions(-)

--
2.18.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 1/2] console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
  2018-07-19 10:15 ` Thomas Zimmermann
@ 2018-07-19 10:16   ` Thomas Zimmermann
  -1 siblings, 0 replies; 21+ messages in thread
From: Thomas Zimmermann @ 2018-07-19 10:16 UTC (permalink / raw)
  To: rostedt, pmladek, linux-fbdev, sergey.senozhatsky, b.zolnierkie,
	dri-devel, hdegoede, akpm, sergey.senozhatsky.work
  Cc: Thomas Zimmermann

The macro WARN_CONSOLE_UNLOCKED prints a warning when a thread enters
the console's critical section without having acquired the console
lock. The console lock can be ignored when debugging the console using
printk, but this makes WARN_CONSOLE_UNLOCKED generate unnecessary
warnings.

The variable ignore_console_lock_warning temporarily disables
WARN_CONSOLE_UNLOCKED. Developers interested in debugging the console's
critical sections should increment it before entering the CS and
decrement it after leaving the CS. Setting ignore_console_lock_warning
is only for debugging. Regular operation should not manipulate it.

Acknoledgements: This patch is based on an earlier version by Steven
Rostedt. The use of atomic increment/decrement was suggested by Petr
Mladek.

Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a25696b5@suse.de
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 include/linux/console.h | 14 +++++++++-----
 kernel/printk/printk.c  |  3 +++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/include/linux/console.h b/include/linux/console.h
index f59f3dbca65c..a3307bcab947 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -14,6 +14,7 @@
 #ifndef _LINUX_CONSOLE_H_
 #define _LINUX_CONSOLE_H_ 1
 
+#include <asm/atomic.h>
 #include <linux/types.h>
 
 struct vc_data;
@@ -201,11 +202,14 @@ void vcs_make_sysfs(int index);
 void vcs_remove_sysfs(int index);
 
 /* Some debug stub to catch some of the obvious races in the VT code */
-#if 1
-#define WARN_CONSOLE_UNLOCKED()	WARN_ON(!is_console_locked() && !oops_in_progress)
-#else
-#define WARN_CONSOLE_UNLOCKED()
-#endif
+#define WARN_CONSOLE_UNLOCKED()						\
+	WARN_ON(!atomic_read(&ignore_console_lock_warning) &&		\
+		!is_console_locked() && !oops_in_progress)
+/*
+ * Increment ignore_console_lock_warning if you need to quiet
+ * WARN_CONSOLE_UNLOCKED() for debugging purposes.
+ */
+extern atomic_t ignore_console_lock_warning;
 
 /* VESA Blanking Levels */
 #define VESA_NO_BLANKING        0
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 3f041e7cbfc9..7d32a86758cd 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -66,6 +66,9 @@ int console_printk[4] = {
 	CONSOLE_LOGLEVEL_DEFAULT,	/* default_console_loglevel */
 };
 
+atomic_t ignore_console_lock_warning __read_mostly = ATOMIC_INIT(0);
+EXPORT_SYMBOL(ignore_console_lock_warning);
+
 /*
  * Low level drivers may need that to know if they can schedule in
  * their unblank() callback or not. So let's export it.
-- 
2.18.0


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

* [PATCH v3 1/2] console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
@ 2018-07-19 10:16   ` Thomas Zimmermann
  0 siblings, 0 replies; 21+ messages in thread
From: Thomas Zimmermann @ 2018-07-19 10:16 UTC (permalink / raw)
  To: rostedt, pmladek, linux-fbdev, sergey.senozhatsky, b.zolnierkie,
	dri-devel, hdegoede, akpm, sergey.senozhatsky.work
  Cc: Thomas Zimmermann

The macro WARN_CONSOLE_UNLOCKED prints a warning when a thread enters
the console's critical section without having acquired the console
lock. The console lock can be ignored when debugging the console using
printk, but this makes WARN_CONSOLE_UNLOCKED generate unnecessary
warnings.

The variable ignore_console_lock_warning temporarily disables
WARN_CONSOLE_UNLOCKED. Developers interested in debugging the console's
critical sections should increment it before entering the CS and
decrement it after leaving the CS. Setting ignore_console_lock_warning
is only for debugging. Regular operation should not manipulate it.

Acknoledgements: This patch is based on an earlier version by Steven
Rostedt. The use of atomic increment/decrement was suggested by Petr
Mladek.

Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a25696b5@suse.de
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 include/linux/console.h | 14 +++++++++-----
 kernel/printk/printk.c  |  3 +++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/include/linux/console.h b/include/linux/console.h
index f59f3dbca65c..a3307bcab947 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -14,6 +14,7 @@
 #ifndef _LINUX_CONSOLE_H_
 #define _LINUX_CONSOLE_H_ 1
 
+#include <asm/atomic.h>
 #include <linux/types.h>
 
 struct vc_data;
@@ -201,11 +202,14 @@ void vcs_make_sysfs(int index);
 void vcs_remove_sysfs(int index);
 
 /* Some debug stub to catch some of the obvious races in the VT code */
-#if 1
-#define WARN_CONSOLE_UNLOCKED()	WARN_ON(!is_console_locked() && !oops_in_progress)
-#else
-#define WARN_CONSOLE_UNLOCKED()
-#endif
+#define WARN_CONSOLE_UNLOCKED()						\
+	WARN_ON(!atomic_read(&ignore_console_lock_warning) &&		\
+		!is_console_locked() && !oops_in_progress)
+/*
+ * Increment ignore_console_lock_warning if you need to quiet
+ * WARN_CONSOLE_UNLOCKED() for debugging purposes.
+ */
+extern atomic_t ignore_console_lock_warning;
 
 /* VESA Blanking Levels */
 #define VESA_NO_BLANKING        0
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 3f041e7cbfc9..7d32a86758cd 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -66,6 +66,9 @@ int console_printk[4] = {
 	CONSOLE_LOGLEVEL_DEFAULT,	/* default_console_loglevel */
 };
 
+atomic_t ignore_console_lock_warning __read_mostly = ATOMIC_INIT(0);
+EXPORT_SYMBOL(ignore_console_lock_warning);
+
 /*
  * Low level drivers may need that to know if they can schedule in
  * their unblank() callback or not. So let's export it.
-- 
2.18.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 2/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
  2018-07-19 10:15 ` Thomas Zimmermann
@ 2018-07-19 10:16   ` Thomas Zimmermann
  -1 siblings, 0 replies; 21+ messages in thread
From: Thomas Zimmermann @ 2018-07-19 10:16 UTC (permalink / raw)
  To: rostedt, pmladek, linux-fbdev, sergey.senozhatsky, b.zolnierkie,
	dri-devel, hdegoede, akpm, sergey.senozhatsky.work
  Cc: Thomas Zimmermann

If the console is unlocked during registration, the console subsystem
generates significant amounts of warnings, which obfuscate actual
debugging messages. Setting ignore_console_lock_warning while debugging
console registration avoid the noise.

v3:
	- manipulate ignore_console_lock_warning with atomic_{inc,dec}
v2:
	- restore ignore_console_lock_warning if lock_fb_info() fails

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/core/fbmem.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 9e2f9d3c760e..cb72cd6c5892 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1691,17 +1691,22 @@ static int do_register_framebuffer(struct fb_info *fb_info)
 	event.info = fb_info;
 	if (!lockless_register_fb)
 		console_lock();
+	else
+		atomic_inc(&ignore_console_lock_warning);
 	if (!lock_fb_info(fb_info)) {
-		if (!lockless_register_fb)
-			console_unlock();
-		return -ENODEV;
+		ret = -ENODEV;
+		goto unlock_console;
 	}
+	ret = 0;
 
 	fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
 	unlock_fb_info(fb_info);
+unlock_console:
 	if (!lockless_register_fb)
 		console_unlock();
-	return 0;
+	else
+		atomic_dec(&ignore_console_lock_warning);
+	return ret;
 }
 
 static int do_unregister_framebuffer(struct fb_info *fb_info)
-- 
2.18.0


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

* [PATCH v3 2/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
@ 2018-07-19 10:16   ` Thomas Zimmermann
  0 siblings, 0 replies; 21+ messages in thread
From: Thomas Zimmermann @ 2018-07-19 10:16 UTC (permalink / raw)
  To: rostedt, pmladek, linux-fbdev, sergey.senozhatsky, b.zolnierkie,
	dri-devel, hdegoede, akpm, sergey.senozhatsky.work
  Cc: Thomas Zimmermann

If the console is unlocked during registration, the console subsystem
generates significant amounts of warnings, which obfuscate actual
debugging messages. Setting ignore_console_lock_warning while debugging
console registration avoid the noise.

v3:
	- manipulate ignore_console_lock_warning with atomic_{inc,dec}
v2:
	- restore ignore_console_lock_warning if lock_fb_info() fails

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/core/fbmem.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 9e2f9d3c760e..cb72cd6c5892 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1691,17 +1691,22 @@ static int do_register_framebuffer(struct fb_info *fb_info)
 	event.info = fb_info;
 	if (!lockless_register_fb)
 		console_lock();
+	else
+		atomic_inc(&ignore_console_lock_warning);
 	if (!lock_fb_info(fb_info)) {
-		if (!lockless_register_fb)
-			console_unlock();
-		return -ENODEV;
+		ret = -ENODEV;
+		goto unlock_console;
 	}
+	ret = 0;
 
 	fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
 	unlock_fb_info(fb_info);
+unlock_console:
 	if (!lockless_register_fb)
 		console_unlock();
-	return 0;
+	else
+		atomic_dec(&ignore_console_lock_warning);
+	return ret;
 }
 
 static int do_unregister_framebuffer(struct fb_info *fb_info)
-- 
2.18.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 0/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
  2018-07-19 10:15 ` Thomas Zimmermann
@ 2018-07-19 11:45   ` Hans de Goede
  -1 siblings, 0 replies; 21+ messages in thread
From: Hans de Goede @ 2018-07-19 11:45 UTC (permalink / raw)
  To: Thomas Zimmermann, rostedt, pmladek, linux-fbdev,
	sergey.senozhatsky, b.zolnierkie, dri-devel, akpm,
	sergey.senozhatsky.work

Hi,

On 19-07-18 12:15, Thomas Zimmermann wrote:
> Hi,
> 
> this is version 3 of the WARN_CONSOLE_UNLOCKED patch set. The
> macro prints a warning if the console's critical sections are
> entered without holding the console lock. This patch set allows
> to disable the warnings while debugging the console.
> 
> In the original approach, WARN_CONSOLE_UNLOCKED was disabled by
> setting ignore_console_lock_warning of type bool. As suggested by
> Petr Mladek, the new implementation is based on atomic_t and allows
> multiple threads to manipulate the warning state concurrently.
> 
> With version 3, the patch set now includes the patch for introducing
> ignore_console_lock_warning. This patch superseds all previous patches
> of the same purpose.
> 
> Best regards
> Thomas
> 
> v3:
> 	- implement ignore_console_lock_warning with atomic_t
> v2:
> 	- restore ignore_console_lock_warning if lock_fb_info() fails
> 
> Thomas Zimmermann (2):
>    console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
>    fbdev/core: Disable console-lock warnings when fb.lockless_register_fb
>      is set

I just saw this version after my comment on v2 that the race there
was not really a problem.

This version is even better though :)    :

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans

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

* Re: [PATCH v3 0/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
@ 2018-07-19 11:45   ` Hans de Goede
  0 siblings, 0 replies; 21+ messages in thread
From: Hans de Goede @ 2018-07-19 11:45 UTC (permalink / raw)
  To: Thomas Zimmermann, rostedt, pmladek, linux-fbdev,
	sergey.senozhatsky, b.zolnierkie, dri-devel, akpm,
	sergey.senozhatsky.work

Hi,

On 19-07-18 12:15, Thomas Zimmermann wrote:
> Hi,
> 
> this is version 3 of the WARN_CONSOLE_UNLOCKED patch set. The
> macro prints a warning if the console's critical sections are
> entered without holding the console lock. This patch set allows
> to disable the warnings while debugging the console.
> 
> In the original approach, WARN_CONSOLE_UNLOCKED was disabled by
> setting ignore_console_lock_warning of type bool. As suggested by
> Petr Mladek, the new implementation is based on atomic_t and allows
> multiple threads to manipulate the warning state concurrently.
> 
> With version 3, the patch set now includes the patch for introducing
> ignore_console_lock_warning. This patch superseds all previous patches
> of the same purpose.
> 
> Best regards
> Thomas
> 
> v3:
> 	- implement ignore_console_lock_warning with atomic_t
> v2:
> 	- restore ignore_console_lock_warning if lock_fb_info() fails
> 
> Thomas Zimmermann (2):
>    console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
>    fbdev/core: Disable console-lock warnings when fb.lockless_register_fb
>      is set

I just saw this version after my comment on v2 that the race there
was not really a problem.

This version is even better though :)    :

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 0/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
  2018-07-19 10:15 ` Thomas Zimmermann
                   ` (3 preceding siblings ...)
  (?)
@ 2018-07-19 11:46 ` Hans de Goede
  -1 siblings, 0 replies; 21+ messages in thread
From: Hans de Goede @ 2018-07-19 11:46 UTC (permalink / raw)
  To: linux-fbdev

p.s. (without the lists in the Cc)

I'm on vacation starting tomorrow, back to work on Mon Jul 30th.

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

* Re: [PATCH v3 1/2] console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
  2018-07-19 10:16   ` Thomas Zimmermann
@ 2018-07-20  9:07     ` Petr Mladek
  -1 siblings, 0 replies; 21+ messages in thread
From: Petr Mladek @ 2018-07-20  9:07 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: linux-fbdev, sergey.senozhatsky.work, hdegoede, b.zolnierkie,
	dri-devel, sergey.senozhatsky, rostedt, akpm

On Thu 2018-07-19 12:16:00, Thomas Zimmermann wrote:
> The macro WARN_CONSOLE_UNLOCKED prints a warning when a thread enters
> the console's critical section without having acquired the console
> lock. The console lock can be ignored when debugging the console using
> printk, but this makes WARN_CONSOLE_UNLOCKED generate unnecessary
> warnings.
> 
> The variable ignore_console_lock_warning temporarily disables
> WARN_CONSOLE_UNLOCKED. Developers interested in debugging the console's
> critical sections should increment it before entering the CS and
> decrement it after leaving the CS. Setting ignore_console_lock_warning
> is only for debugging. Regular operation should not manipulate it.
> 
> Acknoledgements: This patch is based on an earlier version by Steven
> Rostedt. The use of atomic increment/decrement was suggested by Petr
> Mladek.
> 
> Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a25696b5@suse.de
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Acked-by: Petr Mladek <pmladek@suse.com>

I have vacation the following two weeks. I prefer this version over
the previous one but I could live with both.

Best Regards,
Petr

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

* Re: [PATCH v3 1/2] console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
@ 2018-07-20  9:07     ` Petr Mladek
  0 siblings, 0 replies; 21+ messages in thread
From: Petr Mladek @ 2018-07-20  9:07 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: linux-fbdev, sergey.senozhatsky.work, hdegoede, b.zolnierkie,
	dri-devel, sergey.senozhatsky, rostedt, akpm

On Thu 2018-07-19 12:16:00, Thomas Zimmermann wrote:
> The macro WARN_CONSOLE_UNLOCKED prints a warning when a thread enters
> the console's critical section without having acquired the console
> lock. The console lock can be ignored when debugging the console using
> printk, but this makes WARN_CONSOLE_UNLOCKED generate unnecessary
> warnings.
> 
> The variable ignore_console_lock_warning temporarily disables
> WARN_CONSOLE_UNLOCKED. Developers interested in debugging the console's
> critical sections should increment it before entering the CS and
> decrement it after leaving the CS. Setting ignore_console_lock_warning
> is only for debugging. Regular operation should not manipulate it.
> 
> Acknoledgements: This patch is based on an earlier version by Steven
> Rostedt. The use of atomic increment/decrement was suggested by Petr
> Mladek.
> 
> Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a25696b5@suse.de
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Acked-by: Petr Mladek <pmladek@suse.com>

I have vacation the following two weeks. I prefer this version over
the previous one but I could live with both.

Best Regards,
Petr
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 2/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
  2018-07-19 10:16   ` Thomas Zimmermann
@ 2018-07-20  9:10     ` Petr Mladek
  -1 siblings, 0 replies; 21+ messages in thread
From: Petr Mladek @ 2018-07-20  9:10 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: linux-fbdev, sergey.senozhatsky.work, hdegoede, b.zolnierkie,
	dri-devel, sergey.senozhatsky, rostedt, akpm

On Thu 2018-07-19 12:16:01, Thomas Zimmermann wrote:
> If the console is unlocked during registration, the console subsystem
> generates significant amounts of warnings, which obfuscate actual
> debugging messages. Setting ignore_console_lock_warning while debugging
> console registration avoid the noise.
> 
> v3:
> 	- manipulate ignore_console_lock_warning with atomic_{inc,dec}
> v2:
> 	- restore ignore_console_lock_warning if lock_fb_info() fails
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Petr Mladek <pmladek@suse.com>

I have vacation the following two weeks. Note that I am fine with
v2 if anyone see the atomic as an overkill.

Best Regards,
Petr

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

* Re: [PATCH v3 2/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
@ 2018-07-20  9:10     ` Petr Mladek
  0 siblings, 0 replies; 21+ messages in thread
From: Petr Mladek @ 2018-07-20  9:10 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: linux-fbdev, sergey.senozhatsky.work, hdegoede, b.zolnierkie,
	dri-devel, sergey.senozhatsky, rostedt, akpm

On Thu 2018-07-19 12:16:01, Thomas Zimmermann wrote:
> If the console is unlocked during registration, the console subsystem
> generates significant amounts of warnings, which obfuscate actual
> debugging messages. Setting ignore_console_lock_warning while debugging
> console registration avoid the noise.
> 
> v3:
> 	- manipulate ignore_console_lock_warning with atomic_{inc,dec}
> v2:
> 	- restore ignore_console_lock_warning if lock_fb_info() fails
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Petr Mladek <pmladek@suse.com>

I have vacation the following two weeks. Note that I am fine with
v2 if anyone see the atomic as an overkill.

Best Regards,
Petr
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 0/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
  2018-07-19 10:15 ` Thomas Zimmermann
@ 2018-07-20 12:08   ` Sergey Senozhatsky
  -1 siblings, 0 replies; 21+ messages in thread
From: Sergey Senozhatsky @ 2018-07-20 12:08 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: pmladek, linux-fbdev, sergey.senozhatsky.work, b.zolnierkie,
	dri-devel, sergey.senozhatsky, hdegoede, rostedt, akpm

On (07/19/18 12:15), Thomas Zimmermann wrote:
> this is version 3 of the WARN_CONSOLE_UNLOCKED patch set. The
> macro prints a warning if the console's critical sections are
> entered without holding the console lock. This patch set allows
> to disable the warnings while debugging the console.
> 
> In the original approach, WARN_CONSOLE_UNLOCKED was disabled by
> setting ignore_console_lock_warning of type bool. As suggested by
> Petr Mladek, the new implementation is based on atomic_t and allows
> multiple threads to manipulate the warning state concurrently.
> 
> With version 3, the patch set now includes the patch for introducing
> ignore_console_lock_warning. This patch superseds all previous patches
> of the same purpose.
> 
> Best regards
> Thomas
> 
> v3:
> 	- implement ignore_console_lock_warning with atomic_t
> v2:
> 	- restore ignore_console_lock_warning if lock_fb_info() fails

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

	-ss

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

* Re: [PATCH v3 0/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
@ 2018-07-20 12:08   ` Sergey Senozhatsky
  0 siblings, 0 replies; 21+ messages in thread
From: Sergey Senozhatsky @ 2018-07-20 12:08 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: pmladek, linux-fbdev, sergey.senozhatsky.work, b.zolnierkie,
	dri-devel, sergey.senozhatsky, hdegoede, rostedt, akpm

On (07/19/18 12:15), Thomas Zimmermann wrote:
> this is version 3 of the WARN_CONSOLE_UNLOCKED patch set. The
> macro prints a warning if the console's critical sections are
> entered without holding the console lock. This patch set allows
> to disable the warnings while debugging the console.
> 
> In the original approach, WARN_CONSOLE_UNLOCKED was disabled by
> setting ignore_console_lock_warning of type bool. As suggested by
> Petr Mladek, the new implementation is based on atomic_t and allows
> multiple threads to manipulate the warning state concurrently.
> 
> With version 3, the patch set now includes the patch for introducing
> ignore_console_lock_warning. This patch superseds all previous patches
> of the same purpose.
> 
> Best regards
> Thomas
> 
> v3:
> 	- implement ignore_console_lock_warning with atomic_t
> v2:
> 	- restore ignore_console_lock_warning if lock_fb_info() fails

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

	-ss
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 1/2] console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
  2018-07-19 10:16   ` Thomas Zimmermann
@ 2018-07-31 10:45     ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 21+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-07-31 10:45 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: pmladek, linux-fbdev, sergey.senozhatsky.work,
	sergey.senozhatsky, dri-devel, hdegoede, rostedt, akpm

On Thursday, July 19, 2018 12:16:00 PM Thomas Zimmermann wrote:
> The macro WARN_CONSOLE_UNLOCKED prints a warning when a thread enters
> the console's critical section without having acquired the console
> lock. The console lock can be ignored when debugging the console using
> printk, but this makes WARN_CONSOLE_UNLOCKED generate unnecessary
> warnings.
> 
> The variable ignore_console_lock_warning temporarily disables
> WARN_CONSOLE_UNLOCKED. Developers interested in debugging the console's
> critical sections should increment it before entering the CS and
> decrement it after leaving the CS. Setting ignore_console_lock_warning
> is only for debugging. Regular operation should not manipulate it.
> 
> Acknoledgements: This patch is based on an earlier version by Steven
> Rostedt. The use of atomic increment/decrement was suggested by Petr
> Mladek.
> 
> Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a25696b5@suse.de
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Patch queued for 4.19 (w/ <asm/atomic.h> -> <linux/atomic.h> fixup), thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


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

* Re: [PATCH v3 1/2] console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
@ 2018-07-31 10:45     ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 21+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-07-31 10:45 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: pmladek, linux-fbdev, sergey.senozhatsky.work,
	sergey.senozhatsky, dri-devel, hdegoede, rostedt, akpm

On Thursday, July 19, 2018 12:16:00 PM Thomas Zimmermann wrote:
> The macro WARN_CONSOLE_UNLOCKED prints a warning when a thread enters
> the console's critical section without having acquired the console
> lock. The console lock can be ignored when debugging the console using
> printk, but this makes WARN_CONSOLE_UNLOCKED generate unnecessary
> warnings.
> 
> The variable ignore_console_lock_warning temporarily disables
> WARN_CONSOLE_UNLOCKED. Developers interested in debugging the console's
> critical sections should increment it before entering the CS and
> decrement it after leaving the CS. Setting ignore_console_lock_warning
> is only for debugging. Regular operation should not manipulate it.
> 
> Acknoledgements: This patch is based on an earlier version by Steven
> Rostedt. The use of atomic increment/decrement was suggested by Petr
> Mladek.
> 
> Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a25696b5@suse.de
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Patch queued for 4.19 (w/ <asm/atomic.h> -> <linux/atomic.h> fixup), thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 2/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
  2018-07-19 10:16   ` Thomas Zimmermann
@ 2018-07-31 10:45     ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 21+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-07-31 10:45 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: pmladek, linux-fbdev, sergey.senozhatsky.work,
	sergey.senozhatsky, dri-devel, hdegoede, rostedt, akpm

On Thursday, July 19, 2018 12:16:01 PM Thomas Zimmermann wrote:
> If the console is unlocked during registration, the console subsystem
> generates significant amounts of warnings, which obfuscate actual
> debugging messages. Setting ignore_console_lock_warning while debugging
> console registration avoid the noise.
> 
> v3:
> 	- manipulate ignore_console_lock_warning with atomic_{inc,dec}
> v2:
> 	- restore ignore_console_lock_warning if lock_fb_info() fails
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Patch queued for 4.19, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


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

* Re: [PATCH v3 2/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
@ 2018-07-31 10:45     ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 21+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-07-31 10:45 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: pmladek, linux-fbdev, sergey.senozhatsky.work,
	sergey.senozhatsky, dri-devel, hdegoede, rostedt, akpm

On Thursday, July 19, 2018 12:16:01 PM Thomas Zimmermann wrote:
> If the console is unlocked during registration, the console subsystem
> generates significant amounts of warnings, which obfuscate actual
> debugging messages. Setting ignore_console_lock_warning while debugging
> console registration avoid the noise.
> 
> v3:
> 	- manipulate ignore_console_lock_warning with atomic_{inc,dec}
> v2:
> 	- restore ignore_console_lock_warning if lock_fb_info() fails
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Patch queued for 4.19, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 1/2] console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
  2018-07-19 10:16   ` Thomas Zimmermann
@ 2018-07-31 15:38     ` Steven Rostedt
  -1 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2018-07-31 15:38 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: pmladek, linux-fbdev, sergey.senozhatsky,
	sergey.senozhatsky.work, b.zolnierkie, dri-devel, hdegoede, akpm

On Thu, 19 Jul 2018 12:16:00 +0200
Thomas Zimmermann <tzimmermann@suse.de> wrote:

> The macro WARN_CONSOLE_UNLOCKED prints a warning when a thread enters
> the console's critical section without having acquired the console
> lock. The console lock can be ignored when debugging the console using
> printk, but this makes WARN_CONSOLE_UNLOCKED generate unnecessary
> warnings.
> 
> The variable ignore_console_lock_warning temporarily disables
> WARN_CONSOLE_UNLOCKED. Developers interested in debugging the console's
> critical sections should increment it before entering the CS and
> decrement it after leaving the CS. Setting ignore_console_lock_warning
> is only for debugging. Regular operation should not manipulate it.
> 
> Acknoledgements: This patch is based on an earlier version by Steven
> Rostedt. The use of atomic increment/decrement was suggested by Petr
> Mladek.

You can also add a reference to that patch as well:

Link: http://lkml.kernel.org/r/20180712092938.22e33641@gandalf.local.home

-- Steve

> 
> Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a25696b5@suse.de
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  include/linux/console.h | 14 +++++++++-----
>  kernel/printk/printk.c  |  3 +++
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/console.h b/include/linux/console.h
> index f59f3dbca65c..a3307bcab947 100644
> --- a/include/linux/console.h
> +++ b/include/linux/console.h
> @@ -14,6 +14,7 @@
>  #ifndef _LINUX_CONSOLE_H_
>  #define _LINUX_CONSOLE_H_ 1
>  
> +#include <asm/atomic.h>
>  #include <linux/types.h>
>  
>  struct vc_data;
> @@ -201,11 +202,14 @@ void vcs_make_sysfs(int index);
>  void vcs_remove_sysfs(int index);
>  
>  /* Some debug stub to catch some of the obvious races in the VT code */
> -#if 1
> -#define WARN_CONSOLE_UNLOCKED()	WARN_ON(!is_console_locked() && !oops_in_progress)
> -#else
> -#define WARN_CONSOLE_UNLOCKED()
> -#endif
> +#define WARN_CONSOLE_UNLOCKED()						\
> +	WARN_ON(!atomic_read(&ignore_console_lock_warning) &&		\
> +		!is_console_locked() && !oops_in_progress)
> +/*
> + * Increment ignore_console_lock_warning if you need to quiet
> + * WARN_CONSOLE_UNLOCKED() for debugging purposes.
> + */
> +extern atomic_t ignore_console_lock_warning;
>  
>  /* VESA Blanking Levels */
>  #define VESA_NO_BLANKING        0
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 3f041e7cbfc9..7d32a86758cd 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -66,6 +66,9 @@ int console_printk[4] = {
>  	CONSOLE_LOGLEVEL_DEFAULT,	/* default_console_loglevel */
>  };
>  
> +atomic_t ignore_console_lock_warning __read_mostly = ATOMIC_INIT(0);
> +EXPORT_SYMBOL(ignore_console_lock_warning);
> +
>  /*
>   * Low level drivers may need that to know if they can schedule in
>   * their unblank() callback or not. So let's export it.


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

* Re: [PATCH v3 1/2] console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
@ 2018-07-31 15:38     ` Steven Rostedt
  0 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2018-07-31 15:38 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: pmladek, linux-fbdev, sergey.senozhatsky,
	sergey.senozhatsky.work, b.zolnierkie, dri-devel, hdegoede, akpm

On Thu, 19 Jul 2018 12:16:00 +0200
Thomas Zimmermann <tzimmermann@suse.de> wrote:

> The macro WARN_CONSOLE_UNLOCKED prints a warning when a thread enters
> the console's critical section without having acquired the console
> lock. The console lock can be ignored when debugging the console using
> printk, but this makes WARN_CONSOLE_UNLOCKED generate unnecessary
> warnings.
> 
> The variable ignore_console_lock_warning temporarily disables
> WARN_CONSOLE_UNLOCKED. Developers interested in debugging the console's
> critical sections should increment it before entering the CS and
> decrement it after leaving the CS. Setting ignore_console_lock_warning
> is only for debugging. Regular operation should not manipulate it.
> 
> Acknoledgements: This patch is based on an earlier version by Steven
> Rostedt. The use of atomic increment/decrement was suggested by Petr
> Mladek.

You can also add a reference to that patch as well:

Link: http://lkml.kernel.org/r/20180712092938.22e33641@gandalf.local.home

-- Steve

> 
> Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a25696b5@suse.de
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  include/linux/console.h | 14 +++++++++-----
>  kernel/printk/printk.c  |  3 +++
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/console.h b/include/linux/console.h
> index f59f3dbca65c..a3307bcab947 100644
> --- a/include/linux/console.h
> +++ b/include/linux/console.h
> @@ -14,6 +14,7 @@
>  #ifndef _LINUX_CONSOLE_H_
>  #define _LINUX_CONSOLE_H_ 1
>  
> +#include <asm/atomic.h>
>  #include <linux/types.h>
>  
>  struct vc_data;
> @@ -201,11 +202,14 @@ void vcs_make_sysfs(int index);
>  void vcs_remove_sysfs(int index);
>  
>  /* Some debug stub to catch some of the obvious races in the VT code */
> -#if 1
> -#define WARN_CONSOLE_UNLOCKED()	WARN_ON(!is_console_locked() && !oops_in_progress)
> -#else
> -#define WARN_CONSOLE_UNLOCKED()
> -#endif
> +#define WARN_CONSOLE_UNLOCKED()						\
> +	WARN_ON(!atomic_read(&ignore_console_lock_warning) &&		\
> +		!is_console_locked() && !oops_in_progress)
> +/*
> + * Increment ignore_console_lock_warning if you need to quiet
> + * WARN_CONSOLE_UNLOCKED() for debugging purposes.
> + */
> +extern atomic_t ignore_console_lock_warning;
>  
>  /* VESA Blanking Levels */
>  #define VESA_NO_BLANKING        0
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 3f041e7cbfc9..7d32a86758cd 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -66,6 +66,9 @@ int console_printk[4] = {
>  	CONSOLE_LOGLEVEL_DEFAULT,	/* default_console_loglevel */
>  };
>  
> +atomic_t ignore_console_lock_warning __read_mostly = ATOMIC_INIT(0);
> +EXPORT_SYMBOL(ignore_console_lock_warning);
> +
>  /*
>   * Low level drivers may need that to know if they can schedule in
>   * their unblank() callback or not. So let's export it.

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-07-31 15:38 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 10:15 [PATCH v3 0/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set Thomas Zimmermann
2018-07-19 10:15 ` Thomas Zimmermann
2018-07-19 10:16 ` [PATCH v3 1/2] console: Replace #if 0 with atomic var 'ignore_console_lock_warning' Thomas Zimmermann
2018-07-19 10:16   ` Thomas Zimmermann
2018-07-20  9:07   ` Petr Mladek
2018-07-20  9:07     ` Petr Mladek
2018-07-31 10:45   ` Bartlomiej Zolnierkiewicz
2018-07-31 10:45     ` Bartlomiej Zolnierkiewicz
2018-07-31 15:38   ` Steven Rostedt
2018-07-31 15:38     ` Steven Rostedt
2018-07-19 10:16 ` [PATCH v3 2/2] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set Thomas Zimmermann
2018-07-19 10:16   ` Thomas Zimmermann
2018-07-20  9:10   ` Petr Mladek
2018-07-20  9:10     ` Petr Mladek
2018-07-31 10:45   ` Bartlomiej Zolnierkiewicz
2018-07-31 10:45     ` Bartlomiej Zolnierkiewicz
2018-07-19 11:45 ` [PATCH v3 0/2] " Hans de Goede
2018-07-19 11:45   ` Hans de Goede
2018-07-19 11:46 ` Hans de Goede
2018-07-20 12:08 ` Sergey Senozhatsky
2018-07-20 12:08   ` Sergey Senozhatsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.