Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-03-07 Thread Stefan Sperling
On Sat, Mar 07, 2015 at 03:35:29PM -0330, Michael wrote:
 So here is the mentioned bootup/dmesg output with Stefans debug patch,
 where the snip in this output is, is just me typing in the command
 to shutdown as it is quite hard to work with the system with the
 number of messages being printed. After the snip is the bit of output
 before a shutdown with a different timeout message, wasn't sure if it
 was related but figure it'd be better to include it.
 Let me know if you need anything further.

I can't find anything inherently bad in there.

The interrupts you're getting are receive interrupts. So it seems receive
is working, but transmit is broken (watchdog timeout triggers if attempts
to transmit time out). I don't know why this is happenning.

Does anything change if you move really close to the AP?



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-03-07 Thread Michael
On 7 March 2015 at 01:18, Michael lesniewskis...@gmail.com wrote:
 I think this is how a null-pointer call shows up in ddb.

 Does the diff below help?

 snip

 Perfect! That stopped the uvm_fault occuring, scanning now works well;
 however when actually connecting to an AP I get a number of
 bwi0: watchdog timeout
 I will re-add in the debug code that Stefan provided before and post
 another dmesg tomrrow unless different debug code would be needed for
 a watchdog timeout error?

So here is the mentioned bootup/dmesg output with Stefans debug patch,
where the snip in this output is, is just me typing in the command
to shutdown as it is quite hard to work with the system with the
number of messages being printed. After the snip is the bit of output
before a shutdown with a different timeout message, wasn't sure if it
was related but figure it'd be better to include it.
Let me know if you need anything further.

 OpenBSD/i386 BOOT 3.26
boot
booting hd0a:/bsd: 9785820+1068236 [72+409696+404353]=0xb20c70
entry point at 0x200120

