From owner-freebsd-current@FreeBSD.ORG Sat Feb 7 17:00:59 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BF22716A4CE for ; Sat, 7 Feb 2004 17:00:59 -0800 (PST) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id AB83443D1D for ; Sat, 7 Feb 2004 17:00:59 -0800 (PST) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (IDENT:brdavis@localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.12.10/8.12.3) with ESMTP id i1810O2h014974; Sat, 7 Feb 2004 17:00:24 -0800 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.12.10/8.12.3/Submit) id i1810OOi014972; Sat, 7 Feb 2004 17:00:24 -0800 Date: Sat, 7 Feb 2004 17:00:24 -0800 From: Brooks Davis To: SUZUKI Shinsuke Message-ID: <20040208010024.GA8855@Odin.AC.HMC.Edu> References: <356CD0A4-5828-11D8-A138-000A95A8A1F2@dragondata.com> <20040206183306.GA13801@Odin.AC.HMC.Edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bg08WKrSYDhXBjb5" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-milter (http://amavis.org/) on odin.ac.hmc.edu cc: freebsd-current@freebsd.org cc: toasty@dragondata.com Subject: Re: vlan panic in -CURRENT X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Feb 2004 01:01:00 -0000 --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Feb 07, 2004 at 08:50:32AM +0900, SUZUKI Shinsuke wrote: > >>>>> On Fri, 6 Feb 2004 10:33:06 -0800 > >>>>> brooks@one-eyed-alien.net(Brooks Davis) said: >=20 > > > This crashes -CURRENT (from a couple of days ago) for me: > > > ifconfig vlan0 create > > > ifconfig vlan0 vlan 2 vlandev fxp0 > > > ifconfig vlan0 up > > >=20 > > > (immediate trap 12/page fault while in kernel mode crash) > > >=20 > > > BUT, if I manually bring up fxp0 first, everything is fine. > (snip) > > Well, it's not related to simply upping a vlan on a down interface since > > I can't reproduce it with fwe0. I've got a shortage of systems > > configured for debugging that have an extra nic in them so I can't seem > > to replicate this. Since it should be possiable to replicate in single > > user mode, you might try setting hw.physmem to something small enough > > that you can get a crashdump. >=20 > I can reproduce the problem, and here's the trace: > if_up->if_route->in6_if_up->in6_ifattach->in6_ifattach_link > ->in6_update_ifa->in6_addmulti->if_addmulti->vlan_ioctl > ->vlan_setmulti->if_delmulti->fxp_ioctl->fxp_mc_setup >=20 > The reason of this panic lies in if_fxp.c; fxp's > ethernet-multicast-filter is configured before the initializtion of > fxp driver. >=20 > The attached ad-hoc patch fixed the problem, but IMHO much further > considerataion is necessary; this happens when vlan is initialized > before the initialization of its physical interface, and there might > be a similar different bug (in other driver or in different situation). >=20 > So could anyone see to it? > #I'm afraid I cannot, because I'm not a device-driver expert... I can't claim to fully understand what is going on, but it looks to me like there is no point in fxp calling fxp_mc_setup when the interface is not up (it might be OK if down and running, but I'm not sure about that.) The following untested patch avoids modifying the hardware filter in favor of setting sc->need_mcsetup when the interface is down. It looks like setting sc->need_mcsetup will cause fxp_mc_setup to be called in the interupt handler so it will get taken care of when the interface is brought up. -- Brooks =3D=3D=3D=3D //depot/user/brooks/cleanup/sys/dev/fxp/if_fxp.c#2 - /usr/p4/c= leanup/sys/dev/fxp/if_fxp.c =3D=3D=3D=3D @@ -2460,18 +2460,28 @@ sc->flags |=3D FXP_FLAG_ALL_MCAST; else sc->flags &=3D ~FXP_FLAG_ALL_MCAST; - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if ((sc->flags & FXP_FLAG_ALL_MCAST) =3D=3D 0) - fxp_mc_setup(sc); - /* - * fxp_mc_setup() can set FXP_FLAG_ALL_MCAST, so check it - * again rather than else {}. - */ - if (sc->flags & FXP_FLAG_ALL_MCAST) - fxp_init_body(sc); + + if (ifp->if_flags & IFF_UP) { + /* + * Multicast list has changed; set the hardware + * filter accordingly. + */ + if ((sc->flags & FXP_FLAG_ALL_MCAST) =3D=3D 0) + fxp_mc_setup(sc); + /* + * fxp_mc_setup() can set FXP_FLAG_ALL_MCAST, so + * check it again rather than else {}. + */ + if (sc->flags & FXP_FLAG_ALL_MCAST) + fxp_init_body(sc); + } else { + /* + * We can't set the hardware filter if we are + * not up, so just signal that we need to do so + * later. + */ + sc->need_mcsetup =3D 1; + } error =3D 0; break; =20 --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --bg08WKrSYDhXBjb5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFAJYonXY6L6fI4GtQRAuqOAJ9TxfqI7mY4BNEzoBlJzGKiHAv3TQCgty9U yA5k/+Eb6xujH4HZBwIkSow= =4bKS -----END PGP SIGNATURE----- --bg08WKrSYDhXBjb5--