From aquatique@rusunix.org  Tue Aug 23 02:38:23 2005
Return-Path: <aquatique@rusunix.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id F214116A41F;
	Tue, 23 Aug 2005 02:38:22 +0000 (GMT)
	(envelope-from aquatique@rusunix.org)
Received: from rusunix.org (rusunix.org [212.118.165.104])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 9DD4943D48;
	Tue, 23 Aug 2005 02:38:20 +0000 (GMT)
	(envelope-from aquatique@rusunix.org)
Received: by rusunix.org (Postfix, from userid 1111)
	id B0F3922802E; Tue, 23 Aug 2005 04:35:54 +0200 (CEST)
Message-Id: <20050823023554.B0F3922802E@rusunix.org>
Date: Tue, 23 Aug 2005 04:35:54 +0200 (CEST)
From: Evgueni V. Gavrilov <aquatique@rusunix.org>
Reply-To: Evgueni V. Gavrilov <aquatique@rusunix.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: wpaul@FreeBSD.org, glebius@FreeBSD.org, freebsd-current@FreeBSD.org, freebsd-net@FreeBSD.org
Subject: assigning an address to ng_fec(4) iface causes panic
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         85239
>Category:       kern
>Synopsis:       assigning an address to ng_fec(4) iface causes panic
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 23 02:40:16 GMT 2005
>Closed-Date:    Mon Aug 29 16:33:38 GMT 2005
>Last-Modified:  Mon Aug 29 16:33:38 GMT 2005
>Originator:     Evgueni V. Gavrilov
>Release:        FreeBSD 6.0-BETA3 i386
>Organization:
rusunix.org
>Environment:
System: FreeBSD blackbird.opsb 6.0-BETA3 FreeBSD 6.0-BETA2 #0: Sun Aug 22 14:42:49 OMSST 2005     root@blackbird.opsb:/usr/obj/usr/src/sys/BLACKBIRD6  i386

>Description:
	assigning an address to ng_fec(4) iface causes panic
	during dumping to dumpdev another panic occurs preventing to identify the source of the first panic and having the crash dump

	ng_iface creation sequence:
	mkpeer fec dummy fec
	msg fec0: add_iface "em0"
	msg fec0: add_iface "em1"
	msg fec0: set_mode_mac

>How-To-Repeat:
	create ng_fec node/iface, assign an address to it
>Fix:
	wish I knew...

>Release-Note:
>Audit-Trail:

From: "Evgueni V. Gavrilov" <aquatique@rusunix.org>
To: bug-followup@FreeBSD.org,
	Maksim Yevmenkin <maksim.yevmenkin@gmail.com>,
	Brooks Davis <brooks@one-eyed-alien.net>
