Skip to contentSkip to conversation

netconsole: add oops_only module option

PATCH In review Cong Wang 3 participants 4 messages Nov 8, 2012 – Nov 9, 2012

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 netconsole: add oops_only module option

Some people wants to log only oops messages via netconsole, (this is also why netoops was invented)
so add a module option for netconsole. This can be tuned via /sys/module/netconsole/parameters/oops_only at run time as well.

Cc David Miller <[email protected]>

---

drivers/net/netconsole.c +6 -0
index b332112..6989ebe 100644
@@ -56,6 +56,10 @@ static char config[MAX_PARAM_LENGTH];
 module_param_string(netconsole, config, MAX_PARAM_LENGTH, 0);
 MODULE_PARM_DESC(netconsole, " netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr]");
 
+static bool oops_only = false;
+module_param(oops_only, bool, 0600);
+MODULE_PARM_DESC(oops_only, "Only log oops messages");
+
 #ifndef	MODULE
 static int __init option_setup(char *opt)
 {
@@ -683,6 +687,8 @@ static void write_msg(struct console *con, const char *msg, unsigned int len)
 	struct netconsole_target *nt;
 	const char *tmp;
 
+	if (oops_only && !oops_in_progress)
+		return;
 	/* Avoid taking lock and disabling interrupts unnecessarily */
 	if (list_empty(&target_list))
 		return;
#1 lore raw
Quoted 6 lines · Cong Wang

Some people wants to log only oops messages via netconsole, (this is also why netoops was invented)
so add a module option for netconsole. This can be tuned via /sys/module/netconsole/parameters/oops_only at run time as well.

Hi,

What does this do with panics?
Do they set oops_in_progress?

thanks.

Quoted 29 lines
Cc David Miller <[email protected]>

---

drivers/net/netconsole.c +6 -1
index b332112..6989ebe 100644
@@ -56,6 +56,10 @@ static char config[MAX_PARAM_LENGTH];
 module_param_string(netconsole, config, MAX_PARAM_LENGTH, 0);
 MODULE_PARM_DESC(netconsole, " netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr]");
 
+static bool oops_only = false;
+module_param(oops_only, bool, 0600);
+MODULE_PARM_DESC(oops_only, "Only log oops messages");
+
 #ifndef	MODULE
 static int __init option_setup(char *opt)
 {
@@ -683,6 +687,8 @@ static void write_msg(struct console *con, const char *msg, unsigned int len)
 	struct netconsole_target *nt;
 	const char *tmp;
 
+	if (oops_only && !oops_in_progress)
+		return;
 	/* Avoid taking lock and disabling interrupts unnecessarily */
 	if (list_empty(&target_list))
 		return;
--
Signature · 1 line
~Randy
author
#2 lore raw
Quoted 10 lines · Randy Dunlap
Quoted 6 lines · Cong Wang

Some people wants to log only oops messages via netconsole, (this is also why netoops was invented)
so add a module option for netconsole. This can be tuned via /sys/module/netconsole/parameters/oops_only at run time as well.

Quoted 4 lines

Hi,

What does this do with panics?
Do they set oops_in_progress?

Yes, panic() calls bust_spinlocks(1).

maintainer
#3 lore raw
In reply to Cong Wang

From: Cong Wang <[email protected]>
Date: Thu, 8 Nov 2012 21:42:38 +0800

Quoted 8 lines

Some people wants to log only oops messages via netconsole, (this is also why netoops was invented)
so add a module option for netconsole. This can be tuned via /sys/module/netconsole/parameters/oops_only at run time as well.

Cc David Miller <[email protected]>

Seems reasonable, applied, thanks.