Netconsole debugging tool for 2.6
Subsystems (4)
RFC PATCH 1/1 Netconsole debugging tool for 2.6
Because my development box makes the room it's in uncomfortably warm, I've decided to take a stab at resurrecting Ingo's netconsole patch.
For those who missed it the first time around (for 2.4.10), this module is a "serial console over networks" which lets you catch kernel messages, oopses and so on that can't be caught by syslog.
Since I thought the biggest problem with the first version was configuration, I went ahead and wrote some reasonable option parsing and made it also work as built-in so you can now boot with:
linux [email protected]/eth1,[email protected]/12:34:56:78:9a:bc
or just
linux [email protected]/,@10.0.0.2/
I've also added support for a third NIC (TLAN). Accepting patches for other cards (only about 10 lines of code each).
Issues:
Probably better ways to handle device locking these days SMP-safe?
Would like to get logging up much earlier in the boot process Need support for more cards
Documentation/networking/netlogging.txt +54 -0
@@ -0,0 +1,54 @@ + +started by Ingo Molnar <[email protected]>, 2001.09.17 +2.6 port by Matt Mackall <[email protected]>, 2003.08.11 + +This module logs kernel printk messages over UDP allowing debugging of +problem where disk logging fails and serial consoles are impractical. + +It can be used either built-in or as a module. It takes a string +configuration parameter "netconsole" in the following format: + + netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr] + + where + src-port source for UDP packets (defaults to 6666) + src-ip source IP to use (interface address) + dev network interface (eth0) + tgt-port port for logging agent (6666) + tgt-ip IP address for logging agent + tgt-macaddr ethernet MAC address for logging agent (broadcast) + +Examples: + + linux [email protected]/eth1,[email protected]/12:34:56:78:9a:bc + + or + + insmod netconsole netconsole=@/,@10.0.0.2/ + +If the module is loaded then all kernel messages are sent to the +target host via UDP packets. The remote host should run the +client-side 'netconsole' daemon to display & log the messages. +Alternately, netcat can be used in a pinch. + +WARNING: the default target ethernet setting uses the broadcast +ethernet address to send packets, which can cause increased load on +other systems on the same ethernet segment. + +NOTE: the network device (eth0 in the above case) can run any kind +of other network traffic, netconsole is not intrusive. Netconsole +might cause slight delays in other traffic if the volume of kernel +messages is high, but should have no other impact. + +Netconsole was designed to be as instantaneous as possible, to +enable the logging of even the most critical kernel bugs. It works +from IRQ contexts as well, and does not enable interrupts while +sending packets. Due to these unique needs, configuration can not +be more automatic, and some fundamental limitations will remain: +only IP networks, UDP packets and ethernet devices are supported. + +Currently supported network drivers: + + eepro100 + tulip + tlan
drivers/net/Kconfig +8 -0
@@ -2711,3 +2711,11 @@ source "drivers/atm/Kconfig" source "drivers/s390/net/Kconfig" + +config NETCONSOLE + tristate "Network console logging support" + depends on NETDEVICES + ---help--- + If you want to log kernel messages over the network, then say + "M" here. See Documentation/networking/netlogging.txt for details. +
drivers/net/Makefile +2 -0
@@ -56,6 +56,8 @@ obj-$(CONFIG_VIA_RHINE) += via-rhine.o mii.o obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o mii.o +obj-$(CONFIG_NETCONSOLE) += netconsole.o + # # end link order section #
drivers/net/eepro100.c +21 -0
@@ -543,6 +543,7 @@static int speedo_rx (struct net_device *dev);static void speedo_tx_buffer_gc (struct net_device *dev);static irqreturn_t speedo_interrupt (int irq,void *dev_instance,struct pt_regs *regs); +static void poll_speedo (struct net_device *dev);static int speedo_close (struct net_device *dev);static struct net_device_stats *speedo_get_stats (struct net_device *dev);static int speedo_ioctl (struct net_device *dev,struct ifreq *rq,int cmd);
@@ -885,6 +886,9 @@ dev->get_stats = &speedo_get_stats; dev->set_multicast_list = &set_rx_mode; dev->do_ioctl = &speedo_ioctl; +#ifdef HAVE_POLL_CONTROLLER + dev->poll_controller = &poll_speedo; +#endif if (register_netdevice (dev)) goto err_free_unlock;
@@ -1675,6 +1679,23 @@return IRQ_RETVAL (handled); } +#ifdef HAVE_POLL_CONTROLLER + +/* +* Polling 'interrupt' - used by things like netconsole to send skbs +* without having to re-enable interrupts. It's not called while +* the interrupt routine is executing. +*/ + +static void poll_speedo (struct net_device *dev) +{ +disable_irq (dev->irq); +speedo_interrupt (dev->irq, dev,NULL ); +enable_irq (dev->irq); +} + +#endif +static inline struct RxFD *speedo_rx_alloc (struct net_device *dev,int entry) {struct speedo_private *sp = (struct speedo_private *)dev->priv;
drivers/net/netconsole.c +457 -0
457 lines not on this page · raw message
drivers/net/tlan.c +23 -0
@@ -296,6 +296,7 @@static int TLan_probe1 (struct pci_dev *pdev,long ioaddr,int irq,int rev,const struct pci_device_id *ent);static void TLan_tx_timeout (struct net_device *dev);static int tlan_init_one (struct pci_dev *pdev,const struct pci_device_id *ent); +static void TLan_Poll (struct net_device *dev);static u32 TLan_HandleInvalid (struct net_device *,u16 );static u32 TLan_HandleTxEOF (struct net_device *,u16 );
@@ -452,6 +453,25 @@pci_set_drvdata ( pdev,NULL ); } +#ifdef HAVE_POLL_CONTROLLER + +/* +* Polling 'interrupt' - used by things like netconsole to send skbs +* without having to re-enable interrupts. It's not called while +* the interrupt routine is executing. +*/ + +static void TLan_Poll (struct net_device *dev) +{ +disable_irq (dev->irq); +TLan_HandleInterrupt (dev->irq, dev,NULL ); +enable_irq (dev->irq); +} + +#endif + + +static struct pci_driver tlan_driver = { .name ="tlan" , .id_table = tlan_pci_tbl,
@@ -892,6 +912,9 @@ dev->do_ioctl = &TLan_ioctl; dev->tx_timeout = &TLan_tx_timeout; dev->watchdog_timeo =TX_TIMEOUT ; +#ifdef HAVE_POLL_CONTROLLER + dev->poll_controller = &TLan_Poll; +#endif return 0 ;
drivers/net/tulip/tulip_core.c +22 -0
@@ -245,6 +245,7 @@static struct net_device_stats *tulip_get_stats (struct net_device *dev);static int private_ioctl (struct net_device *dev,struct ifreq *rq,int cmd);static void set_rx_mode (struct net_device *dev); +static void poll_tulip (struct net_device *dev);
@@ -1630,6 +1631,9 @@ dev->get_stats = tulip_get_stats; dev->do_ioctl = private_ioctl; dev->set_multicast_list = set_rx_mode; +#ifdef HAVE_POLL_CONTROLLER + dev->poll_controller = &poll_tulip; +#endif if (register_netdev (dev)) goto err_out_free_ring;
@@ -1787,6 +1791,24 @@ } +#ifdef HAVE_POLL_CONTROLLER + +/* +* Polling 'interrupt' - used by things like netconsole to send skbs +* without having to re-enable interrupts. It's not called while +* the interrupt routine is executing. +*/ + +static void poll_tulip (struct net_device *dev) +{ +disable_irq (dev->irq); +tulip_interrupt (dev->irq, dev,NULL ); +enable_irq (dev->irq); +} + +#endif + +static struct pci_driver tulip_driver = { .name =DRV_NAME , .id_table = tulip_pci_tbl,
include/linux/netdevice.h +2 -0
@@ -446,6 +446,8 @@ unsigned char *haddr);int (*neigh_setup)(struct net_device *dev,struct neigh_parms *);int (*accept_fastpath)(struct net_device *,struct dst_entry *); +#define HAVE_POLL_CONTROLLER +void (*poll_controller)(struct net_device *dev);/* bridge stuff */ struct net_bridge_port *br_port;
Signature · 1 line
Matt Mackall : http://www.selenic.com : of or relating to the moon
Quoted 5 lines · Matt Mackall
I've decided to take a stab at resurrecting Ingo's netconsole patch.
For those who missed it the first time around (for 2.4.10), this module is a "serial console over networks" which lets you catch kernel messages, oopses and so on that can't be caught by syslog.
...
Quoted 2 lines
I've also added support for a third NIC (TLAN). Accepting patches for other cards (only about 10 lines of code each).
It works fine on my computer with the patch below. The only problem is that it taints the kernel because of missing module license information.
Netconsole support for the 8139too NIC.
linux-petero/Documentation/networking/netlogging.txt | 1 linux-petero/drivers/net/8139too.c | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+)
Documentation/networking/netlogging.txt renamed from Documentation/networking/netlogging.txt~netconsole-8139too +1 -0
@@ -52,3 +52,4 @@ Currently supported network drivers: eepro100 tulip tlan + 8139too
drivers/net/8139too.c renamed from drivers/net/8139too.c~netconsole-8139too +22 -0
@@ -625,6 +625,7 @@ static struct net_device_stats *rtl8139_static void rtl8139_set_rx_mode (struct net_device *dev);static void __set_rx_mode (struct net_device *dev);static void rtl8139_hw_start (struct net_device *dev); +static void poll_8139 (struct net_device *dev);#ifdef USE_IO_OPS
@@ -973,6 +974,9 @@ static int __devinit rtl8139_init_one (s dev->do_ioctl = netdev_ioctl; dev->tx_timeout = rtl8139_tx_timeout; dev->watchdog_timeo =TX_TIMEOUT ; +#ifdef HAVE_POLL_CONTROLLER + dev->poll_controller = &poll_8139; +#endif /* note: the hardware is not capable of sg/csum/highdma, however * through the use of skb_copy_and_csum_dev we enable these
@@ -2596,6 +2600,24 @@ static int rtl8139_resume (struct pci_de#endif /* CONFIG_PM */ +#ifdef HAVE_POLL_CONTROLLER + +/* +* Polling 'interrupt' - used by things like netconsole to send skbs +* without having to re-enable interrupts. It's not called while +* the interrupt routine is executing. +*/ + +static void poll_8139 (struct net_device *dev) +{ +disable_irq (dev->irq); +rtl8139_interrupt (dev->irq, dev,NULL ); +enable_irq (dev->irq); +} + +#endif + +static struct pci_driver rtl8139_pci_driver = { .name =DRV_NAME ,
_
Signature · 2 lines
Peter Osterlund - [email protected] http://w1.894.telia.com/~u89404340
Quoted 7 lines · Peter Osterlund
Quoted 5 lines · Matt Mackall
I've decided to take a stab at resurrecting Ingo's netconsole patch.
For those who missed it the first time around (for 2.4.10), this module is a "serial console over networks" which lets you catch kernel messages, oopses and so on that can't be caught by syslog.
hmm, sounds somewhat familiar, could you give
the location of the patches/tools/etc ...
Quoted 2 lines
Quoted 2 lines
I've also added support for a third NIC (TLAN). Accepting patches for other cards (only about 10 lines of code each).
hmm, which cards are (un)supported ...
(read: I'm interrested ;)
TIA,
Herbert
Quoted 76 lines
It works fine on my computer with the patch below. The only problem is that it taints the kernel because of missing module license information.
Netconsole support for the 8139too NIC.
linux-petero/Documentation/networking/netlogging.txt | 1 linux-petero/drivers/net/8139too.c | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+)diff -puN
Documentation/networking/netlogging.txt~netconsole-8139tooDocumentation/networking/netlogging.txtDocumentation/networking/netlogging.txt renamed from Documentation/networking/netlogging.txt~netconsole-8139too +1
-0@@ -52,3 +52,4 @@ Currently supported network drivers: eepro100 tulip tlan + 8139toodiff -puN
drivers/net/8139too.c~netconsole-8139toodrivers/net/8139too.cdrivers/net/8139too.c renamed from drivers/net/8139too.c~netconsole-8139too +22
-0@@ -625,6 +625,7 @@ static struct net_device_stats *rtl8139_static void rtl8139_set_rx_mode (struct net_device *dev);static void __set_rx_mode (struct net_device *dev);static void rtl8139_hw_start (struct net_device *dev); +static void poll_8139 (struct net_device *dev);#ifdef USE_IO_OPS @@ -973,6 +974,9 @@ static int __devinit rtl8139_init_one (s dev->do_ioctl = netdev_ioctl; dev->tx_timeout = rtl8139_tx_timeout; dev->watchdog_timeo =TX_TIMEOUT ; +#ifdef HAVE_POLL_CONTROLLER + dev->poll_controller = &poll_8139; +#endif /* note: the hardware is not capable of sg/csum/highdma, however * through the use of skb_copy_and_csum_dev we enable these @@ -2596,6 +2600,24 @@ static int rtl8139_resume (struct pci_de#endif /* CONFIG_PM */ +#ifdef HAVE_POLL_CONTROLLER + +/* +* Polling 'interrupt' - used by things like netconsole to send skbs +* without having to re-enable interrupts. It's not called while +* the interrupt routine is executing. +*/ + +static void poll_8139 (struct net_device *dev) +{ +disable_irq (dev->irq); +rtl8139_interrupt (dev->irq, dev,NULL ); +enable_irq (dev->irq); +} + +#endif + +static struct pci_driver rtl8139_pci_driver = { .name =DRV_NAME ,_
Signature · 7 lines
Peter Osterlund - [email protected] http://w1.894.telia.com/~u89404340 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Quoted 12 lines · Herbert Pötzl
Quoted 7 lines · Peter Osterlund
Quoted 5 lines · Matt Mackall
I've decided to take a stab at resurrecting Ingo's netconsole patch.
For those who missed it the first time around (for 2.4.10), this module is a "serial console over networks" which lets you catch kernel messages, oopses and so on that can't be caught by syslog.
hmm, sounds somewhat familiar, could you give
the location of the patches/tools/etc ...
I think it is included in -aa, so perhaps that is the most updated source.
Signature · 4 lines
J.A. Magallon <[email protected]> \ Software is like sex: werewolf.able.es \ It's better when it's free Mandrake Linux release 9.2 (Cooker) for i586 Linux 2.4.22-jam1m (gcc 3.3.1 (Mandrake Linux 9.2 3.3.1-1mdk))
On Mon, Aug 11, 2003 at 03:55:08AM -0500 or thereabouts, Matt Mackall wrote:
...
Quoted 2 lines
I've also added support for a third NIC (TLAN). Accepting patches for other cards (only about 10 lines of code each).
...
With the patch below netconsole works with the ne2k-pci driver. The patch applies on 2.6.0-test4.
Tested with my RealTek RTL-8029 card.
Are you interested on code cleanup patches etc. for netconsole too?
Steffen
drivers/net/ne2k-pci.c +22 -0
@@ -167,6 +167,7 @@ MODULE_DEVICE_TABLE(pci, ne2k_pci_tbl);static int ne2k_pci_open (struct net_device *dev);static int ne2k_pci_close (struct net_device *dev); +static void poll_ne2k_pci (struct net_device *dev);static void ne2k_pci_reset_8390 (struct net_device *dev);static void ne2k_pci_get_8390_hdr (struct net_device *dev,struct e8390_pkt_hdr *hdr,int ring_page);
@@ -362,6 +363,10 @@ static int __devinit ne2k_pci_init_one ( dev->open = &ne2k_pci_open; dev->stop = &ne2k_pci_close; dev->do_ioctl = &netdev_ioctl; +#ifdef HAVE_POLL_CONTROLLER + dev->poll_controller = &poll_ne2k_pci; +#endif +NS8390_init (dev,0 ); i =register_netdev (dev);
@@ -436,6 +441,23 @@ static void ne2k_pci_reset_8390(struct n }outb (ENISR_RESET ,NE_BASE +EN0_ISR );/* Ack intr. */ } + +#ifdef HAVE_POLL_CONTROLLER + +/* +* Polling 'interrupt' - used by things like netconsole to send skbs +* without having to re-enable interrupts. It's not called while +* the interrupt routine is executing. +*/ + +static void poll_ne2k_pci (struct net_device *dev) +{ +disable_irq (dev->irq); +ei_interrupt (dev->irq, dev,NULL ); +enable_irq (dev->irq); +} + +#endif /* Grab the 8390 specific header. Similar to the block_input routine, but we don't need to be concerned with ring wrap as the header will be at