[ using 814536 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2015 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 5.7 (GENERIC) #8: Sat Mar  7 13:49:51 NST 2015
r...@lucy.my.domain:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Mobile Intel(R) Pentium(R) 4 - M CPU 2.00GHz (GenuineIntel
686-class) 2 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,CNXT-ID,PERF
real mem  = 804675584 (767MB)
avail mem = 779149312 (743MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 01/07/04, BIOS32 rev. 0 @ 0xffe90, SMBIOS rev.
2.3 @ 0xf76a0 (62 entries)
bios0: vendor Dell Computer Corporation version A13 date 01/07/2004
bios0: Dell Computer Corporation Latitude C840
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP
acpi0: wakeup devices LID_(S3) PBTN(S4) PCI0(S3) UAR1(S3) USB0(S1)
USB1(S1) USB2(S1) MODM(S3) PCIE(S3) MPCI(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (AGP_)
acpiprt2 at acpi0: bus 2 (PCIE)
acpiprt3 at acpi0: bus -1 (MPCI)
acpicpu0 at acpi0acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: invalid _PSS length
: C2
acpipwrres0 at acpi0: PADA, resource for ADPT
acpitz0 at acpi0: critical temperature is 94 degC
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT0 not present
acpibat1 at acpi0: BAT1 not present
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: PBTN
acpibtn2 at acpi0: SBTN
acpidock0 at acpi0: GDCK not docked (0)
acpivideo0 at acpi0: VID_
bios0: ROM list: 0xc/0xf800 0xcf800/0x800!
cpu0 at mainbus0: (uniprocessor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 Intel 82845 Host rev 0x04
intelagp0 at pchb0
agp0 at intelagp0: aperture at 0xe800, size 0x400
ppb0 at pci0 dev 1 function 0 Intel 82845 AGP rev 0x04
pci1 at ppb0 bus 1
1:0:0: mem address conflict 0x8000/0x2
vga1 at pci1 dev 0 function 0 NVIDIA GeForce4 440 Go rev 0xa3
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
uhci0 at pci0 dev 29 function 0 Intel 82801CA/CAM USB rev 0x02: irq 11
uhci1 at pci0 dev 29 function 2 Intel 82801CA/CAM USB rev 0x02: irq 11
ppb1 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev 0x42
pci2 at ppb1 bus 2
xl0 at pci2 dev 0 function 0 3Com 3c905C 100Base-TX rev 0x78: irq
11, address 00:0b:db:1e:b3:e4
exphy0 at xl0 phy 24: 3Com internal media interface
cbb0 at pci2 dev 1 function 0 TI PCI4451 CardBus rev 0x00: irq 11
cbb1 at pci2 dev 1 function 1 TI PCI4451 CardBus rev 0x00: irq 11
TI PCI4451 FireWire rev 0x00 at pci2 dev 1 function 2 not configured
bwi0 at pci2 dev 3 function 0 Broadcom BCM4306 rev 0x02: irq 11
bwi0: bwi_power_on
bwi0: regwin: type 0x800, rev 2, vendor 0x4243
bwi0: BBP id 0x4306, BBP rev 0x2, BBP pkg 0
bwi0: nregwin 6, cap 0x002a
bwi0: regwin: type 0x812, rev 4, vendor 0x4243
bwi0: has TX stats
bwi0: regwin: type 0x80d, rev 1, vendor 0x4243
bwi0: regwin: type 0x807, rev 1, vendor 0x4243
bwi0: regwin: type 0x804, rev 7, vendor 0x4243
bwi0: regwin: type 0x812, rev 4, vendor 0x4243
bwi0: ignore second MAC
bwi0: bwi_power_on
bwi0: bus rev 0
bwi0: PCI is enabled
bwi0: card flags 0x000f
bwi0: 0th led, act 2, lowact 0
bwi0: 1th led, act 5, lowact 0
bwi0: 2th led, act 4, lowact 0
bwi0: 3th led, act 0, lowact 0
bwi0: MAC was already disabled
bwi0: PHY is linked
bwi0: PHY type 2, rev 1, ver 1
bwi0: RF manu 0x17f, type 0x2050, rev 2
bwi0: bus rev 0
bwi0: PHY is linked
bwi0: 30bit bus space
bwi0: max txpower from sprom: 57 dBm
bwi0: invalid antenna gain in sprom
bwi0: ant gain 8 dBm
bwi0: 

Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-03-07 Thread Michael
 I can't find anything inherently bad in there.

 The interrupts you're getting are receive interrupts. So it seems receive
 is working, but transmit is broken (watchdog timeout triggers if attempts
 to transmit time out). I don't know why this is happenning.

 Does anything change if you move really close to the AP?

So I tried with my phone setup as a hotspot AP, I set it right next to
the laptop and configured it so that it would use the phone. The phone
does recognise that there is a device that connects to it
successfully.
Apologies for the length of this output, I have noted where I started
typing the command with _start_ and the end of the typing with _end_,
there is also another _end_ noting where I ctrl-c'd the ping, so
hopefully that makes it a little easier to see.

 OpenBSD/i386 BOOT 3.26
boot
booting hd0a:/bsd: 9785820+1068236 [72+409696+404353]=0xb20c70
entry point at 0x200120

[ using 814536 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2015 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 5.7 (GENERIC) #8: Sat Mar  7 13:49:51 NST 2015
r...@lucy.my.domain:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Mobile Intel(R) Pentium(R) 4 - M CPU 2.00GHz (GenuineIntel
686-class) 2 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,CNXT-ID,PERF
real mem  = 804675584 (767MB)
avail mem = 779149312 (743MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 01/07/04, BIOS32 rev. 0 @ 0xffe90, SMBIOS rev.
2.3 @ 0xf76a0 (62 entries)
bios0: vendor Dell Computer Corporation version A13 date 01/07/2004
bios0: Dell Computer Corporation Latitude C840
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP
acpi0: wakeup devices LID_(S3) PBTN(S4) PCI0(S3) UAR1(S3) USB0(S1)
USB1(S1) USB2(S1) MODM(S3) PCIE(S3) MPCI(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (AGP_)
acpiprt2 at acpi0: bus 2 (PCIE)
acpiprt3 at acpi0: bus -1 (MPCI)
acpicpu0 at acpi0acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: invalid _PSS length
: C2
acpipwrres0 at acpi0: PADA, resource for ADPT
acpitz0 at acpi0: critical temperature is 94 degC
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT0 not present
acpibat1 at acpi0: BAT1 not present
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: PBTN
acpibtn2 at acpi0: SBTN
acpidock0 at acpi0: GDCK not docked (0)
acpivideo0 at acpi0: VID_
bios0: ROM list: 0xc/0xf800 0xcf800/0x800!
cpu0 at mainbus0: (uniprocessor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 Intel 82845 Host rev 0x04
intelagp0 at pchb0
agp0 at intelagp0: aperture at 0xe800, size 0x400
ppb0 at pci0 dev 1 function 0 Intel 82845 AGP rev 0x04
pci1 at ppb0 bus 1
1:0:0: mem address conflict 0x8000/0x2
vga1 at pci1 dev 0 function 0 NVIDIA GeForce4 440 Go rev 0xa3
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
uhci0 at pci0 dev 29 function 0 Intel 82801CA/CAM USB rev 0x02: irq 11
uhci1 at pci0 dev 29 function 2 Intel 82801CA/CAM USB rev 0x02: irq 11
ppb1 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev 0x42
pci2 at ppb1 bus 2
xl0 at pci2 dev 0 function 0 3Com 3c905C 100Base-TX rev 0x78: irq
11, address 00:0b:db:1e:b3:e4
exphy0 at xl0 phy 24: 3Com internal media interface
cbb0 at pci2 dev 1 function 0 TI PCI4451 CardBus rev 0x00: irq 11
cbb1 at pci2 dev 1 function 1 TI PCI4451 CardBus rev 0x00: irq 11
TI PCI4451 FireWire rev 0x00 at pci2 dev 1 function 2 not configured
bwi0 at pci2 dev 3 function 0 Broadcom BCM4306 rev 0x02: irq 11
bwi0: bwi_power_on
bwi0: regwin: type 0x800, rev 2, vendor 0x4243
bwi0: BBP id 0x4306, BBP rev 0x2, BBP pkg 0
bwi0: nregwin 6, cap 0x002a
bwi0: regwin: type 0x812, rev 4, vendor 0x4243
bwi0: has TX stats
bwi0: regwin: type 0x80d, rev 1, vendor 0x4243
bwi0: regwin: type 0x807, rev 1, vendor 0x4243
bwi0: regwin: type 0x804, rev 7, vendor 0x4243
bwi0: regwin: type 0x812, rev 4, vendor 0x4243
bwi0: ignore second MAC
bwi0: bwi_power_on
bwi0: bus rev 0
bwi0: PCI is enabled
bwi0: card flags 0x000f
bwi0: 0th led, act 2, lowact 0
bwi0: 1th led, act 5, lowact 0
bwi0: 2th led, act 4, lowact 0
bwi0: 3th led, act 0, lowact 0
bwi0: MAC was already disabled
bwi0: PHY is linked
bwi0: PHY type 2, rev 1, ver 1
bwi0: RF manu 0x17f, type 0x2050, rev 2
bwi0: bus rev 0
bwi0: PHY is linked
bwi0: 30bit bus space
bwi0: max txpower from sprom: 57 dBm
bwi0: invalid antenna gain in sprom
bwi0: ant gain 8 dBm
bwi0: region/domain max txpower 76 dBm
bwi0: max txpower 57 dBm
bwi0: sprom idle tssi: 0x003e
bwi0: TSSI-TX power map:
71 71 70 70 70 70 70 69
69 69 

Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-03-07 Thread Stefan Sperling
On Sat, Mar 07, 2015 at 04:29:40PM -0330, Michael wrote:
  I can't find anything inherently bad in there.
 
  The interrupts you're getting are receive interrupts. So it seems receive
  is working, but transmit is broken (watchdog timeout triggers if attempts
  to transmit time out). I don't know why this is happenning.
 
  Does anything change if you move really close to the AP?
 
 So I tried with my phone setup as a hotspot AP, I set it right next to
 the laptop and configured it so that it would use the phone. The phone
 does recognise that there is a device that connects to it
 successfully.
 Apologies for the length of this output, I have noted where I started
 typing the command with _start_ and the end of the typing with _end_,
 there is also another _end_ noting where I ctrl-c'd the ping, so
 hopefully that makes it a little easier to see.

So this shows that associating and DHCP works. And then no ping.
I suspect this is simply the calibration problem mentioned in the bwi(4)
man page:

CAVEATS
 Some chips are incorrectly calibrated due to the lack of documentation,
 which can slow the amount of traffic to the point of being unusable.

Which is a long-standing bug.

I could never reproduce the situation where it doesn't work at all.
But the bwi device in my macppc is far from stable. Ping times vary
considerably and there occasional are stalls.
Sometimes it just works though.

On my list of many things to fix in wifi, this one is pretty low,
unfortunately.



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-03-06 Thread Michael
 I think this is how a null-pointer call shows up in ddb.

 Does the diff below help?

snip

Perfect! That stopped the uvm_fault occuring, scanning now works well;
however when actually connecting to an AP I get a number of
bwi0: watchdog timeout
and although it successfully can acquire a DHCP address on bootup, no
traffic can be passed. (pings and traceroutes just hang without
output).
I will re-add in the debug code that Stefan provided before and post
another dmesg tomrrow unless different debug code would be needed for
a watchdog timeout error?



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-03-04 Thread Mark Kettenis
 Date: Sun, 1 Mar 2015 16:50:27 -0330
 From: Michael lesniewskis...@gmail.com

 uvm_fault(0xd6508004, 0x0, 0, 1) - e
 kernel: page fault trap, code=0
 Stopped at  0:uvm_fault(0xd6508004, 0x0, 0, 1) - e
   kernel: page fault trap, code=0
 Stopped at  db_read_bytes+0x17: movzbl  0(%esi,%ecx,1),%eax

I think this is how a null-pointer call shows up in ddb.

Does the diff below help?

Index: bwi.c
===
RCS file: /cvs/src/sys/dev/ic/bwi.c,v
retrieving revision 1.116
diff -u -p -r1.116 bwi.c
--- bwi.c   10 Feb 2015 23:25:46 -  1.116
+++ bwi.c   4 Mar 2015 14:03:23 -
@@ -1234,7 +1234,7 @@ bwi_mac_init(struct bwi_mac *mac)
/*
 * Initialize TX stats if the current MAC uses that
 */
-   if (mac-mac_flags  BWI_MAC_F_HAS_TXSTATS) {
+   if (mac-mac_flags  BWI_MAC_F_HAS_TXSTATS  sc-sc_init_txstats) {
error = sc-sc_init_txstats(sc);
if (error) {
printf(%s: can't initialize TX stats ring\n,
@@ -2368,7 +2368,7 @@ bwi_mac_shutdown(struct bwi_mac *mac)
struct bwi_softc *sc = mac-mac_sc;
int i;
 
-   if (mac-mac_flags  BWI_MAC_F_HAS_TXSTATS)
+   if (mac-mac_flags  BWI_MAC_F_HAS_TXSTATS  sc-sc_free_txstats)
sc-sc_free_txstats(sc);
 
sc-sc_free_rx_ring(sc);



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-03-01 Thread Michael
Wow, y'all are quick.
Sorry it took me so long to test and reply but with the patches as
mentioned, I still receive the same uvm_fault.
To give some info, I pulled a src tree from after revision 1.66 of the
bus.h change that guenther@ made.
As there is a lot of text, I split the different compiles below by 8 -
for each separate kernel compile and the different outputs by 4 -.
The first was the plain src tree from after r1.66.
The second was with the patches that miod@ supplied.
The third was using the daring patches that guenther@ then sent.
The fourth (final) output is from the daring patches and also with the
additional bwi debug information reapplied.


boot kernel plain src 27th (after gunther bus.h patch)
 OpenBSD/i386 BOOT 3.26
boot
booting hd0a:/bsd: 9777628+1068236 [72+409680+404340]=0xb1ec50
entry point at 0x200120

[ using 814504 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2015 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 5.7-beta (GENERIC) #1: Sat Feb 28 14:57:13 NST 2015
r...@lucy.my.domain:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Mobile Intel(R) Pentium(R) 4 - M CPU 2.00GHz (GenuineIntel
686-class) 2 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,CNXT-ID,PERF
real mem  = 804675584 (767MB)
avail mem = 779157504 (743MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 01/07/04, BIOS32 rev. 0 @ 0xffe90, SMBIOS rev.
2.3 @ 0xf76a0 (62 entries)
bios0: vendor Dell Computer Corporation version A13 date 01/07/2004
bios0: Dell Computer Corporation Latitude C840
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP
acpi0: wakeup devices LID_(S3) PBTN(S4) PCI0(S3) UAR1(S3) USB0(S1)
USB1(S1) USB2(S1) MODM(S3) PCIE(S3) MPCI(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (AGP_)
acpiprt2 at acpi0: bus 2 (PCIE)
acpiprt3 at acpi0: bus -1 (MPCI)
acpicpu0 at acpi0acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: invalid _PSS length
: C2
acpipwrres0 at acpi0: PADA, resource for ADPT
acpitz0 at acpi0: critical temperature is 94 degC
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT0 not present
acpibat1 at acpi0: BAT1 not present
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: PBTN
acpibtn2 at acpi0: SBTN
acpidock0 at acpi0: GDCK not docked (0)
acpivideo0 at acpi0: VID_
bios0: ROM list: 0xc/0xf800 0xcf800/0x800!
cpu0 at mainbus0: (uniprocessor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 Intel 82845 Host rev 0x04
intelagp0 at pchb0
agp0 at intelagp0: aperture at 0xe800, size 0x400
ppb0 at pci0 dev 1 function 0 Intel 82845 AGP rev 0x04
pci1 at ppb0 bus 1
1:0:0: mem address conflict 0x8000/0x2
vga1 at pci1 dev 0 function 0 NVIDIA GeForce4 440 Go rev 0xa3
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
uhci0 at pci0 dev 29 function 0 Intel 82801CA/CAM USB rev 0x02: irq 11
uhci1 at pci0 dev 29 function 2 Intel 82801CA/CAM USB rev 0x02: irq 11
ppb1 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev 0x42
pci2 at ppb1 bus 2
xl0 at pci2 dev 0 function 0 3Com 3c905C 100Base-TX rev 0x78: irq
11, address 00:0b:db:1e:b3:e4
exphy0 at xl0 phy 24: 3Com internal media interface
cbb0 at pci2 dev 1 function 0 TI PCI4451 CardBus rev 0x00: irq 11
cbb1 at pci2 dev 1 function 1 TI PCI4451 CardBus rev 0x00: irq 11
TI PCI4451 FireWire rev 0x00 at pci2 dev 1 function 2 not configured
bwi0 at pci2 dev 3 function 0 Broadcom BCM4306 rev 0x02: irq 11,
address 00:90:4b:72:9f:fd
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 4 device 0 cacheline 0x8, lattimer 0x20
pcmcia0 at cardslot0
cardslot1 at cbb1 slot 1 flags 0
cardbus1 at cardslot1: bus 5 device 0 cacheline 0x8, lattimer 0x20
pcmcia1 at cardslot1
ichpcib0 at pci0 dev 31 function 0 Intel 82801CAM LPC rev 0x02
pciide0 at pci0 dev 31 function 1 Intel 82801CAM IDE rev 0x02: DMA,
channel 0 configured to compatibility, channel 1 configured to
compatibility
wd0 at pciide0 channel 0 drive 0: Hitachi HTS541680J9AT00
wd0: 16-sector PIO, LBA48, 76319MB, 156301488 sectors
atapiscsi0 at pciide0 channel 0 drive 1
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: SAMSUNG, CD-ROM SN-124, N102 ATAPI
5/cdrom removable
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
cd0(pciide0:0:1): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 disabled (no drives)
auich0 at pci0 dev 31 function 5 Intel 82801CA/CAM AC97 rev 0x02:
irq 11, ICH3 AC97
ac97: codec id 0x4352595b (Cirrus Logic CS4205 rev 3)
ac97: codec features mic channel, tone, simulated stereo, bass boost,
20 

Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-27 Thread Philip Guenther
On Thu, 26 Feb 2015, Miod Vallat wrote:
 Please try the following revert diff. It works for me on that particular 
 non-ioapic system with yds(4).

I don't have a system to test this, but I suspect this diff will fix the 
problem: the i386_space_copy() macro can set the direction flag but 
doesn't clear it then, so functions using this macro can violate the ABI 
by returning with the direction flag set.

Philip

Index: include/bus.h
===
RCS file: /data/src/openbsd/src/sys/arch/i386/include/bus.h,v
retrieving revision 1.65
diff -u -p -r1.65 bus.h
--- include/bus.h   24 Jan 2015 15:13:55 -  1.65
+++ include/bus.h   27 Feb 2015 07:19:52 -
@@ -458,6 +458,7 @@ struct i386_bus_space_ops {
case 2: i386_space_copy1(a1,a2,cnt,movsw,std);break;\
case 4: i386_space_copy1(a1,a2,cnt,movsl,std);break;\
}   \
+   __asm volatile(cld);  /* must restore before func ret */ \
} else  \
switch (sz) {   \
case 1: i386_space_copy1(a1,a2,cnt,movsb,cld);break;\



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-27 Thread Philip Guenther
On Fri, 27 Feb 2015, Philip Guenther wrote:
 I don't have a system to test this, but I suspect this diff will fix the 
 problem: the i386_space_copy() macro can set the direction flag but 
 doesn't clear it then, so functions using this macro can violate the ABI 
 by returning with the direction flag set.

The insane^Wdaring will also try this diff, which deletes 44 cld's to 
match the one added.  Not for 5.7--not enough time to exercise all the 
cases before then--but afterwards we should go the rest of the way.  
amd64 will get a similar diff after unlock...


Philip


Index: i386/bus_space.c
===
RCS file: /data/src/openbsd/src/sys/arch/i386/i386/bus_space.c,v
retrieving revision 1.8
diff -u -p -r1.8 bus_space.c
--- i386/bus_space.c17 Oct 2014 20:37:57 -  1.8
+++ i386/bus_space.c27 Feb 2015 09:44:25 -
@@ -303,7 +303,7 @@ i386_bus_space_io_read_region_1(bus_spac
void *_addr = a;
int _port = h + o;
 
-   __asm volatile(cld ;
+   __asm volatile(
1: inb %w2,%%al;
   stosb   ;
   incl %2 ;
@@ -320,7 +320,7 @@ i386_bus_space_io_read_region_2(bus_spac
void *_addr = a;
int _port = h + o;
 
-   __asm volatile(cld ;
+   __asm volatile(
1: inw %w2,%%ax;
   stosw   ;
   addl $2,%2  ;
@@ -337,7 +337,7 @@ i386_bus_space_io_read_region_4(bus_spac
void *_addr = a;
int _port = h + o;
 
-   __asm volatile(cld ;
+   __asm volatile(
1: inl %w2,%%eax   ;
   stosl   ;
   addl $4,%2  ;
@@ -393,7 +393,7 @@ i386_bus_space_io_write_region_1(bus_spa
const void *_addr = a;
int _cnt = cnt;
 
-   __asm volatile(cld ;
+   __asm volatile(
1: lodsb   ;
   outb %%al,%w0   ;
   incl %0 ;
@@ -410,7 +410,7 @@ i386_bus_space_io_write_region_2(bus_spa
const void *_addr = a;
int _cnt = cnt;
 
-   __asm volatile(cld ;
+   __asm volatile(
1: lodsw   ;
   outw %%ax,%w0   ;
   addl $2,%0  ;
@@ -427,7 +427,7 @@ i386_bus_space_io_write_region_4(bus_spa
const void *_addr = a;
int _cnt = cnt;
 
-   __asm volatile(cld ;
+   __asm volatile(
1: lodsl   ;
   outl %%eax,%w0  ;
   addl $4,%0  ;
@@ -442,7 +442,7 @@ i386_bus_space_io_set_multi_1(bus_space_
 {
int _cnt = cnt;
 
-   __asm volatile(cld ;
+   __asm volatile(
1: outb %b2, %w1   ;
   loop 1b:
+c (_cnt) : d (h + o), a (v)  :
@@ -455,7 +455,7 @@ i386_bus_space_io_set_multi_2(bus_space_
 {
int _cnt = cnt;
 
-   __asm volatile(cld ;
+   __asm volatile(
1: outw %w2, %w1   ;
   loop 1b:
+c (_cnt) : d (h + o), a (v)  :
@@ -468,7 +468,7 @@ i386_bus_space_io_set_multi_4(bus_space_
 {
int _cnt = cnt;
 
-   __asm volatile(cld ;
+   __asm volatile(
1: outl %2,%w1 ;
   loop 1b:
+c (_cnt) : d (h + o), a (v)  :
@@ -617,7 +617,7 @@ i386_bus_space_mem_read_multi_1(bus_spac
 {
void *_addr=a;
int _cnt=cnt;
-   __asm volatile(cld ;
+   __asm volatile(
1: movb (%2),%%al  ;
   stosb   ;
   loop 1b:
@@ -631,7 +631,7 @@ i386_bus_space_mem_read_multi_2(bus_spac
 {
void *_addr=a;
int _cnt=cnt;
-   __asm volatile(cld ;
+   __asm volatile(
1: movw (%2),%%ax  ;
   stosw   ;
   loop 1b:
@@ -645,7 +645,7 @@ i386_bus_space_mem_read_multi_4(bus_spac
 {
void *_addr=a;
int _cnt=cnt;
-   __asm volatile(cld ;
+   

Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-26 Thread Philip Guenther
On Thu, 26 Feb 2015, Miod Vallat wrote:
 Please try the following revert diff. It works for me on that particular
 non-ioapic system with yds(4).
...
 --- arch/i386/i386/locore.s   11 Feb 2015 00:16:07 -  1.150
 +++ arch/i386/i386/locore.s   26 Feb 2015 20:37:20 -
 @@ -104,7 +104,6 @@
   * These are used on interrupt or trap entry or exit.
   */
  #define  INTRENTRY \
 - cld ; \
   pushl   %eax; \
   pushl   %ecx; \
   pushl   %edx; \

Does a non-ioapic interrupt somehow not go through a path with INTRENTRY?


Philip



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-26 Thread Miod Vallat
Please try the following revert diff. It works for me on that particular
non-ioapic system with yds(4).

Index: arch/i386/i386/locore.s
===
RCS file: /cvs/src/sys/arch/i386/i386/locore.s,v
retrieving revision 1.150
diff -u -p -r1.150 locore.s
--- arch/i386/i386/locore.s 11 Feb 2015 00:16:07 -  1.150
+++ arch/i386/i386/locore.s 26 Feb 2015 20:37:20 -
@@ -104,7 +104,6 @@
  * These are used on interrupt or trap entry or exit.
  */
 #defineINTRENTRY \
-   cld ; \
pushl   %eax; \
pushl   %ecx; \
pushl   %edx; \
Index: lib/libkern/arch/i386/bcmp.S
===
RCS file: /cvs/src/sys/lib/libkern/arch/i386/bcmp.S,v
retrieving revision 1.3
diff -u -p -r1.3 bcmp.S
--- lib/libkern/arch/i386/bcmp.S29 Nov 2014 18:51:23 -  1.3
+++ lib/libkern/arch/i386/bcmp.S26 Feb 2015 20:37:21 -
@@ -13,6 +13,7 @@ ENTRY(bcmp)
movl12(%esp),%edi
movl16(%esp),%esi
xorl%eax,%eax   /* clear return value */
+   cld /* set compare direction forward */
 
movl20(%esp),%ecx   /* compare by words */
shrl$2,%ecx
Index: lib/libkern/arch/i386/bzero.S
===
RCS file: /cvs/src/sys/lib/libkern/arch/i386/bzero.S,v
retrieving revision 1.5
diff -u -p -r1.5 bzero.S
--- lib/libkern/arch/i386/bzero.S   29 Nov 2014 18:51:23 -  1.5
+++ lib/libkern/arch/i386/bzero.S   26 Feb 2015 20:37:21 -
@@ -13,6 +13,7 @@ ENTRY(bzero)
movl8(%esp),%edi
movl12(%esp),%edx
 
+   cld /* set fill direction forward */
xorl%eax,%eax   /* set fill data to 0 */
 
/*
Index: lib/libkern/arch/i386/memchr.S
===
RCS file: /cvs/src/sys/lib/libkern/arch/i386/memchr.S,v
retrieving revision 1.2
diff -u -p -r1.2 memchr.S
--- lib/libkern/arch/i386/memchr.S  29 Nov 2014 18:51:23 -  1.2
+++ lib/libkern/arch/i386/memchr.S  26 Feb 2015 20:37:21 -
@@ -14,6 +14,7 @@ ENTRY(memchr)
movl16(%esp),%ecx   /* set length of search */
testl   %ecx,%ecx   /* test for len == 0 */
jz  L1
+   cld /* set search forward */
repne   /* search! */
scasb
jne L1  /* scan failed, return null */
Index: lib/libkern/arch/i386/memcmp.S
===
RCS file: /cvs/src/sys/lib/libkern/arch/i386/memcmp.S,v
retrieving revision 1.2
diff -u -p -r1.2 memcmp.S
--- lib/libkern/arch/i386/memcmp.S  29 Nov 2014 18:51:23 -  1.2
+++ lib/libkern/arch/i386/memcmp.S  26 Feb 2015 20:37:21 -
@@ -12,6 +12,7 @@ ENTRY(memcmp)
pushl   %esi
movl12(%esp),%edi
movl16(%esp),%esi
+   cld /* set compare direction forward */
 
movl20(%esp),%ecx   /* compare by words */
shrl$2,%ecx
Index: lib/libkern/arch/i386/memmove.S
===
RCS file: /cvs/src/sys/lib/libkern/arch/i386/memmove.S,v
retrieving revision 1.7
diff -u -p -r1.7 memmove.S
--- lib/libkern/arch/i386/memmove.S 29 Nov 2014 18:51:23 -  1.7
+++ lib/libkern/arch/i386/memmove.S 26 Feb 2015 20:37:21 -
@@ -74,6 +74,7 @@ ENTRY(memcpy)
movl20(%esp),%ecx
 docopyf:
movl%edi,%eax   # setup return value for memcpy/memmove
+   cld # copy forward
shrl$2,%ecx # copy by 32-bit words
rep
movsl
Index: lib/libkern/arch/i386/memset.S
===
RCS file: /cvs/src/sys/lib/libkern/arch/i386/memset.S,v
retrieving revision 1.4
diff -u -p -r1.4 memset.S
--- lib/libkern/arch/i386/memset.S  29 Nov 2014 18:51:23 -  1.4
+++ lib/libkern/arch/i386/memset.S  26 Feb 2015 20:37:21 -
@@ -15,6 +15,8 @@ ENTRY(memset)
movl20(%esp),%ecx
pushl   %edi/* push address of buffer */
 
+   cld /* set fill direction forward */
+
/*
 * if the string is too short, it's really not worth the overhead
 * of aligning to word boundaries, etc.  So we jump to a plain
Index: lib/libkern/arch/i386/scanc.S
===
RCS file: /cvs/src/sys/lib/libkern/arch/i386/scanc.S,v
retrieving revision 1.3
diff -u -p -r1.3 scanc.S
--- lib/libkern/arch/i386/scanc.S   29 Nov 2014 18:51:23 -  1.3
+++ 

Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-25 Thread Miod Vallat
  Ok, so patched as requested, recompiled the kernel. Including the
  command itself, a new dmesg as it has some new information, the ps,
  trace and show registers outputs.
  Let me know if you need anything further.
 
 I have dusted a pre-ioapic system here...
 
 [...]
 cpu0: AMD-K6tm w/ multimedia extensions (AuthenticAMD 586-class) 234 MHz
 cpu0: FPU,V86,DE,PSE,TSC,MSR,MCE,CX8,MMX
 real mem  = 66646016 (63MB)
 avail mem = 8144 (52MB)
 mainbus0 at root
 bios0 at mainbus0: AT/286+ BIOS, date 02/26/98, BIOS32 rev. 0 @ 0xfb440
 apm0 at bios0: Power Management spec V1.2 (slowidle)
 pcibios0 at bios0: rev 2.1 @ 0xf/0xb8b8
 pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdd30/128 (6 entries)
 pcibios0: PCI Exclusive IRQs: 5 9 10 11
 pcibios0: PCI Interrupt Router at 000:07:0 (Intel 82371SB ISA rev 0x00)
 pcibios0: PCI bus #0 is the last bus
 bios0: ROM list: 0xc/0x8000
 cpu0 at mainbus0: (uniprocessor)
 pci0 at mainbus0 bus 0: configuration mode 1 (bios)
 [...]
 
 ... in order to check if your issue is specific to bwi or not. The
 upgrade from bsd.rd ran smoothly, but GENERIC drops into ddb at the end
 of autoconf, before the kernel even gets a chance to start init.
 
 I'll try and investigate this regression further next weekend.
 

Actually, GENERIC runs if I boot -c and disable yds, which would
otherwise attach as:

yds0 at pci0 dev 13 function 0 Yamaha 724 rev 0x05: irq 9

so there is definitely something fishy regarding PCI interrupt
handling... but not necessarily all of them, since this device:

vr0 at pci0 dev 15 function 0 VIA Rhine/RhineII rev 0x06: irq 10, address 
00:50:ba:c8:1d:bb
amphy0 at vr0 phy 8: Am79C873 10/100 PHY, rev. 0

works (well, as far as a VIA Rhine can work).



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-25 Thread Miod Vallat
 Ok, so patched as requested, recompiled the kernel. Including the
 command itself, a new dmesg as it has some new information, the ps,
 trace and show registers outputs.
 Let me know if you need anything further.

I have dusted a pre-ioapic system here...

[...]
cpu0: AMD-K6tm w/ multimedia extensions (AuthenticAMD 586-class) 234 MHz
cpu0: FPU,V86,DE,PSE,TSC,MSR,MCE,CX8,MMX
real mem  = 66646016 (63MB)
avail mem = 8144 (52MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 02/26/98, BIOS32 rev. 0 @ 0xfb440
apm0 at bios0: Power Management spec V1.2 (slowidle)
pcibios0 at bios0: rev 2.1 @ 0xf/0xb8b8
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdd30/128 (6 entries)
pcibios0: PCI Exclusive IRQs: 5 9 10 11
pcibios0: PCI Interrupt Router at 000:07:0 (Intel 82371SB ISA rev 0x00)
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xc/0x8000
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
[...]

... in order to check if your issue is specific to bwi or not. The
upgrade from bsd.rd ran smoothly, but GENERIC drops into ddb at the end
of autoconf, before the kernel even gets a chance to start init.

I'll try and investigate this regression further next weekend.



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-23 Thread Michael
On 23 February 2015 at 03:45, Stefan Sperling s...@stsp.name wrote:
 On Sun, Feb 22, 2015 at 11:11:50PM -0330, Michael wrote:
  So it's running into a NULL pointer but it's still unclear where and why.
  Perhaps it's an unchecked allocation failure, perhaps some other problem.
 
  Are you comfortable with adding some debug printf to see which function in
  bwi is the last called one before the crash? Would you need help with that?

 Yes, I can add in some debugging if you could tell me how/where it is needed.
 I see in the later emails no-one else seems to have this issue so if
 it is just specific to my systems then I can do some further tests as
 needed.

 Given what miod said the interrupt handler (bwi_intr) might be a good
 plaec to start.

 Though perhaps that is not even reached? Do you get any call to bwi_intr?
 I don't know where to start debugging ioapic issues.

 Index: bwi.c
 ===
 RCS file: /cvs/src/sys/dev/ic/bwi.c,v
 retrieving revision 1.116
 diff -u -p -r1.116 bwi.c
 --- bwi.c   10 Feb 2015 23:25:46 -  1.116
 +++ bwi.c   23 Feb 2015 07:11:19 -
 @@ -73,8 +73,9 @@

  #include uvm/uvm_extern.h

 +#define BWI_DEBUG
  #ifdef BWI_DEBUG
 -int bwi_debug = 1;
 +int bwi_debug = 2;
  #define DPRINTF(l, x...)   do { if ((l) = bwi_debug) printf(x); } while 
 (0)
  #else
  #define DPRINTF(l, x...)
 @@ -578,6 +579,7 @@ bwi_intr(void *xsc)
 uint32_t txrx_intr_status[BWI_TXRX_NRING];
 int i, txrx_error, tx = 0, rx_data = -1;

 +   printf(%s\n, __func__);
 if ((ifp-if_flags  IFF_RUNNING) == 0)
 return (0);


Ok, so patched as requested, recompiled the kernel. Including the
command itself, a new dmesg as it has some new information, the ps,
trace and show registers outputs.
Let me know if you need anything further.

command
sudo ifconfig bwi0 scan
bwi0: flags=8802bwi0: bwi_init_statechg
bwi0: bwi_stop
bwi0: bwi_power_on
BROADCAST,SIMPLbwi0: bbp atten: 0, rf atten: 3, ctrl1: 2, ctrl2: 65535
bwi0: bus rev 0
bwi0: MAC is disabled
bwi0: MAC was already disabled
EX,MULTICAST mtbwi0: PHY is linked
bwi0: bus rev 0
u 1500
bwi0: PHY is unlinked
lladdr 00:90:4b:72:9f:fd
  bwi0: RF calibration value: 0x003e
  priority: 4
 bwi0: bwi_rf_lo_update_11g
   groups: wlan
media: IEEE802.11 autoselect
status: no network
ieee80211: nwid bwi0: bus rev 0

bwi0: PHY is linked
bwi0: loaded firmware file ucode4.fw
bwi0: loaded firmware file pcm4.fw
bwi0: loaded firmware file b0g0initvals2.fw
bwi0: firmware rev 0x0127, patch level 0x000e
bwi0: IV count 438
bwi0: base tssi 50
bwi0: bwi_mac_set_ackrates
uvm_fault(0xd66bef30, 0x0, 0, 1) - e
kernel: page fault trap, code=0
Stopped at  0:uvm_fault(0xd66bef30, 0x0, 0, 1) - e
  kernel: page fault trap, code=0
Stopped at  db_read_bytes+0x17: movzbl  0(%esi,%ecx,1),%eax

dmesg post patch
OpenBSD 5.7-beta (GENERIC) #0: Mon Feb 23 14:11:44 NST 2015
r...@lucy.my.domain:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Mobile Intel(R) Pentium(R) 4 - M CPU 2.00GHz (GenuineIntel
686-class) 2 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,CNXT-ID,PERF
real mem  = 804675584 (767MB)
avail mem = 779153408 (743MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 01/07/04, BIOS32 rev. 0 @ 0xffe90, SMBIOS rev.
2.3 @ 0xf76a0 (62 entries)
bios0: vendor Dell Computer Corporation version A13 date 01/07/2004
bios0: Dell Computer Corporation Latitude C840
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP
acpi0: wakeup devices LID_(S3) PBTN(S4) PCI0(S3) UAR1(S3) USB0(S1)
USB1(S1) USB2(S1) MODM(S3) PCIE(S3) MPCI(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (AGP_)
acpiprt2 at acpi0: bus 2 (PCIE)
acpiprt3 at acpi0: bus -1 (MPCI)
acpicpu0 at acpi0acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: invalid _PSS length
: C2
acpipwrres0 at acpi0: PADA, resource for ADPT
acpitz0 at acpi0: critical temperature is 94 degC
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT0 not present
acpibat1 at acpi0: BAT1 not present
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: PBTN
acpibtn2 at acpi0: SBTN
acpidock0 at acpi0: GDCK not docked (0)
acpivideo0 at acpi0: VID_
bios0: ROM list: 0xc/0xf800 0xcf800/0x800!
cpu0 at mainbus0: (uniprocessor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 Intel 82845 Host rev 0x04
intelagp0 at pchb0
agp0 at intelagp0: aperture at 0xe800, size 0x400
ppb0 at pci0 dev 1 function 0 Intel 82845 AGP rev 0x04
pci1 at ppb0 bus 1
1:0:0: mem address conflict 0x8000/0x2
vga1 at pci1 dev 0 function 0 NVIDIA GeForce4 440 Go rev 0xa3

Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-22 Thread Stefan Sperling
On Sun, Feb 22, 2015 at 11:11:50PM -0330, Michael wrote:
  So it's running into a NULL pointer but it's still unclear where and why.
  Perhaps it's an unchecked allocation failure, perhaps some other problem.
 
  Are you comfortable with adding some debug printf to see which function in
  bwi is the last called one before the crash? Would you need help with that?
 
 Yes, I can add in some debugging if you could tell me how/where it is needed.
 I see in the later emails no-one else seems to have this issue so if
 it is just specific to my systems then I can do some further tests as
 needed.

Given what miod said the interrupt handler (bwi_intr) might be a good
plaec to start.

Though perhaps that is not even reached? Do you get any call to bwi_intr?
I don't know where to start debugging ioapic issues.

Index: bwi.c
===
RCS file: /cvs/src/sys/dev/ic/bwi.c,v
retrieving revision 1.116
diff -u -p -r1.116 bwi.c
--- bwi.c   10 Feb 2015 23:25:46 -  1.116
+++ bwi.c   23 Feb 2015 07:11:19 -
@@ -73,8 +73,9 @@
 
 #include uvm/uvm_extern.h
 
+#define BWI_DEBUG
 #ifdef BWI_DEBUG
-int bwi_debug = 1;
+int bwi_debug = 2;
 #define DPRINTF(l, x...)   do { if ((l) = bwi_debug) printf(x); } while 
(0)
 #else
 #define DPRINTF(l, x...)
@@ -578,6 +579,7 @@ bwi_intr(void *xsc)
uint32_t txrx_intr_status[BWI_TXRX_NRING];
int i, txrx_error, tx = 0, rx_data = -1;
 
+   printf(%s\n, __func__);
if ((ifp-if_flags  IFF_RUNNING) == 0)
return (0);
 



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-22 Thread Michael
 So it's running into a NULL pointer but it's still unclear where and why.
 Perhaps it's an unchecked allocation failure, perhaps some other problem.

 Are you comfortable with adding some debug printf to see which function in
 bwi is the last called one before the crash? Would you need help with that?

Yes, I can add in some debugging if you could tell me how/where it is needed.
I see in the later emails no-one else seems to have this issue so if
it is just specific to my systems then I can do some further tests as
needed.



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-21 Thread Stefan Sperling
On Fri, Feb 20, 2015 at 10:15:15PM -0330, Michael wrote:
 On 20 February 2015 at 05:03, Stuart Henderson st...@openbsd.org wrote:
  On 2015/02/19 17:30, Mike Larkin wrote:
  On Thu, Feb 19, 2015 at 09:02:42PM -0330, Michael wrote:
   
There's a slim chance that killing processes (sshd, smtpd, dhclient,
cron, pflogd, ntpd) might free up enough to help.
   
Maybe also worth trying ddb.console=0, it will try to print a stack
trace and then reboot rather than entering ddb.
   
  
   New and updated output after stopping the processes and setting
   ddb.console=0, however ddb is still entered and there wasn't a stack
   trace.
 
  I think ddb.panic was what he meant?
 
  Yes, sorry.
 
 
 No worries, got that below in the first few sections.
 I then decided to test in another machine that I have (noted as 
 dell) and the same thing happens. The dell has much more memory so
 should hopefully make debugging/compiling easier if you need anything.
 
 sudo ifconfig bwi0 up
 uvm_fault(0xd211a2d0, 0x0, 0, 1) - e
 fatal page fault (6) in supervisor mode
 trap type 6 code 0 eip 0 cs d0f60008 eflags 10202 cr2 0 cpl 60
 panic: trap type 6, code=0, pc=0
 Starting stack trace...
 panic(d09e1dca,f11adc10,d09e5a96,f11adc10,d0b3330c) at panic+0x85
 panic(d09e5a96,6,0,0,d0f60008) at panic+0x85
 trap() at trap+0x394
 --- trap (number 0) ---
 Bad frame pointer: 0xd0f69000
 0:
 End of stack trace.
 syncing disks... 4 4 4 done

So it's running into a NULL pointer but it's still unclear where and why.
Perhaps it's an unchecked allocation failure, perhaps some other problem.

Are you comfortable with adding some debug printf to see which function in
bwi is the last called one before the crash? Would you need help with that?



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-21 Thread Stefan Sperling
On Sat, Feb 21, 2015 at 09:03:43AM +0100, Stefan Sperling wrote:
 On Fri, Feb 20, 2015 at 10:15:15PM -0330, Michael wrote:
  sudo ifconfig bwi0 up
  uvm_fault(0xd211a2d0, 0x0, 0, 1) - e
  fatal page fault (6) in supervisor mode
  trap type 6 code 0 eip 0 cs d0f60008 eflags 10202 cr2 0 cpl 60
  panic: trap type 6, code=0, pc=0
  Starting stack trace...
  panic(d09e1dca,f11adc10,d09e5a96,f11adc10,d0b3330c) at panic+0x85
  panic(d09e5a96,6,0,0,d0f60008) at panic+0x85
  trap() at trap+0x394
  --- trap (number 0) ---
  Bad frame pointer: 0xd0f69000
  0:
  End of stack trace.
  syncing disks... 4 4 4 done
 
 So it's running into a NULL pointer but it's still unclear where and why.
 Perhaps it's an unchecked allocation failure, perhaps some other problem.
 
 Are you comfortable with adding some debug printf to see which function in
 bwi is the last called one before the crash? Would you need help with that?

FWIW, I have the same Broadcom BCM4306 device in a macppc box.
I don't see your problem on this system -- the device works, apart
from the usual poor level of performance.
Unfortunately the Apple card won't fit into any of my i386 machines.

[ using 551876 bytes of bsd ELF symbol table ]
console out [NVDA,Display-A]console in [keyboard] USB and ADB found, using ADB
using parent NVDA,Parent:: memaddr a000 size 1000, : consaddr a0008000, 
: ioaddr 9100, size 100: width 1024 linebytes 1024 height 768 depth 8
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2015 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 5.7-beta (GENERIC) #423: Tue Feb 17 18:21:24 MST 2015
t...@macppc.openbsd.org:/usr/src/sys/arch/macppc/compile/GENERIC
real mem = 1342177280 (1280MB)
avail mem = 1286549504 (1226MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root: model PowerBook6,8
cpu0 at mainbus0: 7447A (Revision 0x102): 1499 MHz: 512KB L2 cache
mem0 at mainbus0
spdmem0 at mem0: no EEPROM found
spdmem1 at mem0: 1GB DDR SDRAM non-parity PC3200CL3.0
memc0 at mainbus0: uni-n rev 0xd2
hw-clock at memc0 not configured
kiic0 at memc0 offset 0xf8001000
iic0 at kiic0
adt0 at iic0 addr 0x2e: adt7467 rev 0x71
asms0 at iic0 addr 0x58: rev 1.34, version 0.1
mpcpcibr0 at mainbus0 pci: uni-north
pci0 at mpcpcibr0 bus 0
pchb0 at pci0 dev 11 function 0 Apple UniNorth AGP rev 0x00
vgafb0 at pci0 dev 16 function 0 NVIDIA GeForce FX Go 5200 rev 0xa1
wsdisplay0 at vgafb0 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
mpcpcibr1 at mainbus0 pci: uni-north
pci1 at mpcpcibr1 bus 0
macobio0 at pci1 dev 23 function 0 Apple Intrepid rev 0x00
openpic0 at macobio0 offset 0x4: version 0x4614 feature 3f0302 LE
macgpio0 at macobio0 offset 0x50
modem-reset at macgpio0 offset 0x1d not configured
modem-power at macgpio0 offset 0x1c not configured
accelerometer-1 at macgpio0 offset 0x13 not configured
accelerometer-2 at macgpio0 offset 0x14 not configured
headphone-mute at macgpio0 offset 0x1f not configured
amp-mute at macgpio0 offset 0x20 not configured
hw-reset at macgpio0 offset 0x25 not configured
linein-detect at macgpio0 offset 0xc not configured
headphone-detect at macgpio0 offset 0x17 not configured
macgpio1 at macgpio0 offset 0x9: irq 47
programmer-switch at macgpio0 offset 0x11 not configured
dfs0 at macgpio0 offset 0x6b: speeds: 1499, 749 MHz
gpio4 at macgpio0 offset 0x1e not configured
escc-legacy at macobio0 offset 0x12000 not configured
zsc0 at macobio0 offset 0x13000: irq 22,23
zstty0 at zsc0 channel 0
zstty1 at zsc0 channel 1
snapper0 at macobio0 offset 0x0: irq 30,1,2
timer at macobio0 offset 0x15000 not configured
adb0 at macobio0 offset 0x16000: irq 25, via-pmu, 2 targets
apm0 at adb0: battery flags 0x5, 85% charged
piic0 at adb0
iic1 at piic0
akbd0 at adb0 addr 2: PowerBook G4 keyboard (Inverted T)
wskbd0 at akbd0: console keyboard, using wsdisplay0
abtn0 at adb0 addr 7: brightness/volume/eject buttons
battery at macobio0 offset 0x0 not configured
backlight at macobio0 offset 0xf300 not configured
kiic1 at macobio0 offset 0x18000
iic2 at kiic1
wdc0 at macobio0 offset 0x2 irq 24: DMA
atapiscsi0 at wdc0 channel 0 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: MATSHITA, DVD-R UJ-845E, DMP2 ATAPI 5/cdrom 
removable
cd0(wdc0:0:0): using BIOS timings, DMA mode 2
audio0 at snapper0
bwi0 at pci1 dev 18 function 0 Broadcom BCM4306 rev 0x03: irq 52, address 
00:11:24:95:a7:eb
ohci0 at pci1 dev 26 function 0 Apple Intrepid USB rev 0x00: irq 29, version 
1.0, legacy support
ohci1 at pci1 dev 27 function 0 NEC USB rev 0x43: irq 63, version 1.0
ohci2 at pci1 dev 27 function 1 NEC USB rev 0x43: irq 63, version 1.0
ehci0 at pci1 dev 27 function 2 NEC USB rev 0x04: irq 63
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 NEC EHCI root hub rev 2.00/1.00 addr 1
usb1 at ohci0: USB revision 1.0
uhub1 at usb1 Apple OHCI root hub rev 1.00/1.00 addr 1
usb2 at ohci1: 

Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-21 Thread Miod Vallat
 On Sat, Feb 21, 2015 at 09:03:43AM +0100, Stefan Sperling wrote:
  On Fri, Feb 20, 2015 at 10:15:15PM -0330, Michael wrote:
   sudo ifconfig bwi0 up
   uvm_fault(0xd211a2d0, 0x0, 0, 1) - e
   fatal page fault (6) in supervisor mode
   trap type 6 code 0 eip 0 cs d0f60008 eflags 10202 cr2 0 cpl 60
   panic: trap type 6, code=0, pc=0
   Starting stack trace...
   panic(d09e1dca,f11adc10,d09e5a96,f11adc10,d0b3330c) at panic+0x85
   panic(d09e5a96,6,0,0,d0f60008) at panic+0x85
   trap() at trap+0x394
   --- trap (number 0) ---
   Bad frame pointer: 0xd0f69000
   0:
   End of stack trace.
   syncing disks... 4 4 4 done
  
  So it's running into a NULL pointer but it's still unclear where and why.
  Perhaps it's an unchecked allocation failure, perhaps some other problem.
  
  Are you comfortable with adding some debug printf to see which function in
  bwi is the last called one before the crash? Would you need help with that?
 
 FWIW, I have the same Broadcom BCM4306 device in a macppc box.
 I don't see your problem on this system -- the device works, apart
 from the usual poor level of performance.

I can't reproduce either with

bwi0 at pci1 dev 3 function 0 Broadcom BCM4306 rev 0x03: apic 1 int 19, 
address 00:0b:7d:19:27:01

on i386.



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-21 Thread Miod Vallat
  FWIW, I have the same Broadcom BCM4306 device in a macppc box.
  I don't see your problem on this system -- the device works, apart
  from the usual poor level of performance.
 
 I can't reproduce either with
 
 bwi0 at pci1 dev 3 function 0 Broadcom BCM4306 rev 0x03: apic 1 int 19, 
 address 00:0b:7d:19:27:01
 
 on i386.

... which means this is likely a non-ioapic vs ioapic issue; as soon as
the device interrupts, it will cause the fault somehow on the non-ioapic
system.



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-20 Thread Stuart Henderson
On 2015/02/19 17:30, Mike Larkin wrote:
 On Thu, Feb 19, 2015 at 09:02:42PM -0330, Michael wrote:
  
   There's a slim chance that killing processes (sshd, smtpd, dhclient,
   cron, pflogd, ntpd) might free up enough to help.
  
   Maybe also worth trying ddb.console=0, it will try to print a stack
   trace and then reboot rather than entering ddb.
  
  
  New and updated output after stopping the processes and setting
  ddb.console=0, however ddb is still entered and there wasn't a stack
  trace.
 
 I think ddb.panic was what he meant?

Yes, sorry.



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-20 Thread Michael
On 20 February 2015 at 05:03, Stuart Henderson st...@openbsd.org wrote:
 On 2015/02/19 17:30, Mike Larkin wrote:
 On Thu, Feb 19, 2015 at 09:02:42PM -0330, Michael wrote:
  
   There's a slim chance that killing processes (sshd, smtpd, dhclient,
   cron, pflogd, ntpd) might free up enough to help.
  
   Maybe also worth trying ddb.console=0, it will try to print a stack
   trace and then reboot rather than entering ddb.
  
 
  New and updated output after stopping the processes and setting
  ddb.console=0, however ddb is still entered and there wasn't a stack
  trace.

 I think ddb.panic was what he meant?

 Yes, sorry.


No worries, got that below in the first few sections.
I then decided to test in another machine that I have (noted as 
dell) and the same thing happens. The dell has much more memory so
should hopefully make debugging/compiling easier if you need anything.

sudo ifconfig bwi0 up
uvm_fault(0xd211a2d0, 0x0, 0, 1) - e
fatal page fault (6) in supervisor mode
trap type 6 code 0 eip 0 cs d0f60008 eflags 10202 cr2 0 cpl 60
panic: trap type 6, code=0, pc=0
Starting stack trace...
panic(d09e1dca,f11adc10,d09e5a96,f11adc10,d0b3330c) at panic+0x85
panic(d09e5a96,6,0,0,d0f60008) at panic+0x85
trap() at trap+0x394
--- trap (number 0) ---
Bad frame pointer: 0xd0f69000
0:
End of stack trace.
syncing disks... 4 4 4 done

dumping to dev 1, offset 5951

top output before command
load averages:  1.22,  0.59,  0.24   18:14:41
5 threads: 4 idle, 1 on processor
CPU states:  2.5% user,  0.0% nice,  0.8% system,  0.0% interrupt, 96.6% idle
Memory: Real: 4624K/28M act/tot Free: 23M Cache: 10M Swap: 0K/67M

  PID USERNAME PRI NICE  SIZE   RES STATE WAIT  TIMECPU COMMAND
21209 mike  370  804K 1764K onproc- 0:00  1.32% top -CH -s
21791 _syslogd   20  964K 1260K sleep kqread0:00  0.00% /usr/sbin/s
11789 mike  180  648K  648K sleep pause 0:00  0.00% -ksh
1 root  100  544K  468K sleep wait  0:00  0.00% /sbin/init
28592 root   20  964K 1140K idle  netio 0:00  0.00% syslogd: [p

 dell
Then there are the Dell results which I have to take via a camera
unfortunately, here are the images:
http://imgur.com/a/UMZLP/embed#0
9# is registers
8# ps page 1
7# ps page 2
6# ps page 3  trace
5# dmesg page 1
4# dmesg page 2
3# dmesg page 3
2# dmesg page 4
1# dmesg page 5



uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-19 Thread Michael
Hi,
When doing a scan or bringing up the bwi0 interface a uvm fault occurs.
This is always repeatable and nothing specific has to be set.
Have a boot dump from the same crash before this one if needed.

sudo ifconfig bwi0 scan
bwi0: flags=8802BROADCAST,SIMPLEX,MULTICAST mtu 1500
lladdr 00:90:4b:72:9f:fd
priority: 4
groups: wlan
media: IEEE802.11 autoselect
status: no network
ieee80211: nwid 
uvm_fault(0xd211ab40, 0x0, 0, 1) - e
kernel: page fault trap, code=0
Stopped at  0:uvm_fault(0xd211ab40, 0x0, 0, 1) - e
  kernel: page fault trap, code=0
Stopped at  db_read_bytes+0x17: movzbl  0(%esi,%ecx,1),%eax

sudo ifconfig bwi0 up
uvm_fault(0xd211a090, 0x0, 0, 1) - e
kernel: page fault trap, code=0
Stopped at  0:uvm_fault(0xd211a090, 0x0, 0, 1) - e
  kernel: page fault trap, code=0
Stopped at  db_read_bytes+0x17: movzbl  0(%esi,%ecx,1),%eax

ps output
ddb ps
   PID   PPID   PGRPUID  S   FLAGS  WAIT  COMMAND
*15136   6265  15136  0  7 0x3ifconfig
  6265  1   6265   1000  30x8b  pause ksh
 18552  1  18552  0  30x80  poll  cron
 22718  11308  11308 95  30x90  kqreadsmtpd
 15221  11308  11308 95  30x90  kqreadsmtpd
 27655  11308  11308 95  30x90  kqreadsmtpd
 29322  11308  11308 95  30x90  kqreadsmtpd
 15526  11308  11308 95  30x90  kqreadsmtpd
   321  11308  11308103  30x90  kqreadsmtpd
 11308  1  11308  0  30x80  kqreadsmtpd
 29729  1  29729  0  30x80  selectsshd
 26808  17763  24559 83  30x90  poll  ntpd
 17763  24559  24559 83  30x90  poll  ntpd
 24559  1  24559  0  30x80  poll  ntpd
 23526  14092  14092 74  30x90  bpf   pflogd
 14092  1  14092  0  30x80  netio pflogd
 17811  15746  15746 73  20x90syslogd
 15746  1  15746  0  30x80  netio syslogd
 14555  1  14555 77  30x90  poll  dhclient
 16744  1  16744  0  3   0  biowait   dhclient
  5232  0  0  0  3 0x14200  pgzerozerothread
 22289  0  0  0  3 0x14200  aiodoned  aiodoned
  8005  0  0  0  3 0x14200  syncerupdate
  4115  0  0  0  3 0x14200  cleaner   cleaner
 31998  0  0  0  3 0x14200  reaperreaper
 23513  0  0  0  3 0x14200  pgdaemon  pagedaemon
  5155  0  0  0  3 0x14200  bored crypto
 25457  0  0  0  3 0x14200  pftm  pfpurge
 28643  0  0  0  3 0x14200  bored systqmp
 10239  0  0  0  3 0x14200  bored systq
 20780  0  0  0  3  0x40014200idle0
  5455  0  0  0  3 0x14200  kmalloc   kmthread
 1  0  1  0  30x82  wait  init
 0 -1  0  0  3 0x10200  scheduler swapper

trace output
ddb trace
db_read_bytes(0,1,f116aae0,0,f116aaf0) at db_read_bytes+0x17
db_get_value(0,1,0,0,d09e187a) at db_get_value+0x38
db_disasm(0,0,d03cc480,d03cc4a5,d09b68d8,f116abb0,0,0,f116abb0) at db_disasm+0x
31
db_print_loc_and_inst(0,f116abc8,f116abd4,d03cc4a5,d09e186b) at db_print_loc_an
d_inst+0x3e
db_trap(6,0,58,0,f116ac10) at db_trap+0x89
kdb_trap(6,0,f116ac80,1,e) at kdb_trap+0xcc
trap() at trap+0x2e5
--- trap (number 0) ---
Bad frame pointer: 0xd0f69000
0:

dmesg
OpenBSD 5.7-beta (GENERIC) #714: Tue Feb 17 12:45:41 MST 2015
t...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: AMD Am5x86 W/B 133/160 (AuthenticAMD 486-class)
cpu0: FPU
real mem  = 66600960 (63MB)
avail mem = 53186560 (50MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 20/80/03, BIOS32 rev. 0 @ 0xf7840
pcibios0 at bios0: rev 2.0 @ 0xf/0x1
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xc8000/0x9000
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
elansc0 at pci0 dev 0 function 0 AMD ElanSC520 PCI rev 0x00: product 0 steppi
ng 1.1, CPU clock 133MHz, reset 40SCP
gpio0 at elansc0: 32 pins
bwi0 at pci0 dev 16 function 0 Broadcom BCM4306 rev 0x02: irq 10, address 00:
90:4b:72:9f:fd
sis0 at pci0 dev 18 function 0 NS DP83815 10/100 rev 0x00, DP83816A: irq 11, a
ddress 00:00:24:c4:e7:60
nsphyter0 at sis0 phy 0: DP83815 10/100 PHY, rev. 1
sis1 at pci0 dev 19 function 0 NS DP83815 10/100 rev 0x00, DP83816A: irq 5, a
ddress 00:00:24:c4:e7:61
nsphyter1 at sis1 phy 0: DP83815 10/100 PHY, rev. 1
sis2 at pci0 dev 20 function 0 NS DP83815 10/100 

Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-19 Thread Mike Larkin
On Thu, Feb 19, 2015 at 09:02:42PM -0330, Michael wrote:
 
  There's a slim chance that killing processes (sshd, smtpd, dhclient,
  cron, pflogd, ntpd) might free up enough to help.
 
  Maybe also worth trying ddb.console=0, it will try to print a stack
  trace and then reboot rather than entering ddb.
 
 
 New and updated output after stopping the processes and setting
 ddb.console=0, however ddb is still entered and there wasn't a stack
 trace.

I think ddb.panic was what he meant?

-ml

 
 sudo ifconfig bwi0 up
 uvm_fault(0xd211a6c0, 0x0, 0, 1) - e
 kernel: page fault trap, code=0
 Stopped at  0:uvm_fault(0xd211a6c0, 0x0, 0, 1) - e
   kernel: page fault trap, code=0
 Stopped at  db_read_bytes+0x17: movzbl  0(%esi,%ecx,1),%eax
 
 
 ddb ps
PID   PPID   PGRPUID  S   FLAGS  WAIT  COMMAND
 *29704  16328  29704  0  7 0x3ifconfig
  16328  1  16328   1000  30x8b  pause ksh
  14833  26227  26227 73  20x90syslogd
  26227  1  26227  0  30x80  netio syslogd
  17845  0  0  0  2 0x14200zerothread
  18141  0  0  0  3 0x14200  aiodoned  aiodoned
   1894  0  0  0  3 0x14200  syncerupdate
  27861  0  0  0  3 0x14200  cleaner   cleaner
  23566  0  0  0  3 0x14200  reaperreaper
  11132  0  0  0  3 0x14200  pgdaemon  pagedaemon
  28889  0  0  0  3 0x14200  bored crypto
   7559  0  0  0  3 0x14200  pftm  pfpurge
  22720  0  0  0  3 0x14200  bored systqmp
  23801  0  0  0  3 0x14200  bored systq
  18116  0  0  0  3  0x40014200idle0
  12202  0  0  0  3 0x14200  kmalloc   kmthread
  1  0  1  0  30x82  wait  init
  0 -1  0  0  3 0x10200  scheduler swapper
 
 ddb show registers
 ds  0x10
 es  0x10
 fs  0x20
 gs 0
 edi   0xf11adae0
 esi0
 ebp   0xf11adac4
 ebx  0x1
 edx   0xf11adae0
 ecx0
 eax0
 eip   0xd055a447db_read_bytes+0x17
 cs   0x8
 eflags   0x10246
 esp   0xf11adaac
 ss  0x10
 db_read_bytes+0x17: movzbl  0(%esi,%ecx,1),%eax
 
 ddb dmesg
 OpenBSD 5.7-beta (GENERIC) #714: Tue Feb 17 12:45:41 MST 2015
 t...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
 cpu0: AMD Am5x86 W/B 133/160 (AuthenticAMD 486-class)
 cpu0: FPU
 real mem  = 66600960 (63MB)
 avail mem = 53186560 (50MB)
 mpath0 at root
 scsibus0 at mpath0: 256 targets
 mainbus0 at root
 bios0 at mainbus0: date 20/80/03, BIOS32 rev. 0 @ 0xf7840
 pcibios0 at bios0: rev 2.0 @ 0xf/0x1
 pcibios0: pcibios_get_intr_routing - function not supported
 pcibios0: PCI IRQ Routing information unavailable.
 pcibios0: PCI bus #0 is the last bus
 bios0: ROM list: 0xc8000/0x9000
 cpu0 at mainbus0: (uniprocessor)
 pci0 at mainbus0 bus 0: configuration mode 1 (bios)
 elansc0 at pci0 dev 0 function 0 AMD ElanSC520 PCI rev 0x00: product 0 
 steppi
 ng 1.1, CPU clock 133MHz, reset 40SCP
 gpio0 at elansc0: 32 pins
 bwi0 at pci0 dev 16 function 0 Broadcom BCM4306 rev 0x02: irq 10, address 
 00:
 90:4b:72:9f:fd
 sis0 at pci0 dev 18 function 0 NS DP83815 10/100 rev 0x00, DP83816A: irq 
 11, a
 ddress 00:00:24:c4:e7:60
 nsphyter0 at sis0 phy 0: DP83815 10/100 PHY, rev. 1
 sis1 at pci0 dev 19 function 0 NS DP83815 10/100 rev 0x00, DP83816A: irq 5, 
 a
 ddress 00:00:24:c4:e7:61
 nsphyter1 at sis1 phy 0: DP83815 10/100 PHY, rev. 1
 sis2 at pci0 dev 20 function 0 NS DP83815 10/100 rev 0x00, DP83816A: irq 9, 
 a
 ddress 00:00:24:c4:e7:62
 nsphyter2 at sis2 phy 0: DP83815 10/100 PHY, rev. 1
 isa0 at mainbus0
 isadma0 at isa0
 com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
 com0: console
 com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
 pckbc0 at isa0 port 0x60/5
 pckbd0 at pckbc0 (kbd slot)
 pckbc0: using irq 1 for kbd slot
 wskbd0 at pckbd0: console keyboard
 wdc0 at isa0 port 0x1f0/8 irq 14
 wd0 at wdc0 channel 0 drive 0: SanDisk SDCFH-004G
 wd0: 1-sector PIO, LBA48, 3815MB, 7813120 sectors
 wd0(wdc0:0:0): using BIOS timings
 pcppi0 at isa0 port 0x61
 spkr0 at pcppi0
 npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
 vscsi0 at root
 scsibus1 at vscsi0: 256 targets
 softraid0 at root
 scsibus2 at softraid0: 256 targets
 root on wd0a (cbaa94e16775c203.a) swap on wd0b dump on wd0b
 uvm_fault(0xd211a6c0, 0x0, 0, 1) - e
 kernel: page fault trap, code=0
 Stopped at  0:  uvm_fault(0xd211a6c0, 0x0, 0, 1) - e
 kernel: page fault trap, code=0
 Stopped at  db_read_bytes+0x17: movzbl  0(%esi,%ecx,1),%eax
 
 Console boot
 OpenBSD 

Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-19 Thread Stuart Henderson
On 2015/02/19 20:08, Michael wrote:
 On 19 February 2015 at 19:57, Stefan Sperling s...@stsp.name wrote:
  On Thu, Feb 19, 2015 at 06:26:10PM -0330, Michael wrote:
  Hi,
  When doing a scan or bringing up the bwi0 interface a uvm fault occurs.
  This is always repeatable and nothing specific has to be set.
  Have a boot dump from the same crash before this one if needed.
 
  The ps output shows an ifconfig process but the kernel trace
  looks like it ends up crashing in ddb rather than showing us
  where ifconfig ended up. ddb would likely show more useful
  information if it didn't crash.
 
  Any chance you could put more memory into this machine and see
  if you get a functional ddb prompt then? If you get a working ddb
  trace perhaps we could infer more information about the actual problem.
 
 Unfortunately I can't, it's a Soekris 4501, the 64MB is soldered
 onboard and there isn't any way to upgrade it. Would adding more swap
 help at all?

There's a slim chance that killing processes (sshd, smtpd, dhclient,
cron, pflogd, ntpd) might free up enough to help.

Maybe also worth trying ddb.console=0, it will try to print a stack
trace and then reboot rather than entering ddb.



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-19 Thread Stefan Sperling
On Thu, Feb 19, 2015 at 06:26:10PM -0330, Michael wrote:
 Hi,
 When doing a scan or bringing up the bwi0 interface a uvm fault occurs.
 This is always repeatable and nothing specific has to be set.
 Have a boot dump from the same crash before this one if needed.

The ps output shows an ifconfig process but the kernel trace
looks like it ends up crashing in ddb rather than showing us
where ifconfig ended up. ddb would likely show more useful
information if it didn't crash.

Any chance you could put more memory into this machine and see
if you get a functional ddb prompt then? If you get a working ddb
trace perhaps we could infer more information about the actual problem.

 ddb ps
PID   PPID   PGRPUID  S   FLAGS  WAIT  COMMAND
 *15136   6265  15136  0  7 0x3ifconfig

 ddb trace
 db_read_bytes(0,1,f116aae0,0,f116aaf0) at db_read_bytes+0x17

 real mem  = 66600960 (63MB)
 avail mem = 53186560 (50MB)



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-19 Thread Michael
On 19 February 2015 at 19:57, Stefan Sperling s...@stsp.name wrote:
 On Thu, Feb 19, 2015 at 06:26:10PM -0330, Michael wrote:
 Hi,
 When doing a scan or bringing up the bwi0 interface a uvm fault occurs.
 This is always repeatable and nothing specific has to be set.
 Have a boot dump from the same crash before this one if needed.

 The ps output shows an ifconfig process but the kernel trace
 looks like it ends up crashing in ddb rather than showing us
 where ifconfig ended up. ddb would likely show more useful
 information if it didn't crash.

 Any chance you could put more memory into this machine and see
 if you get a functional ddb prompt then? If you get a working ddb
 trace perhaps we could infer more information about the actual problem.

Unfortunately I can't, it's a Soekris 4501, the 64MB is soldered
onboard and there isn't any way to upgrade it. Would adding more swap
help at all?


 ddb ps
PID   PPID   PGRPUID  S   FLAGS  WAIT  COMMAND
 *15136   6265  15136  0  7 0x3ifconfig

 ddb trace
 db_read_bytes(0,1,f116aae0,0,f116aaf0) at db_read_bytes+0x17

 real mem  = 66600960 (63MB)
 avail mem = 53186560 (50MB)



Re: uvm_fault with bwi on i386 when scanning or bringing up.

2015-02-19 Thread Michael

 There's a slim chance that killing processes (sshd, smtpd, dhclient,
 cron, pflogd, ntpd) might free up enough to help.

 Maybe also worth trying ddb.console=0, it will try to print a stack
 trace and then reboot rather than entering ddb.


New and updated output after stopping the processes and setting
ddb.console=0, however ddb is still entered and there wasn't a stack
trace.

sudo ifconfig bwi0 up
uvm_fault(0xd211a6c0, 0x0, 0, 1) - e
kernel: page fault trap, code=0
Stopped at  0:uvm_fault(0xd211a6c0, 0x0, 0, 1) - e
  kernel: page fault trap, code=0
Stopped at  db_read_bytes+0x17: movzbl  0(%esi,%ecx,1),%eax


ddb ps
   PID   PPID   PGRPUID  S   FLAGS  WAIT  COMMAND
*29704  16328  29704  0  7 0x3ifconfig
 16328  1  16328   1000  30x8b  pause ksh
 14833  26227  26227 73  20x90syslogd
 26227  1  26227  0  30x80  netio syslogd
 17845  0  0  0  2 0x14200zerothread
 18141  0  0  0  3 0x14200  aiodoned  aiodoned
  1894  0  0  0  3 0x14200  syncerupdate
 27861  0  0  0  3 0x14200  cleaner   cleaner
 23566  0  0  0  3 0x14200  reaperreaper
 11132  0  0  0  3 0x14200  pgdaemon  pagedaemon
 28889  0  0  0  3 0x14200  bored crypto
  7559  0  0  0  3 0x14200  pftm  pfpurge
 22720  0  0  0  3 0x14200  bored systqmp
 23801  0  0  0  3 0x14200  bored systq
 18116  0  0  0  3  0x40014200idle0
 12202  0  0  0  3 0x14200  kmalloc   kmthread
 1  0  1  0  30x82  wait  init
 0 -1  0  0  3 0x10200  scheduler swapper

ddb show registers
ds  0x10
es  0x10
fs  0x20
gs 0
edi   0xf11adae0
esi0
ebp   0xf11adac4
ebx  0x1
edx   0xf11adae0
ecx0
eax0
eip   0xd055a447db_read_bytes+0x17
cs   0x8
eflags   0x10246
esp   0xf11adaac
ss  0x10
db_read_bytes+0x17: movzbl  0(%esi,%ecx,1),%eax

ddb dmesg
OpenBSD 5.7-beta (GENERIC) #714: Tue Feb 17 12:45:41 MST 2015
t...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: AMD Am5x86 W/B 133/160 (AuthenticAMD 486-class)
cpu0: FPU
real mem  = 66600960 (63MB)
avail mem = 53186560 (50MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 20/80/03, BIOS32 rev. 0 @ 0xf7840
pcibios0 at bios0: rev 2.0 @ 0xf/0x1
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xc8000/0x9000
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
elansc0 at pci0 dev 0 function 0 AMD ElanSC520 PCI rev 0x00: product 0 steppi
ng 1.1, CPU clock 133MHz, reset 40SCP
gpio0 at elansc0: 32 pins
bwi0 at pci0 dev 16 function 0 Broadcom BCM4306 rev 0x02: irq 10, address 00:
90:4b:72:9f:fd
sis0 at pci0 dev 18 function 0 NS DP83815 10/100 rev 0x00, DP83816A: irq 11, a
ddress 00:00:24:c4:e7:60
nsphyter0 at sis0 phy 0: DP83815 10/100 PHY, rev. 1
sis1 at pci0 dev 19 function 0 NS DP83815 10/100 rev 0x00, DP83816A: irq 5, a
ddress 00:00:24:c4:e7:61
nsphyter1 at sis1 phy 0: DP83815 10/100 PHY, rev. 1
sis2 at pci0 dev 20 function 0 NS DP83815 10/100 rev 0x00, DP83816A: irq 9, a
ddress 00:00:24:c4:e7:62
nsphyter2 at sis2 phy 0: DP83815 10/100 PHY, rev. 1
isa0 at mainbus0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
wdc0 at isa0 port 0x1f0/8 irq 14
wd0 at wdc0 channel 0 drive 0: SanDisk SDCFH-004G
wd0: 1-sector PIO, LBA48, 3815MB, 7813120 sectors
wd0(wdc0:0:0): using BIOS timings
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on wd0a (cbaa94e16775c203.a) swap on wd0b dump on wd0b
uvm_fault(0xd211a6c0, 0x0, 0, 1) - e
kernel: page fault trap, code=0
Stopped at  0:  uvm_fault(0xd211a6c0, 0x0, 0, 1) - e
kernel: page fault trap, code=0
Stopped at  db_read_bytes+0x17: movzbl  0(%esi,%ecx,1),%eax

Console boot
OpenBSD 5.7-beta (GENERIC) #714: Tue Feb 17 12:45:41 MST 2015
t...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: AMD Am5x86 W/B 133/160 (AuthenticAMD 486-class)
cpu0: FPU
real mem  = 66600960 (63MB)
avail mem = 53186560