Re: alc0 panic and splassert: assertwaitok: want -1 have 1

2011-01-31 Thread Gabriel Linder

On 01/30/11 14:39, Mike Belopuhov wrote:

hi, if you haven't fixed it yet, here's a diff.  it also fixes a
error/!error logic bug.  could you please try it out?


Thank you, I made a more complete diff fixing a few more problems 
http://marc.info/?l=openbsd-techm=129636716819943w=2 - I missed the 
error/!error logic bug, though. I updated my diff to take your changes, 
everything works ok. Complete and up-to-date diff at 
http://dargor.servebeer.com/~dargor/openbsd/if_alc_fix5.diff



alc_newbuf is always called from the interrupt context so it can't
sleep in any case.


Bret Lambert pointed that out, it works indeed.


Index: if_alc.c
===
RCS file: /cvs/src/sys/dev/pci/if_alc.c,v
retrieving revision 1.9
diff -u -p -r1.9 if_alc.c
--- if_alc.c29 Jan 2011 08:13:46 -  1.9
+++ if_alc.c30 Jan 2011 13:32:59 -
@@ -104,7 +104,7 @@ voidalc_mac_config(struct alc_softc *);
  int   alc_miibus_readreg(struct device *, int, int);
  void  alc_miibus_statchg(struct device *);
  void  alc_miibus_writereg(struct device *, int, int, int);
-intalc_newbuf(struct alc_softc *, struct alc_rxdesc *, int);
+intalc_newbuf(struct alc_softc *, struct alc_rxdesc *);
  void  alc_phy_down(struct alc_softc *);
  void  alc_phy_reset(struct alc_softc *);
  void  alc_reset(struct alc_softc *);
@@ -1552,16 +1552,16 @@ alc_txeof(struct alc_softc *sc)
  }

  int
