public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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 4/4] oops: use the aural error reporting framework to report oopses
Date: Mon,  1 Apr 2019 12:24:55 +0200	[thread overview]
Message-ID: <20190401102456.11162-5-mcroce@redhat.com> (raw)
In-Reply-To: <20190401102456.11162-1-mcroce@redhat.com>

Use the new aural error reporting framework when reporting an oops. The
sound is emitted at the end of oops_exit(), to avoid interfering with other
oops actions, like stack dump.

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 b87c4403924d..ea34f93ce410 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -97,6 +97,23 @@ static struct note warn_sound[] = {
 };
 #endif
 
+#ifdef CONFIG_AUDIBLE_OOPS
+static struct note oops_sound[] = {
+	{ 494, 100 },
+	{ 698, 100 },
+	{   0, 100 },
+	{ 698, 100 },
+	{ 698, 133 },
+	{ 659, 133 },
+	{ 587, 133 },
+	{ 523, 100 },
+	{ 330, 100 },
+	{ 262, 100 },
+	{ 330, 100 },
+	{ 262, 100 },
+};
+#endif
+
 static long no_blink(int state)
 {
 	return 0;
@@ -575,6 +592,7 @@ void oops_exit(void)
 	do_oops_enter_exit();
 	print_oops_end_marker();
 	kmsg_dump(KMSG_DUMP_OOPS);
+	play(oops_sound, ARRAY_SIZE(oops_sound));
 }
 
 struct warn_args {
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 909c271d283b..74745ef386ce 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1017,6 +1017,16 @@ config AUDIBLE_WARN
 	  the system buzzer and not via any soundcard.
 	  Not available on all platforms.
 
+config AUDIBLE_OOPS
+	bool "Aural oops"
+	select PLAY_LIB
+	default n
+	help
+	  If you say Y here, oops 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


  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 ` [PATCH 2/4] panic: use the aural error reporting framework to report panics Matteo Croce
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 ` Matteo Croce [this message]
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-5-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