From devet@devet.org  Sat Oct 23 12:10:51 2004
Return-Path: <devet@devet.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9C9F816A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 23 Oct 2004 12:10:51 +0000 (GMT)
Received: from a80-126-165-168.adsl.xs4all.nl (a80-126-165-168.adsl.xs4all.nl [80.126.165.168])
	by mx1.FreeBSD.org (Postfix) with ESMTP id BD82943D39
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 23 Oct 2004 12:10:50 +0000 (GMT)
	(envelope-from devet@devet.org)
Received: from adv.devet.org (adv.devet.org [192.168.1.2])
	by a80-126-165-168.adsl.xs4all.nl (Postfix) with ESMTP id B263EC990
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 23 Oct 2004 14:10:49 +0200 (CEST)
Received: by adv.devet.org (Postfix, from userid 100)
	id A20631938D; Sat, 23 Oct 2004 14:10:49 +0200 (CEST)
Message-Id: <20041023121049.A20631938D@adv.devet.org>
Date: Sat, 23 Oct 2004 14:10:49 +0200 (CEST)
From: Arjan de Vet <devet@devet.org>
Reply-To: Arjan de Vet <devet@devet.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: if_sk.c seems to need IFF_NEEDSGIANT on 5.3-BETA/RC1
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         73038
>Category:       kern
>Synopsis:       if_sk.c seems to need IFF_NEEDSGIANT on 5.3-BETA/RC1
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 23 12:20:14 GMT 2004
>Closed-Date:    Tue Dec 14 22:16:30 GMT 2004
>Last-Modified:  Sun Jul  3 01:11:09 GMT 2005
>Originator:     Arjan de Vet
>Release:        FreeBSD 5.3-RC1 i386
>Organization:
>Environment:
System: FreeBSD adv.devet.org 5.3-RC1 FreeBSD 5.3-RC1 #7: Sat Oct 23 13:49:58 CEST 2004 root@adv.devet.org:/usr/obj/usr/src/sys/ADV i386


>Description:

After upgrading from 5.2.1-RELEASE to 5.3-BETA/RC, my sk0 network
interface on an ASUS P4P800 motherboard mangles network connections
(broken ssh connections, broken web pages).

skc0: <3Com 3C940 Gigabit Ethernet> port 0xd800-0xd8ff mem 0xfeafc000-0xfeafffff irq 22 at device 5.0 on pci2
skc0: 3Com Gigabit LOM (3C940)
sk0: <Marvell Semiconductor, Inc. Yukon> on skc0
sk0: Ethernet address: 00:0c:6e:ea:f1:ba
sk0: if_start running deferred for Giant
miibus0: <MII bus> on sk0
e1000phy0: <Marvell 88E1000 Gigabit PHY> on miibus0
e1000phy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX-FDX, auto

First workaround is to put

    debug.mpsafenet="0"

in /boot/loader.conf.

Another workaround seems to be adding the IFF_NEEDSGIANT flag to the
if_sk.c driver. See patch below.

>How-To-Repeat:

SSH into another machine and give a command that produces lots of output
('ls -alR /') and watch the ssh-connection break with some weird error
message.

>Fix:

Index: if_sk.c
===================================================================
RCS file: /home/freebsd/CVS/src/sys/pci/if_sk.c,v
retrieving revision 1.83.2.2
diff -u -r1.83.2.2 if_sk.c
--- if_sk.c	25 Aug 2004 21:19:06 -0000	1.83.2.2
+++ if_sk.c	23 Oct 2004 11:47:50 -0000
@@ -1375,7 +1375,7 @@
 	ifp->if_softc = sc_if;
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 	ifp->if_mtu = ETHERMTU;
-	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_NEEDSGIANT;
 	ifp->if_ioctl = sk_ioctl;
 	ifp->if_start = sk_start;
 	ifp->if_watchdog = sk_watchdog;


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->rwatson 
Responsible-Changed-By: simon 
Responsible-Changed-When: Sun Oct 24 00:03:51 GMT 2004 
Responsible-Changed-Why:  
Seems network giant locking related, so over to rwatson. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73038 