Cc:  
Subject: Re: kern/85239: assigning an address to ng_fec(4) iface causes panic
Date: Wed, 24 Aug 2005 12:47:27 +0700

 Thanks for response.
 
 I've applied Maksim's patch (with some modifications since 6.0-BETA3 
 holds ng_fec.c 1.18, not 1.20)
 
 The short response: it works finally :)
 
 But assigning an address to fec iface being down causes frezze, so I 
 made following startup:
 
 $ cat /etc/fec0
 mkpeer fec dummy fec
 msg fec0: add_iface "em0"
 msg fec0: add_iface "em1"
 msg fec0: set_mode_mac
 
 $ cat /etc/start_if.fec0
 #!/bin/sh
 echo "=============================="
 echo "==   Giga Channel startup   =="
 /usr/sbin/ngctl -f /etc/fec0 && echo "==   fec0 node created      =="
 /sbin/ifconfig fec0 up && echo "==   fec0 brought up        =="
 echo "==   sleeping for 20 secs   =="
 echo "==   (let GigaChannel up)   =="
 sleep 20
 echo "=============================="
 
 This way ng_fec works with some minor issues at startup: after assigning 
 an address both ports in the bundle (em0 && em1) go down, than in 
 several seconds they do go up and down again, and finally both ports in 
 the bundle go up :)
 
 Aug 24 12:22:01 <kern.crit> blackbird kernel: fec0: port em0 in bundle 
 is down
 Aug 24 12:22:01 <kern.crit> blackbird kernel: fec0: port em1 in bundle 
 is down
 Aug 24 12:22:03 <kern.notice> blackbird kernel: em0: link state changed 
 to UP
 Aug 24 12:22:03 <kern.notice> blackbird kernel: em1: link state changed 
 to UP
 Aug 24 12:28:15 <kern.crit> blackbird kernel: fec0: port em0 in bundle 
 is down
 Aug 24 12:28:15 <kern.crit> blackbird kernel: fec0: port em1 in bundle 
 is down
 Aug 24 12:28:15 <kern.crit> blackbird kernel: fec0: port em0 in bundle is up
 Aug 24 12:28:15 <kern.crit> blackbird kernel: fec0: port em1 in bundle is up
 Aug 24 12:28:16 <kern.crit> blackbird kernel: fec0: port em0 in bundle 
 is down
 Aug 24 12:28:16 <kern.crit> blackbird kernel: fec0: port em1 in bundle 
 is down
 Aug 24 12:28:18 <kern.crit> blackbird kernel: fec0: port em0 in bundle is up
 Aug 24 12:28:19 <kern.crit> blackbird kernel: fec0: port em1 in bundle is up
 
 $ ifconfig -a
 em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
          options=b<RXCSUM,TXCSUM,VLAN_MTU>
          ether 00:07:e9:05:a4:28
          media: Ethernet autoselect (1000baseTX <full-duplex>)
          status: active
 em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
          options=b<RXCSUM,TXCSUM,VLAN_MTU>
          ether 00:07:e9:05:a4:28
          media: Ethernet autoselect (1000baseTX <full-duplex>)
          status: active
 pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33208
 lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
          inet 127.0.0.1 netmask 0xff000000
 fec0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
          inet 172.16.0.127 netmask 0xffff0000 broadcast 172.16.255.255
          ether 00:07:e9:05:a4:28
          media: Ethernet none
          status: active
 
 # netstat -hi
 Name    Mtu Network       Address              Ipkts Ierrs    Opkts 
 Oerrs  Coll
 em0    1500 <Link#1>      00:07:e9:05:a4:28      23K     0     1.9K 
 0     0
 em1    1500 <Link#2>      00:07:e9:05:a4:28     2.2K     0      19K 
 0     0
 pflog 33208 <Link#3>                               0     0        0 
 0     0
 lo0   16384 <Link#4>                             255     0      255 
 0     0
 lo0   16384 your-net      localhost              255     -      255 
 -     -
 fec0   1500 <Link#5>      00:07:e9:05:a4:28      25K     3      21K 
 0     0
 fec0   1500 172.16        blackbird              21K     -      22K 
 -     -
 
 Uptime is 20 minutes.
 
 Thanks for you time. I think people would appreciate having this fix 
 within RELENG_6 berfore release time :)

From: "Evgueni V. Gavrilov" <aquatique@rusunix.org>
To: bug-followup@FreeBSD.org
Cc: Brooks Davis <brooks@one-eyed-alien.net>,
	Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
Subject: Re: kern/85239: assigning an address to ng_fec(4) iface causes panic
Date: Wed, 24 Aug 2005 14:33:13 +0700

 I performed some tests on ng_fec(4) iface (high-rate transfers etc) and 
 got no errors. With 2 em(4) nodes in the bundle I've got about 600Mbit 
 transfer rate. System uptime is 2 hours.