-alc_newbuf(struct alc_softc *sc, struct alc_rxdesc *rxd, int init)
+alc_newbuf(struct alc_softc *sc, struct alc_rxdesc *rxd)
  {
struct mbuf *m;
bus_dmamap_t map;
int error;

-   MGETHDR(m, init ? M_WAITOK : M_DONTWAIT, MT_DATA);
+   MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return (ENOBUFS);
-   MCLGET(m, init ? M_WAITOK : M_DONTWAIT);
+   MCLGET(m, M_DONTWAIT);
if (!(m-m_flags  M_EXT)) {
m_freem(m);
return (ENOBUFS);
@@ -1573,18 +1573,8 @@ alc_newbuf(struct alc_softc *sc, struct
sc-alc_cdata.alc_rx_sparemap, m, BUS_DMA_NOWAIT);

if (error != 0) {
-   if (!error) {
-   bus_dmamap_unload(sc-sc_dmat,
-   sc-alc_cdata.alc_rx_sparemap);
-   error = EFBIG;
-   printf(%s: too many segments?!\n,
-   sc-sc_dev.dv_xname);
-   }
m_freem(m);
-
-   if (init)
-   printf(%s: can't load RX mbuf\n, sc-sc_dev.dv_xname);
-
+   printf(%s: can't load RX mbuf\n, sc-sc_dev.dv_xname);
return (error);
}

@@ -1707,7 +1697,7 @@ alc_rxeof(struct alc_softc *sc, struct r
rxd =sc-alc_cdata.alc_rxdesc[rx_cons];
mp = rxd-rx_m;
/* Add a new receive buffer to the ring. */
-   if (alc_newbuf(sc, rxd, 0) != 0) {
+   if (alc_newbuf(sc, rxd) != 0) {
ifp-if_iqdrops++;
/* Reuse Rx buffers. */
if (sc-alc_cdata.alc_rxhead != NULL)
@@ -2293,7 +2283,7 @@ alc_init_rx_ring(struct alc_softc *sc)
rxd =sc-alc_cdata.alc_rxdesc[i];
rxd-rx_m = NULL;
rxd-rx_desc =rd-alc_rx_ring[i];
-   if (alc_newbuf(sc, rxd, 1) != 0)
+   if (alc_newbuf(sc, rxd) != 0)
return (ENOBUFS);
}




Re: alc0 panic and splassert: assertwaitok: want -1 have 1

2011-01-29 Thread Kevin Lo
Gabriel Linder wrote:
 On 01/27/11 09:13, Gabriel Linder wrote:
  When booting 4.9-beta/amd64 without a network cable plugged, I get a 
  lot of splassert failures.
 
  After changing kern.splassert to 3 I was able to get the following 
  trace (get with dmesg after a reboot) :
 
  OpenBSD 4.9-beta (GENERIC.MP) #786: Tue Jan 25 17:46:34 MST 2011
  t...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
  real mem = 1062797312 (1013MB)
  avail mem = 1020477440 (973MB)
  mainbus0 at root
  bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xf0760 (31 entries)
  bios0: vendor American Megatrends Inc. version 0904 date 08/12/2010
  bios0: ASUSTeK Computer INC. 1005PX
  acpi0 at bios0: rev 2
  acpi0: sleep states S0 S3 S4 S5
  acpi0: tables DSDT FACP APIC MCFG ECDT OEMB HPET GSCI SSDT SLIC
  acpi0: wakeup devices P0P1(S4) P0P4(S4) P0P5(S4) P0P6(S4) P0P7(S4)
  acpitimer0 at acpi0: 3579545 Hz, 24 bits
  acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
  cpu0 at mainbus0: apid 0 (boot processor)
  cpu0: Intel(R) Atom(TM) CPU N450 @ 1.66GHz, 1666.71 MHz
  cpu0: 
  FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,NXE,LONG
  cpu0: 512KB 64b/line 8-way L2 cache
  cpu0: apic clock running at 166MHz
  cpu1 at mainbus0: apid 1 (application processor)
  cpu1: Intel(R) Atom(TM) CPU N450 @ 1.66GHz, 1666.48 MHz
  cpu1: 
  FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,NXE,LONG
  cpu1: 512KB 64b/line 8-way L2 cache
  ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
  ioapic0: misconfigured as apic 1, remapped to apid 2
  acpimcfg0 at acpi0 addr 0xe000, bus 0-255
  acpiec0 at acpi0acpiec _REG failed, broken BIOS
 
  acpihpet0 at acpi0: 14318179 Hz
  acpiprt0 at acpi0: bus 0 (PCI0)
  acpiprt1 at acpi0: bus 4 (P0P4)
  acpiprt2 at acpi0: bus 2 (P0P5)
  acpiprt3 at acpi0: bus -1 (P0P6)
  acpiprt4 at acpi0: bus 1 (P0P7)
  acpiec at acpi0 not configured
  acpicpu0 at acpi0: C3, C2, C1, PSS
  acpicpu1 at acpi0: C3, C2, C1, PSS
  acpitz at acpi0 not configured
  acpibat at acpi0 not configured
  acpiac at acpi0 not configured
  acpiasus0 at acpi0
  acpibtn0 at acpi0: LID_
  acpibtn1 at acpi0: SLPB
  acpibtn2 at acpi0: PWRB
  acpivideo0 at acpi0: VGA_
  acpivout0 at acpivideo0: CRTD
  acpivout1 at acpivideo0: TVOD
  acpivout2 at acpivideo0: LCDD
  cpu0: Enhanced SpeedStep 1666 MHz: speeds: 1667, 1333, 1000 MHz
  pci0 at mainbus0 bus 0
  pchb0 at pci0 dev 0 function 0 Intel Pineview DMI rev 0x00
  vga1 at pci0 dev 2 function 0 Intel Pineview Video rev 0x00
  wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
  wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
  intagp0 at vga1
  agp0 at intagp0: aperture at 0xd000, size 0x1000
  inteldrm0 at vga1: apic 2 int 16 (irq 15)
  drm0 at inteldrm0
  Intel Pineview Video rev 0x00 at pci0 dev 2 function 1 not configured
  azalia0 at pci0 dev 27 function 0 Intel 82801GB HD Audio rev 0x02: 
  apic 2 int 22 (irq 4)
  azalia0: codecs: Realtek ALC269
  audio0 at azalia0
  ppb0 at pci0 dev 28 function 0 Intel 82801GB PCIE rev 0x02: apic 2 
  int 16 (irq 15)
  pci1 at ppb0 bus 4
  ppb1 at pci0 dev 28 function 1 Intel 82801GB PCIE rev 0x02: apic 2 
  int 17 (irq 10)
  pci2 at ppb1 bus 2
  athn0 at pci2 dev 0 function 0 Atheros AR2427 rev 0x01: apic 2 int 
  17 (irq 10)
  athn0: AR9285 rev 2 (1T1R), ROM rev 13, address 48:5d:60:24:0f:2b
  ppb2 at pci0 dev 28 function 3 Intel 82801GB PCIE rev 0x02: apic 2 
  int 19 (irq 11)
  pci3 at ppb2 bus 1
  alc0 at pci3 dev 0 function 0 Attansic Technology L2C rev 0xc0: apic 
  2 int 19 (irq 11), address 20:cf:30:70:8f:31
  atphy0 at alc0 phy 0: F1 10/100/1000 PHY, rev. 11
  uhci0 at pci0 dev 29 function 0 Intel 82801GB USB rev 0x02: apic 2 
  int 23 (irq 3)
  uhci1 at pci0 dev 29 function 1 Intel 82801GB USB rev 0x02: apic 2 
  int 19 (irq 11)
  uhci2 at pci0 dev 29 function 2 Intel 82801GB USB rev 0x02: apic 2 
  int 18 (irq 7)
  uhci3 at pci0 dev 29 function 3 Intel 82801GB USB rev 0x02: apic 2 
  int 16 (irq 15)
  ehci0 at pci0 dev 29 function 7 Intel 82801GB USB rev 0x02: apic 2 
  int 23 (irq 3)
  usb0 at ehci0: USB revision 2.0
  uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
  ppb3 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev 0xe2
  pci4 at ppb3 bus 5
  pcib0 at pci0 dev 31 function 0 Intel Tigerpoint LPC rev 0x02
  ahci0 at pci0 dev 31 function 2 Intel 82801GR AHCI rev 0x02: apic 2 
  int 21 (irq 5), AHCI 1.1
  scsibus0 at ahci0: 32 targets
  sd0 at scsibus0 targ 0 lun 0:ATA, WDC WD2500BEVT-8, 01.0  SCSI3 
  0/direct fixed
  sd0: 238475MB, 512 bytes/sec, 488397168 sec total
  ichiic0 at pci0 dev 31 function 3 Intel 82801GB SMBus rev 0x02: apic 
  2 int 21 (irq 11)
  iic0 at ichiic0
  spdmem0 at iic0 addr 0x50: 1GB DDR2 SDRAM non-parity PC2-6400CL5 SO-DIMM
  usb1 at 

Re: alc0 panic and splassert: assertwaitok: want -1 have 1

2011-01-28 Thread Gabriel Linder

On 01/27/11 09:13, Gabriel Linder wrote:
When booting 4.9-beta/amd64 without a network cable plugged, I get a 
lot of splassert failures.


After changing kern.splassert to 3 I was able to get the following 
trace (get with dmesg after a reboot) :


OpenBSD 4.9-beta (GENERIC.MP) #786: Tue Jan 25 17:46:34 MST 2011
t...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 1062797312 (1013MB)
avail mem = 1020477440 (973MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xf0760 (31 entries)
bios0: vendor American Megatrends Inc. version 0904 date 08/12/2010
bios0: ASUSTeK Computer INC. 1005PX
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC MCFG ECDT OEMB HPET GSCI SSDT SLIC
acpi0: wakeup devices P0P1(S4) P0P4(S4) P0P5(S4) P0P6(S4) P0P7(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Atom(TM) CPU N450 @ 1.66GHz, 1666.71 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,NXE,LONG

cpu0: 512KB 64b/line 8-way L2 cache
cpu0: apic clock running at 166MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Atom(TM) CPU N450 @ 1.66GHz, 1666.48 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,NXE,LONG

cpu1: 512KB 64b/line 8-way L2 cache
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 1, remapped to apid 2
acpimcfg0 at acpi0 addr 0xe000, bus 0-255
acpiec0 at acpi0acpiec _REG failed, broken BIOS

acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 4 (P0P4)
acpiprt2 at acpi0: bus 2 (P0P5)
acpiprt3 at acpi0: bus -1 (P0P6)
acpiprt4 at acpi0: bus 1 (P0P7)
acpiec at acpi0 not configured
acpicpu0 at acpi0: C3, C2, C1, PSS
acpicpu1 at acpi0: C3, C2, C1, PSS
acpitz at acpi0 not configured
acpibat at acpi0 not configured
acpiac at acpi0 not configured
acpiasus0 at acpi0
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpibtn2 at acpi0: PWRB
acpivideo0 at acpi0: VGA_
acpivout0 at acpivideo0: CRTD
acpivout1 at acpivideo0: TVOD
acpivout2 at acpivideo0: LCDD
cpu0: Enhanced SpeedStep 1666 MHz: speeds: 1667, 1333, 1000 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 Intel Pineview DMI rev 0x00
vga1 at pci0 dev 2 function 0 Intel Pineview Video rev 0x00
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
intagp0 at vga1
agp0 at intagp0: aperture at 0xd000, size 0x1000
inteldrm0 at vga1: apic 2 int 16 (irq 15)
drm0 at inteldrm0
Intel Pineview Video rev 0x00 at pci0 dev 2 function 1 not configured
azalia0 at pci0 dev 27 function 0 Intel 82801GB HD Audio rev 0x02: 
apic 2 int 22 (irq 4)

azalia0: codecs: Realtek ALC269
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 Intel 82801GB PCIE rev 0x02: apic 2 
int 16 (irq 15)

pci1 at ppb0 bus 4
ppb1 at pci0 dev 28 function 1 Intel 82801GB PCIE rev 0x02: apic 2 
int 17 (irq 10)

pci2 at ppb1 bus 2
athn0 at pci2 dev 0 function 0 Atheros AR2427 rev 0x01: apic 2 int 
17 (irq 10)

athn0: AR9285 rev 2 (1T1R), ROM rev 13, address 48:5d:60:24:0f:2b
ppb2 at pci0 dev 28 function 3 Intel 82801GB PCIE rev 0x02: apic 2 
int 19 (irq 11)

pci3 at ppb2 bus 1
alc0 at pci3 dev 0 function 0 Attansic Technology L2C rev 0xc0: apic 
2 int 19 (irq 11), address 20:cf:30:70:8f:31

atphy0 at alc0 phy 0: F1 10/100/1000 PHY, rev. 11
uhci0 at pci0 dev 29 function 0 Intel 82801GB USB rev 0x02: apic 2 
int 23 (irq 3)
uhci1 at pci0 dev 29 function 1 Intel 82801GB USB rev 0x02: apic 2 
int 19 (irq 11)
uhci2 at pci0 dev 29 function 2 Intel 82801GB USB rev 0x02: apic 2 
int 18 (irq 7)
uhci3 at pci0 dev 29 function 3 Intel 82801GB USB rev 0x02: apic 2 
int 16 (irq 15)
ehci0 at pci0 dev 29 function 7 Intel 82801GB USB rev 0x02: apic 2 
int 23 (irq 3)

usb0 at ehci0: USB revision 2.0
uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
ppb3 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev 0xe2
pci4 at ppb3 bus 5
pcib0 at pci0 dev 31 function 0 Intel Tigerpoint LPC rev 0x02
ahci0 at pci0 dev 31 function 2 Intel 82801GR AHCI rev 0x02: apic 2 
int 21 (irq 5), AHCI 1.1

scsibus0 at ahci0: 32 targets
sd0 at scsibus0 targ 0 lun 0:ATA, WDC WD2500BEVT-8, 01.0  SCSI3 
0/direct fixed

sd0: 238475MB, 512 bytes/sec, 488397168 sec total
ichiic0 at pci0 dev 31 function 3 Intel 82801GB SMBus rev 0x02: apic 
2 int 21 (irq 11)

iic0 at ichiic0
spdmem0 at iic0 addr 0x50: 1GB DDR2 SDRAM non-parity PC2-6400CL5 SO-DIMM
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 Intel UHCI root hub rev 1.00/1.00 addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 Intel UHCI root hub rev 1.00/1.00 addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 Intel UHCI root hub