From: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
To: Arjan de Vet <devet@devet.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Subject: Re: kern/73038: if_sk.c seems to need IFF_NEEDSGIANT on 5.3-BETA/RC1
Date: Mon, 25 Oct 2004 20:36:52 +0000 (UTC)

 On Sat, 23 Oct 2004, Arjan de Vet wrote:
 
 > >Fix:
 >
 > Index: if_sk.c
 > ===================================================================
 > RCS file: /home/freebsd/CVS/src/sys/pci/if_sk.c,v
 > retrieving revision 1.83.2.2
 > diff -u -r1.83.2.2 if_sk.c
 > --- if_sk.c	25 Aug 2004 21:19:06 -0000	1.83.2.2
 > +++ if_sk.c	23 Oct 2004 11:47:50 -0000
 > @@ -1375,7 +1375,7 @@
 >  	ifp->if_softc = sc_if;
 >  	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 >  	ifp->if_mtu = ETHERMTU;
 > -	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 > +	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_NEEDSGIANT;
 >  	ifp->if_ioctl = sk_ioctl;
 >  	ifp->if_start = sk_start;
 >  	ifp->if_watchdog = sk_watchdog;
 
 does not help with for the tx path starvation problem here on
 my amd64 with 5.3.
 
 -- 
 Bjoern A. Zeeb				bzeeb at Zabbadoz dot NeT

From: Arjan de Vet <devet@devet.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: kern/73038: if_sk.c seems to need IFF_NEEDSGIANT on 5.3-BETA/RC1
Date: Mon, 1 Nov 2004 20:16:10 +0100

 After upgrading to 5.3-RC2 (RELENG_5_3 branch, Nov 1st approx. 1700UTC)
 I cannot reproduce this if_sk problem anymore: I am now running 5.3-RC2
 without debug.mpsafenet="0" in /boot/loader.conf and so far no
 networking trouble whatsoever.
 
 Arjan

From: Arjan de Vet <devet@devet.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: kern/73038: if_sk.c seems to need IFF_NEEDSGIANT on 5.3-BETA/RC1
Date: Mon, 1 Nov 2004 21:26:17 +0100

 I wrote:
 
 >After upgrading to 5.3-RC2 (RELENG_5_3 branch, Nov 1st approx. 1700UTC)
 >I cannot reproduce this if_sk problem anymore: I am now running 5.3-RC2
 >without debug.mpsafenet="0" in /boot/loader.conf and so far no
 >networking trouble whatsoever.
 
 I spoke too early :-(. After a reboot without any configuration changes
 I see the broken SSH connections and broken web pages appear again. So
 I'm using debug.mpsafenet=0 again with if_sk.c.
 
 Arjan

From: "Thomas E. Zander" <riggs@rrr.de>
To: freebsd-gnats-submit@FreeBSD.org, devet@devet.org,
	rwatson@FreeBSD.org
Cc:  
Subject: Re: kern/73038: if_sk.c seems to need IFF_NEEDSGIANT on 5.3-BETA/RC
Date: Mon, 1 Nov 2004 22:43:51 +0100

 --+jhVVhN62yS6hEJ8
 Content-Type: text/plain; charset=iso-8859-15
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Hello,
 
 I can confirm that this particular problem is also persisting on my
 Asus P4P800SE board. Network adapter:
 
 skc0: <Marvell Gigabit Ethernet> port 0xd800-0xd8ff mem
 0xfeafc000-0xfeafffff irq 22 at device 5.0 on pci2
 skc0: Yukon Gigabit Ethernet 10/100/1000Base-T Adapter
 sk0: <Marvell Semiconductor, Inc. Yukon> on skc0
 
 e1000phy0: <Marvell 88E1000 Gigabit PHY> on miibus0
 e1000phy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX,
 1000baseTX-FDX, auto
 
 Unfortunately none of the mentioned workarounds helps here. (Broken ssh
 connections, fetching of large files impossible, ...)
 
 I'm willing to try any ideas, patches, suggestions you may have.
 
 Riggs
 
 --=20
 - Die Welt schl=E4ft tief schon lange Zeit | Sent with RiggiSmooth [tm] -
 -- Mich nur flieht die Dunkelheit        | ------------------------- --
 --- Denn per Infrarot seh ich            | just to fit your         ---
 ---- Die Nacht ist wirklich widerlich.   | primitive screen.       ----
 
 --+jhVVhN62yS6hEJ8
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 
 iD8DBQFBhq4XjdSJKchZls0RAnc+AKCGSAj2zcKu8mZ4HzwaTrb1SUWa7ACghXqT
 WnbSuCz8rjdI/CnsEuYvlRk=
 =ftux
 -----END PGP SIGNATURE-----
 
 --+jhVVhN62yS6hEJ8--

From: Arjan de Vet <devet@devet.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: kern/73038: if_sk.c seems to need IFF_NEEDSGIANT on 5.3-BETA/RC1
Date: Thu, 4 Nov 2004 10:32:21 +0100

 I'm happy to report that the following patch by Peter Edwards (posted to
 a.o. current) fixes the symptoms I reported. My sk0 interface is now
 running 12+ hours without debug.mpsafenet=0 in /boot/loader.conf without
 problems.
 
 From: Peter Edwards <peadar.edwards@gmail.com>
 CC: FreeBSD current mailing list <current@freebsd.org>
 CC: freebsd-amd64@freebsd.org
 Subject: Re: if_sk patch to get more info from people with problems
 
 [...]
 
 --- /tmp/if_sk.c        Tue Nov  2 17:49:26 2004
 +++ if_sk.c     Tue Nov  2 17:52:20 2004
 @@ -1115,12 +1115,14 @@
         if ((i < 0) || (i >= SK_JSLOTS))
                 panic("sk_jfree: asked to free buffer that we don't manage!");
  
 +       SK_LOCK(sc_if->sk_softc);
         entry = SLIST_FIRST(&sc_if->sk_jinuse_listhead);
         if (entry == NULL)
                 panic("sk_jfree: buffer not in use!");
         entry->slot = i;
         SLIST_REMOVE_HEAD(&sc_if->sk_jinuse_listhead, jpool_entries);
         SLIST_INSERT_HEAD(&sc_if->sk_jfree_listhead, entry, jpool_entries);
 +       SK_UNLOCK(sc_if->sk_softc);
  
         return;
  }
 
 Arjan
 
 -- 
 Arjan de Vet, Eindhoven, The Netherlands               <devet@devet.org>
 URL : http://www.devet.org/                     <Arjan.deVet@adv.iae.nl>
 Work: http://www.madison-gurkha.com/  (Security, Open Source, Education)