From: Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
To: "Evgueni V. Gavrilov" <aquatique@rusunix.org>
Cc: bug-followup@freebsd.org, Brooks Davis <brooks@one-eyed-alien.net>
Subject: Re: kern/85239: assigning an address to ng_fec(4) iface causes panic
Date: Wed, 24 Aug 2005 09:27:21 -0700

 Evgueni,
 
 > I've applied Maksim's patch (with some modifications since 6.0-BETA3
 > holds ng_fec.c 1.18, not 1.20)
 
 ok. just to verify, you have applied the second patch? right? as
 Brooks pointed out the first patch did not make required change in
 ng_fec_ioctl() (call to ng_fec_init() was still using ifp pointer
 instead of priv pointer).
 
 > The short response: it works finally :)
 >=20
 > But assigning an address to fec iface being down causes frezze, so I
 > made following startup:
 
 i can not reproduce the freeze here :( i did simple test (below).
 unfortunately i do not have hardware to recreate your setup here :(
 
 can you drop into the debugger (ctrl+alt+esc) and try to get a stack
 trace? if you can not - could you please try to put some printf's into
 /sys/netgraph/ng_fec.c to see where it locks up?
 
 beetle# uname -a
 FreeBSD beetle.digisle.com 7.0-CURRENT FreeBSD 7.0-CURRENT #31: Tue
 Aug  9 15:51:44 PDT 2005   =20
 max@beetle.digisle.com:/usr/obj/usr/src/sys/GENERIC  i386
 
 beetle# ifconfig fec0
 fec0: flags=3D8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
         inet6 fe80::211:43ff:fe54:22c9%fec0 prefixlen 64 scopeid 0x4=20
         ether 00:00:00:00:00:00
         media: Ethernet none
         status: no carrier
 
 beetle# ifconfig fec0 inet 192.168.1.1 netmask 255.255.255.0
 beetle# ifconfig fec0
 fec0: flags=3D8803<UP,BROADCAST,SIMPLEX,MULTICAST> mtu 1500
         inet6 fe80::211:43ff:fe54:22c9%fec0 prefixlen 64 scopeid 0x4=20
         inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
         ether 00:00:00:00:00:00
         media: Ethernet none
         status: no carrier
 
 beetle# ifconfig fec0 down
 beetle# ifconfig fec0
 fec0: flags=3D8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
         inet6 fe80::211:43ff:fe54:22c9%fec0 prefixlen 64 scopeid 0x4=20
         inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
         ether 00:00:00:00:00:00
         media: Ethernet none
         status: no carrier
 
 beetle# ifconfig fec0 delete
 beetle# ifconfig fec0=20
 fec0: flags=3D8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
         inet6 fe80::211:43ff:fe54:22c9%fec0 prefixlen 64 scopeid 0x4=20
         ether 00:00:00:00:00:00
         media: Ethernet none
         status: no carrier
 
 thanks,
 max

From: "Evgueni V. Gavrilov" <aquatique@rusunix.org>
To: Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
Cc: bug-followup@freebsd.org, Brooks Davis <brooks@one-eyed-alien.net>
Subject: Re: kern/85239: assigning an address to ng_fec(4) iface causes panic
Date: Thu, 25 Aug 2005 08:34:53 +0700

 Maksim Yevmenkin wrote:
 
 >>I've applied Maksim's patch (with some modifications since 6.0-BETA3
 >>holds ng_fec.c 1.18, not 1.20)
 > 
 > ok. just to verify, you have applied the second patch? right? as
 > Brooks pointed out the first patch did not make required change in
 > ng_fec_ioctl() (call to ng_fec_init() was still using ifp pointer
 > instead of priv pointer).
 yes, of course
 slight modifications used because I've got the trouble with 6.0-BETA3, 
 not -CURRENT
 
 http://aquatique.rusunix.org/20050824.ng_fec.c.patch
 this is the patch I've applied
 
 >>The short response: it works finally :)
 >>
 >>But assigning an address to fec iface being down causes frezze, so I
 >>made following startup:
 > 
 > i can not reproduce the freeze here :( i did simple test (below).
 > unfortunately i do not have hardware to recreate your setup here :(
 I suppose that in order to reproduce this issue you need to configure 
 Fast (Ether|Giga)Channel on switch ports too. I agree that it's not 
 always possible.
 
 > can you drop into the debugger (ctrl+alt+esc) and try to get a stack
 > trace? if you can not - could you please try to put some printf's into
 > /sys/netgraph/ng_fec.c to see where it locks up?
 I'll try to inviestigate this upon next scheduled downtime for this 
 machine. Unfortunately I can't put it down for a long time (that's the 
 reason of using ng_fec(4) on that machine: high availability).
 
 > beetle# ifconfig fec0 inet 192.168.1.1 netmask 255.255.255.0
 > beetle# ifconfig fec0
 > fec0: flags=8803<UP,BROADCAST,SIMPLEX,MULTICAST> mtu 1500
 >         inet6 fe80::211:43ff:fe54:22c9%fec0 prefixlen 64 scopeid 0x4 
 >         inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
 >         ether 00:00:00:00:00:00
 >         media: Ethernet none
 >         status: no carrier
 I suppose the issue is apparent only using several interfaces in the 
 ng_fec(4) bundle with Fast (Ether|Giga)Channel configured on switch ports.
State-Changed-From-To: open->closed 
State-Changed-By: emax 
State-Changed-When: Mon Aug 29 16:32:30 GMT 2005 
State-Changed-Why:  
Fix was committed to the HEAD, RELENG_6 and RELENG_5 branches. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=85239 
>Unformatted:
