From patchwork Thu Nov 8 13:42:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amerigo Wang X-Patchwork-Id: 197837 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3A3612C0147 for ; Fri, 9 Nov 2012 00:43:06 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755624Ab2KHNnE (ORCPT ); Thu, 8 Nov 2012 08:43:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7733 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755582Ab2KHNnC (ORCPT ); Thu, 8 Nov 2012 08:43:02 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qA8Dh0QD026347 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 Nov 2012 08:43:00 -0500 Received: from cr0.redhat.com (vpn-246-235.nrt.redhat.com [10.64.246.235]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qA8DgwoC026078; Thu, 8 Nov 2012 08:42:59 -0500 From: Cong Wang To: netdev@vger.kernel.org Cc: David Miller , Cong Wang Subject: [PATCH net-next] netconsole: add oops_only module option Date: Thu, 8 Nov 2012 21:42:38 +0800 Message-Id: <1352382158-3928-1-git-send-email-amwang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Signed-off-by: Cong Wang --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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-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;