rpms/kernel/F-9 linux-2.6-net-print-module-name-as-part-of-the-message.patch, NONE, 1.1 linux-2.6-warn-Turn-the-netdev-timeout-WARN_ON-into-WARN.patch, NONE, 1.1 kernel.spec, 1.774, 1.775

Chuck Ebbert cebbert at fedoraproject.org
Mon Sep 29 14:40:58 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14165

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-net-print-module-name-as-part-of-the-message.patch 
	linux-2.6-warn-Turn-the-netdev-timeout-WARN_ON-into-WARN.patch 
Log Message:
Two patches to help make kerneloops bug reports more useful.
  (requested by Arjan)

linux-2.6-net-print-module-name-as-part-of-the-message.patch:

--- NEW FILE linux-2.6-net-print-module-name-as-part-of-the-message.patch ---
From: Arjan van de Ven <arjan at linux.intel.com>
Date: Mon, 21 Jul 2008 20:31:48 +0000 (-0700)
Subject: net: Print the module name as part of the watchdog message
X-Git-Tag: v2.6.27-rc1~860^2~20
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=6579e57b31d79d31d9b806e41ba48774e73257dc

net: Print the module name as part of the watchdog message

As suggested by Dave:

This patch adds a function to get the driver name from a struct net_device,
and consequently uses this in the watchdog timeout handler to print as
part of the message.

Signed-off-by: Arjan van de Ven <arjan at linux.intel.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
Backport: Chuck Ebbert <cebbert at redhat.com>
---

Index: linux-2.6.26.noarch/include/linux/netdevice.h
===================================================================
--- linux-2.6.26.noarch.orig/include/linux/netdevice.h
+++ linux-2.6.26.noarch/include/linux/netdevice.h
@@ -1509,6 +1509,8 @@ extern void *dev_seq_next(struct seq_fil
 extern void dev_seq_stop(struct seq_file *seq, void *v);
 #endif
 
+extern char *netdev_drivername(struct net_device *dev, char *buffer, int len);
+
 extern void linkwatch_run_queue(void);
 
 extern int netdev_compute_features(unsigned long all, unsigned long one);
Index: linux-2.6.26.noarch/net/core/dev.c
===================================================================
--- linux-2.6.26.noarch.orig/net/core/dev.c
+++ linux-2.6.26.noarch/net/core/dev.c
@@ -4489,6 +4489,26 @@ err_name:
 	return -ENOMEM;
 }
 
+char *netdev_drivername(struct net_device *dev, char *buffer, int len)
+{
+	struct device_driver *driver;
+	struct device *parent;
+
+	if (len <= 0 || !buffer)
+		return buffer;
+	buffer[0] = 0;
+
+	parent = dev->dev.parent;
+
+	if (!parent)
+		return buffer;
+
+	driver = parent->driver;
+	if (driver && driver->name)
+		strlcpy(buffer, driver->name, len);
+	return buffer;
+}
+
 static void __net_exit netdev_exit(struct net *net)
 {
 	kfree(net->dev_name_head);
Index: linux-2.6.26.noarch/net/sched/sch_generic.c
===================================================================
--- linux-2.6.26.noarch.orig/net/sched/sch_generic.c
+++ linux-2.6.26.noarch/net/sched/sch_generic.c
@@ -215,9 +215,9 @@ static void dev_watchdog(unsigned long a
 		    netif_carrier_ok(dev)) {
 			if (netif_queue_stopped(dev) &&
 			    time_after(jiffies, dev->trans_start + dev->watchdog_timeo)) {
-
-				printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n",
-				       dev->name);
+				char drivername[64];
+				printk(KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n",
+				       dev->name, netdev_drivername(dev, drivername, 64));
 				dev->tx_timeout(dev);
 				WARN_ON_ONCE(1);
 			}

linux-2.6-warn-Turn-the-netdev-timeout-WARN_ON-into-WARN.patch:

--- NEW FILE linux-2.6-warn-Turn-the-netdev-timeout-WARN_ON-into-WARN.patch ---
From: Arjan van de Ven <arjan at linux.intel.com>
Date: Mon, 15 Sep 2008 23:43:18 +0000 (-0700)
Subject: warn: Turn the netdev timeout WARN_ON() into a WARN()
X-Git-Tag: v2.6.27-rc7~19
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=45e9c0de

warn: Turn the netdev timeout WARN_ON() into a WARN()

this patch turns the netdev timeout WARN_ON_ONCE() into a WARN_ONCE(),
so that the device and driver names are inside the warning message.
This helps automated tools like kerneloops.org to collect the data
and do statistics, as well as making it more likely that humans
cut-n-paste the important message as part of a bugreport.

Signed-off-by: Arjan van de Ven <arjan at linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
Backport: Chuck Ebbert <cebbert at redhat.com>
---

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index a3f738c..edc6ba8 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -75,6 +75,16 @@ extern void warn_slowpath(const char *file, const int line,
 	unlikely(__ret_warn_once);				\
 })
 