From: hans@lambermont.dyndns.org (Hans Lambermont)
To: freebsd-gnats-submit@FreeBSD.org, devet@devet.org,
	current@freebsd.org
Cc:  
Subject: Re: kern/73038: if_sk.c seems to need IFF_NEEDSGIANT on 5.3-BETA/RC1
Date: Thu, 11 Nov 2004 14:46:10 +0100

 if_sk.c problem remains
 
 I tested the SK_LOCK(sc_if->sk_softc); / SK_UNLOCK(sc_if->sk_softc);
 patch of Peter Edwards from
 http://www.freebsd.org/cgi/query-pr.cgi?pr=kern%2F73038 , it helps a
 bit, but does not solve my sk0 problems.
 
 I tested on 5.3-RELEASE, using two ASUS P4P800-E motherboards. They have:
 
 skc0: <Marvell Gigabit Ethernet> port 0xd800-0xd8ff mem 0xfeaf8000-0xfeafbfff irq 22 at device 5.0 on pci2
 skc0: Yukon Gigabit Ethernet 10/100/1000Base-T Adapter
 sk0: <Marvell Semiconductor, Inc. Yukon> on skc0
 sk0: Ethernet address: 00:11:2f:98:06:2e
 
 I first tried with debug.mpsafenet="0" in /boot/loader.conf, this did
 not help.
 
 Then I removed debug.mpsafenet and tried Peter's patch on a stock
 GENERIC kernel. Now dhclient at least gets a lease during boot, but a
 big ftp transfer (700 MB) starts with ~10 MB/s, then quickly drops down
 to kB/s range and eventually stalls and is unable to reconnect.
 
 Re-enabling debug.mpsafenet lets the ftp session run a few seconds
 longer at full speed, but ends with the same stalled state.
 
 What shall I try next ?
 
 regards,
    Hans
 -- 
 http://lambermont.webhop.org/ () ASCII-ribbon campaign against vCards,
                               /\ HTML-mail and proprietary formats.

From: Arjan de Vet <devet@devet.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: kern/73038: if_sk.c seems to need IFF_NEEDSGIANT on 5.3-BETA/RC1
Date: Mon, 22 Nov 2004 22:34:29 +0100

 The current version of the sk(4) driver in HEAD (backported to 5.3R)
 works OK for me. After a MFC to 5-STABLE this PR can be closed.
 
 Arjan
Responsible-Changed-From-To: rwatson->bz 
Responsible-Changed-By: bz 
Responsible-Changed-When: Mon Nov 22 21:46:19 GMT 2004 
Responsible-Changed-Why:  
I will handle this along with all the others. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73038 
State-Changed-From-To: open->closed 
State-Changed-By: bz 
State-Changed-When: Tue Dec 14 22:15:38 GMT 2004 
State-Changed-Why:  
Changes got MFCed. Thanks for testing. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73038 

From: Arjan de Vet <devet@devet.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: 	Re: kern/73038: if_sk.c seems to need IFF_NEEDSGIANT on 5.3-BETA/RC1
Date: Mon, 22 Nov 2004 22:34:29 +0100

 The current version of the sk(4) driver in HEAD (backported to 5.3R)
 works OK for me. After a MFC to 5-STABLE this PR can be closed.
 
 Arjan
 _______________________________________________
 freebsd-bugs@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
 To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
 
>Unformatted:
