lkml.org 
[lkml]   [2019]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/4] bug: use the aural error reporting framework to report warnings
Date
Use the new aural error reporting framework to signal kernel bugs. Emit the
sound at the end of the __warn(), so the WARN_* are all covered.
If panic_on_warn is set, panic() will play its sound and never return,
so there is no risk to emit two sounds or the wrong one.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
---
kernel/panic.c | 18 ++++++++++++++++++
lib/Kconfig.debug | 10 ++++++++++
2 files changed, 28 insertions(+)

diff --git a/kernel/panic.c b/kernel/panic.c
index 360578e092e7..b87c4403924d 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -81,6 +81,22 @@ static struct note panic_sound[] = {
};
#endif

+#ifdef CONFIG_AUDIBLE_WARN
+static struct note warn_sound[] = {
+ { 440, 400 },
+ { 440, 300 },
+ { 440, 100 },
+ { 440, 400 },
+ { 523, 300 },
+ { 494, 100 },
+ { 494, 300 },
+ { 440, 100 },
+ { 440, 300 },
+ { 440, 100 },
+ { 440, 800 },
+};
+#endif
+
static long no_blink(int state)
{
return 0;
@@ -609,6 +625,8 @@ void __warn(const char *file, int line, void *caller, unsigned taint,

/* Just a warning, don't kill lockdep. */
add_taint(taint, LOCKDEP_STILL_OK);
+
+ play(warn_sound, ARRAY_SIZE(warn_sound));
}

#ifdef WANT_WARN_ON_SLOWPATH
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index e5d187dfc74a..909c271d283b 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1007,6 +1007,16 @@ config AUDIBLE_PANIC
the system buzzer and not via any soundcard.
Not available on all platforms.

+config AUDIBLE_WARN
+ bool "Aural warning"
+ select PLAY_LIB
+ default n
+ help
+ If you say Y here, warnings will play a sound just
+ after the stacktrace and registers dump. The sound is played via
+ the system buzzer and not via any soundcard.
+ Not available on all platforms.
+
config SCHED_DEBUG
bool "Collect scheduler debugging info"
depends on DEBUG_KERNEL && PROC_FS
--
2.20.1
\
 
 \ /
  Last update: 2019-04-01 12:26    [W:0.078 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site