+#define WARN_ONCE(condition, format...)	({			\
+	static int __warned;					\
+	int __ret_warn_once = !!(condition);			\
+								\
+	if (unlikely(__ret_warn_once))				\
+		if (WARN(!__warned, format)) 			\
+			__warned = 1;				\
+	unlikely(__ret_warn_once);				\
+})
+ 
 #ifdef CONFIG_SMP
 # define WARN_ON_SMP(x)			WARN_ON(x)
 #else
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 9634091..ec0a083 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -216,10 +216,9 @@ static void dev_watchdog(unsigned long arg)
 			if (netif_queue_stopped(dev) &&
 			    time_after(jiffies, dev->trans_start + dev->watchdog_timeo)) {
 				char drivername[64];
-				printk(KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n",
+				WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n",
 				       dev->name, netdev_drivername(dev, drivername, 64));
 				dev->tx_timeout(dev);
-				WARN_ON_ONCE(1);
 			}
 			if (!mod_timer(&dev->watchdog_timer, round_jiffies(jiffies + dev->watchdog_timeo)))
 				dev_hold(dev);
		}


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/kernel.spec,v
retrieving revision 1.774
retrieving revision 1.775
diff -u -r1.774 -r1.775
--- kernel.spec	23 Sep 2008 17:32:24 -0000	1.774
+++ kernel.spec	29 Sep 2008 14:40:27 -0000	1.775
@@ -703,6 +703,10 @@
 Patch2700: linux-2.6-intel-msr-backport.patch
 Patch2701: linux-2.6-libata-sff-kill-spurious-WARN_ON-in-ata_hsm_move.patch
 Patch2703: linux-2.6-pcmcia-fix-broken-abuse-of-dev-driver_data.patch
+
+# for kerneloops reports
+Patch2800: linux-2.6-net-print-module-name-as-part-of-the-message.patch
+Patch2801: linux-2.6-warn-Turn-the-netdev-timeout-WARN_ON-into-WARN.patch
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1301,7 +1305,10 @@
 ApplyPatch linux-2.6-libata-sff-kill-spurious-WARN_ON-in-ata_hsm_move.patch
 # fix subtle but annoying PCMCIA bug
 ApplyPatch linux-2.6-pcmcia-fix-broken-abuse-of-dev-driver_data.patch
-# ---------- below all scheduled for 2.6.24 -----------------
+
+# for kerneloops reports
+ApplyPatch linux-2.6-net-print-module-name-as-part-of-the-message.patch
+ApplyPatch linux-2.6-warn-Turn-the-netdev-timeout-WARN_ON-into-WARN.patch
 
 # END OF PATCH APPLICATIONS
 
@@ -1892,6 +1899,10 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Mon Sep 29 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.5-48
+- Two patches to help make kerneloops bug reports more useful.
+  (requested by Arjan)
+
 * Tue Sep 23 2008 Kyle McMartin <kyle at redhat.com> 2.6.26.5-47
 - two more wireless fixes from John
    p54: Fix regression due to "net: Delete NETDEVICES_MULTIQUEUE kconfig option




More information about the fedora-extras-commits mailing list