netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] netconsole: add oops_only module option
@ 2012-11-08 13:42 Cong Wang
  2012-11-08 19:49 ` Randy Dunlap
  2012-11-09  3:07 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Cong Wang @ 2012-11-08 13:42 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, 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.

Cc: David Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>

---
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index b332112..6989ebe 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -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;

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

* Re: [PATCH net-next] netconsole: add oops_only module option
  2012-11-08 13:42 [PATCH net-next] netconsole: add oops_only module option Cong Wang
@ 2012-11-08 19:49 ` Randy Dunlap
  2012-11-09  3:02   ` Cong Wang
  2012-11-09  3:07 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2012-11-08 19:49 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, David Miller

On 11/08/2012 05:42 AM, Cong Wang wrote:

> 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.

> Cc: David Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <amwang@redhat.com>
> 
> ---
> diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
> index b332112..6989ebe 100644
> --- a/drivers/net/netconsole.c
> +++ b/drivers/net/netconsole.c
> @@ -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;
> --


-- 
~Randy

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

* Re: [PATCH net-next] netconsole: add oops_only module option
  2012-11-08 19:49 ` Randy Dunlap
@ 2012-11-09  3:02   ` Cong Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Cong Wang @ 2012-11-09  3:02 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: netdev, David Miller

On Thu, 2012-11-08 at 11:49 -0800, Randy Dunlap wrote:
> On 11/08/2012 05:42 AM, Cong Wang wrote:
> 
> > 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?

Yes, panic() calls bust_spinlocks(1).

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

* Re: [PATCH net-next] netconsole: add oops_only module option
  2012-11-08 13:42 [PATCH net-next] netconsole: add oops_only module option Cong Wang
  2012-11-08 19:49 ` Randy Dunlap
@ 2012-11-09  3:07 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2012-11-09  3:07 UTC (permalink / raw)
  To: amwang; +Cc: netdev

From: Cong Wang <amwang@redhat.com>
Date: Thu,  8 Nov 2012 21:42:38 +0800

> 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 <davem@davemloft.net>
> Signed-off-by: Cong Wang <amwang@redhat.com>

Seems reasonable, applied, thanks.

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

end of thread, other threads:[~2012-11-09  3:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-08 13:42 [PATCH net-next] netconsole: add oops_only module option Cong Wang
2012-11-08 19:49 ` Randy Dunlap
2012-11-09  3:02   ` Cong Wang
2012-11-09  3:07 ` David Miller

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).