On Wed, Jan 13, 2016 at 03:29:24PM +0200, Timo Myyrä wrote: > Stefan Sperling <s...@stsp.name> writes: > > > On Wed, Jan 13, 2016 at 01:30:39PM +0200, timo.my...@wickedbsd.net wrote: > > > >> >Synopsis: kernel panic when booting MP kernel, SP works > >> >Category: kernel > >> >Environment: > >> System : OpenBSD 5.9 > >> Details : OpenBSD 5.9-beta (GENERIC) #1679: Fri Jan 8 23:44:41 MST > >> 2016 > >> > >> dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC > >> > >> Architecture: OpenBSD.amd64 > >> Machine : amd64 > >> >Description: > >> Updated to latest snapshot and I get kernel panic when booting the > >> GENERIC.MP kernel. > >> SP kernel works. > >> > >> kernel: integer divide fault trap, code=0 > >> Stopped at ar5008_set_delta_slope+0x40: idivl %ecx,%eax > > > > It's probably crashing because c->ic_freq is zero here: > > > > /* Set Delta Slope (exponent and mantissa). */ > > coeff = (100 << 24) / c->ic_freq; > > > > This smells like the iwn(4) RXON SYSASSERT issue fixed this morning. > > Given that the driver starts out using a channel that hasn't been > > initialized, I don't understand how this code ever worked. > > > > Does this diff help? > > If it does, we should check all other drivers for the same problem. > > > > Index: athn.c > > =================================================================== > > RCS file: /cvs/src/sys/dev/ic/athn.c,v > > retrieving revision 1.92 > > diff -u -p -r1.92 athn.c > > --- athn.c 5 Jan 2016 18:41:15 -0000 1.92 > > +++ athn.c 13 Jan 2016 12:07:32 -0000 > > @@ -333,8 +333,8 @@ athn_attach(struct athn_softc *sc) > > /* Get the list of authorized/supported channels. */ > > athn_get_chanlist(sc); > > > > - /* IBSS channel undefined for now. */ > > - ic->ic_ibss_chan = &ic->ic_channels[0]; > > + /* Use channel 1 as initial channel. */ > > + ic->ic_ibss_chan = &ic->ic_channels[1]; > > > > ifp->if_softc = sc; > > ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; > > Built an new MP kernel with above patch and it boots now. Thanks for quick > fix. > > Timo
This is the real fix, for all drivers. I messed this up while removing turbo mode. Index: ieee80211.c =================================================================== RCS file: /cvs/src/sys/net80211/ieee80211.c,v retrieving revision 1.57 diff -u -p -r1.57 ieee80211.c --- ieee80211.c 12 Jan 2016 09:28:09 -0000 1.57 +++ ieee80211.c 13 Jan 2016 14:19:26 -0000 @@ -749,8 +749,10 @@ ieee80211_setmode(struct ieee80211com *i modeflags = chanflags[mode]; for (i = 0; i <= IEEE80211_CHAN_MAX; i++) { c = &ic->ic_channels[i]; - if (mode == IEEE80211_MODE_AUTO || - (c->ic_flags & modeflags) == modeflags) + if (mode == IEEE80211_MODE_AUTO) { + if (c->ic_flags != 0) + break; + } else if ((c->ic_flags & modeflags) == modeflags) break; } if (i > IEEE80211_CHAN_MAX) { @@ -764,8 +766,10 @@ ieee80211_setmode(struct ieee80211com *i memset(ic->ic_chan_active, 0, sizeof(ic->ic_chan_active)); for (i = 0; i <= IEEE80211_CHAN_MAX; i++) { c = &ic->ic_channels[i]; - if (mode == IEEE80211_MODE_AUTO || - (c->ic_flags & modeflags) == modeflags) + if (mode == IEEE80211_MODE_AUTO) { + if (c->ic_flags != 0) + setbit(ic->ic_chan_active, i); + } else if ((c->ic_flags & modeflags) == modeflags) setbit(ic->ic_chan_active, i); } /*