From: Matteo Croce <mcroce@redhat.com>
To: x86@kernel.org, LKML <linux-kernel@vger.kernel.org>,
linux-sound@vger.kernel.org, platform-driver-x86@vger.kernel.org
Subject: [PATCH 2/4] panic: use the aural error reporting framework to report panics
Date: Mon, 1 Apr 2019 12:24:53 +0200 [thread overview]
Message-ID: <20190401102456.11162-3-mcroce@redhat.com> (raw)
In-Reply-To: <20190401102456.11162-1-mcroce@redhat.com>
Use the new aural error reporting framework to signal kernel panic. The
error sound is emitted between the stack dump and the kexec jump.
Signed-off-by: Matteo Croce <mcroce@redhat.com>
---
kernel/panic.c | 25 +++++++++++++++++++++++++
lib/Kconfig.debug | 10 ++++++++++
2 files changed, 35 insertions(+)
diff --git a/kernel/panic.c b/kernel/panic.c
index 0ae0d7332f12..360578e092e7 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -29,6 +29,7 @@
#include <linux/bug.h>
#include <linux/ratelimit.h>
#include <linux/debugfs.h>
+#include <linux/play.h>
#include <asm/sections.h>
#define PANIC_TIMER_STEP 100
@@ -57,6 +58,29 @@ ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
EXPORT_SYMBOL(panic_notifier_list);
+#ifdef CONFIG_AUDIBLE_PANIC
+static struct note panic_sound[] = {
+ { 784, 400 },
+ { 784, 400 },
+ { 784, 400 },
+ { 622, 300 },
+ { 932, 100 },
+ { 784, 400 },
+ { 622, 300 },
+ { 932, 100 },
+ { 784, 800 },
+ { 1174, 400 },
+ { 1174, 400 },
+ { 1174, 400 },
+ { 1244, 300 },
+ { 932, 100 },
+ { 740, 400 },
+ { 622, 300 },
+ { 932, 100 },
+ { 784, 800 },
+};
+#endif
+
static long no_blink(int state)
{
return 0;
@@ -213,6 +237,7 @@ void panic(const char *fmt, ...)
if (!test_taint(TAINT_DIE) && oops_in_progress <= 1)
dump_stack();
#endif
+ play(panic_sound, ARRAY_SIZE(panic_sound));
/*
* If we have crashed and we have a crash kernel loaded let it handle
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 10d04b266aef..e5d187dfc74a 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -997,6 +997,16 @@ config PLAY_LIB
depends on HAVE_PCSPKR_PLATFORM
default n
+config AUDIBLE_PANIC
+ bool "Aural panic"
+ select PLAY_LIB
+ default n
+ help
+ If you say Y here, kernel panics 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
next prev parent reply other threads:[~2019-04-01 10:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-01 10:24 [PATCH 0/4] Introduce the aural error reporting framework Matteo Croce
2019-04-01 10:24 ` [PATCH 1/4] " Matteo Croce
2019-04-01 10:24 ` Matteo Croce [this message]
2019-04-01 10:24 ` [PATCH 3/4] bug: use the aural error reporting framework to report warnings Matteo Croce
2019-04-01 10:24 ` [PATCH 4/4] oops: use the aural error reporting framework to report oopses Matteo Croce
2019-04-01 10:24 ` [PATCH 5/4] procfs: utility handler to trigger different errors Matteo Croce
2019-04-01 11:03 ` [PATCH 0/4] Introduce the aural error reporting framework Peter Zijlstra
2019-04-02 8:49 ` Thomas Gleixner
2019-04-02 11:50 ` Matteo Croce
2019-04-02 13:21 ` Thomas Gleixner
2019-04-01 13:45 ` Emiliano Russo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190401102456.11162-3-mcroce@redhat.com \
--to=mcroce@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).