USB ure RTL8153 panics on release 6.7 + 001_wscons

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

USB ure RTL8153 panics on release 6.7 + 001_wscons

Jonathon Fletcher-2

>Synopsis: ure RTL8153 panics on 6.7 - was stable on 6.6

>Category: <PR category (one line)>

>Environment:
        System      : OpenBSD 6.7
        Details     : OpenBSD 6.7 (GENERIC.MP) #1: Sat May 16 16:33:02 MDT 2020
                         [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP

        Architecture: OpenBSD.amd64
        Machine     : amd64

>Description:
** PRELIMINARY BUG REPORT - INCOMPLETE INFO **


USB ure with RTL8153 on 6.7 panics. Same hardware stable on 6.6.

ure0 at uhub0 port 14 configuration 1 interface 0 "Realtek USB 10/100/1000 LAN" rev 3.00/30.00 addr 5
ure0: RTL8153 (0x5c30), address a0:ce:c8:cd:ba:d1
rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0


Under load (estimated 50MB/s for approximate 5 minutes), kernel panics:

panic: assertwaitok: non-zero mutex count: 1
Stopped at db_enter+0xl0: popq %rbp
    TID PID UID PRFLAGS PFLAGS CPU COMMAND
db_enter() at db_enter+0x10
panic(ffffffff81c8al98) at panic+0x128
assertwaitok() at assertwaitok+0xc7
mi_switch at mi_switch+0x40
sleep_finish(ffff800022e816b8,1) at sleep_finish+0x84
sleep_finish_all(ffff800022e816b8,1) at sleep_finish_all+0x21
tsleepCfffffd84465a24b0,10,ffffffff81c9c412,0) at tsleep+0xd6
usbd_transfer(fffffd84465a24b0) at usbd_transfer+0x204
usbd_do_request_flagsCffff80000052e600,ffff800022e81810,ffff800022e8180c,0,0,1388) at usbd_do_request_fLags+0x139
ure_reset(ffff800000538000) at ure_reset+0x5e
ure_stop(ffff800000538000) at ure_stop+0x21
ure_encap(ffff800000538000, fffffd809e390f00) at ure_encap+0xf2
ure_start(ffff8000005380d0) at ure_start+0x8b
if_qstart_compat(ffff800000538348) at if_qstart_conpat+0x2e
end trace frame: 0xffff800022e819b0, count: 0
https://www.openbsd.org/ddb.htnl describes the minimum info required in bug reports. Insufficient info makes it difficult to find and fix bugs.
ddb{0}>


Above panic OCR’d from a picture and may have errors. I hope to provide more info / trace later.


Aside:

Same panic occurred with RTL8156 - first 6.7 panic. After that I reverted to the RTL8153 above in case panic was limited to the newly-supported hardware.

ure0 at uhub0 port 14 configuration 1 interface 0 "Realtek USB 10/100/1G/2.5G LAN" rev 3.20/30.00 addr 5
ure0: RTL8156 (0x7030), address 00:e0:4c:ab:64:5a


>How-To-Repeat:
        Standard 6.7 amd64 install with 001_wscons syspatch and either RTL8153 or RTL8156.
        Run under network load for a few minutes.

>Fix:
        I removed the ure usb and reverted to an old axe device.



dmesg:
OpenBSD 6.7 (GENERIC.MP) #1: Sat May 16 16:33:02 MDT 2020
    [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 17076674560 (16285MB)
avail mem = 16546508800 (15779MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xb4eda000 (53 entries)
bios0: vendor Intel Corporation version "RYBDWi35.86A.0383.2019.1030.1528" date 10/30/2019
bios0: Intel Corporation NUC5i7RYB
acpi0 at bios0: ACPI 5.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC FPDT FIDT MCFG HPET SSDT UEFI LPIT SSDT ASF! SSDT SSDT SSDT DMAR BGRT
acpi0: wakeup devices PEG0(S4) PEGP(S4) PEG1(S4) PEGP(S4) PEG2(S4) PEGP(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) RP05(S4) PXSX(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz, 3392.63 MHz, 06-3d-04
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,RDSEED,ADX,SMAP,PT,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1.1.1, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz, 3392.17 MHz, 06-3d-04
cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,RDSEED,ADX,SMAP,PT,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 1 (application processor)
cpu2: Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz, 3392.16 MHz, 06-3d-04
cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,RDSEED,ADX,SMAP,PT,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 1, core 0, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz, 3392.16 MHz, 06-3d-04
cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,RDSEED,ADX,SMAP,PT,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 40 pins
acpimadt0: bogus nmi for apid 0
acpimadt0: bogus nmi for apid 1
acpimadt0: bogus nmi for apid 3
acpimcfg0 at acpi0
acpimcfg0: addr 0xf8000000, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PEG0)
acpiprt2 at acpi0: bus -1 (PEG1)
acpiprt3 at acpi0: bus -1 (PEG2)
acpiprt4 at acpi0: bus 1 (RP01)
acpiprt5 at acpi0: bus -1 (RP02)
acpiprt6 at acpi0: bus -1 (RP03)
acpiprt7 at acpi0: bus 2 (RP04)
acpiprt8 at acpi0: bus 3 (RP05)
acpiprt9 at acpi0: bus -1 (RP06)
acpiprt10 at acpi0: bus -1 (RP07)
acpiprt11 at acpi0: bus -1 (RP08)
acpiec0 at acpi0: not present
acpicpu0 at acpi0: C3(200@506 mwait.1@0x60), C2(200@117 mwait.1@0x30), C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C3(200@506 mwait.1@0x60), C2(200@117 mwait.1@0x30), C1(1000@1 mwait.1), PSS
acpicpu2 at acpi0: C3(200@506 mwait.1@0x60), C2(200@117 mwait.1@0x30), C1(1000@1 mwait.1), PSS
acpicpu3 at acpi0: C3(200@506 mwait.1@0x60), C2(200@117 mwait.1@0x30), C1(1000@1 mwait.1), PSS
acpipwrres0 at acpi0: PG00, resource for PEG0
acpipwrres1 at acpi0: PG01, resource for PEG1
acpipwrres2 at acpi0: PG02, resource for PEG2
acpipwrres3 at acpi0: WRST
acpipwrres4 at acpi0: WRST
acpipwrres5 at acpi0: WRST
acpipwrres6 at acpi0: WRST
acpipwrres7 at acpi0: WRST
acpipwrres8 at acpi0: WRST
acpipwrres9 at acpi0: WRST
acpipwrres10 at acpi0: WRST
acpipwrres11 at acpi0: FN00, resource for FAN0
acpipwrres12 at acpi0: FN01, resource for FAN1
acpipwrres13 at acpi0: FN02, resource for FAN2
acpipwrres14 at acpi0: FN03, resource for FAN3
acpipwrres15 at acpi0: FN04, resource for FAN4
acpitz0 at acpi0: critical temperature is 105 degC
acpipci0 at acpi0 PCI0: 0x00000000 0x00000011 0x00000001
"NTN0530" at acpi0 not configured
acpicmos0 at acpi0
acpibtn0 at acpi0: SLPB
"INT33A1" at acpi0 not configured
acpibtn1 at acpi0: PWRB
"PNP0C0B" at acpi0 not configured
acpivideo0 at acpi0: GFX0
cpu0: using VERW MDS workaround (except on vmm entry)
cpu0: Enhanced SpeedStep 3392 MHz: speeds: 3101, 3100, 3000, 2700, 2500, 2400, 2200, 2000, 1800, 1600, 1400, 1200, 1100, 900, 700, 500 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Core 5G Host" rev 0x09
inteldrm0 at pci0 dev 2 function 0 "Intel Iris Graphics 6100" rev 0x09
drm0 at inteldrm0
inteldrm0: msi, BROADWELL, gen 8
azalia0 at pci0 dev 3 function 0 "Intel Core 5G HD Audio" rev 0x09: msi
azalia0: No codecs found
xhci0 at pci0 dev 20 function 0 "Intel 9 Series xHCI" rev 0x03: msi, xHCI 1.0
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 addr 1
"Intel 9 Series MEI" rev 0x03 at pci0 dev 22 function 0 not configured
em0 at pci0 dev 25 function 0 "Intel I218-V" rev 0x03: msi, address b8:ae:ed:75:f7:3e
azalia1 at pci0 dev 27 function 0 "Intel 9 Series HD Audio" rev 0x03: msi
azalia1: codecs: Realtek/0x0283
audio0 at azalia1
ppb0 at pci0 dev 28 function 0 "Intel 9 Series PCIE" rev 0xe3
pci1 at ppb0 bus 1
ppb1 at pci0 dev 28 function 3 "Intel 9 Series PCIE" rev 0xe3: msi
pci2 at ppb1 bus 2
iwm0 at pci2 dev 0 function 0 "Intel Dual Band Wireless AC 7265" rev 0x59, msi
ppb2 at pci0 dev 28 function 4 "Intel 9 Series PCIE" rev 0xe3: msi
pci3 at ppb2 bus 3
nvme0 at pci3 dev 0 function 0 "Samsung SM981/PM981 NVMe" rev 0x00: msix, NVMe 1.3
nvme0: Samsung SSD 970 EVO 1TB, firmware 2B2QEXE7, serial S5H9NC0M903514V
scsibus1 at nvme0: 2 targets, initiator 0
sd0 at scsibus1 targ 1 lun 0: <NVMe, Samsung SSD 970, 2B2Q>
sd0: 953869MB, 512 bytes/sector, 1953525168 sectors
ehci0 at pci0 dev 29 function 0 "Intel 9 Series USB" rev 0x03: apic 2 int 23
usb1 at ehci0: USB revision 2.0
uhub1 at usb1 configuration 1 interface 0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
pcib0 at pci0 dev 31 function 0 "Intel 9 Series LPC" rev 0x03
ahci0 at pci0 dev 31 function 2 "Intel 9 Series AHCI" rev 0x03: msi, AHCI 1.3
ahci0: port 0: 6.0Gb/s
scsibus2 at ahci0: 32 targets
sd1 at scsibus2 targ 0 lun 0: <ATA, Samsung SSD 860, RVT0> naa.5002538e40101611
sd1: 953869MB, 512 bytes/sector, 1953525168 sectors, thin
ichiic0 at pci0 dev 31 function 3 "Intel 9 Series SMBus" rev 0x03: apic 2 int 18
iic0 at ichiic0
spdmem0 at iic0 addr 0x50: 8GB DDR3 SDRAM PC3-12800 SO-DIMM
spdmem1 at iic0 addr 0x52: 8GB DDR3 SDRAM PC3-12800 SO-DIMM
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
wbsio0 at isa0 port 0x4e/2: NCT6776F rev 0x33
lm1 at wbsio0 port 0xa00/8: NCT6776F
vmm0 at mainbus0: VMX/EPT
efifb at mainbus0 not configured
uhub2 at uhub0 port 1 configuration 1 interface 0 "Apple, Inc. Keyboard Hub" rev 2.00/96.15 addr 2
uhidev0 at uhub2 port 2 configuration 1 interface 0 "Apple Inc. Apple Keyboard" rev 2.00/0.74 addr 3
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 variable keys, 5 key codes, country code 33
wskbd1 at ukbd0 mux 1
uhidev1 at uhub2 port 2 configuration 1 interface 1 "Apple Inc. Apple Keyboard" rev 2.00/0.74 addr 3
uhidev1: iclass 3/0
uhid0 at uhidev1: input=1, output=0, feature=0
ugen0 at uhub0 port 7 "Intel Bluetooth" rev 2.01/0.01 addr 4
ure0 at uhub0 port 14 configuration 1 interface 0 "Realtek USB 10/100/1000 LAN" rev 3.00/30.00 addr 5
ure0: RTL8153 (0x5c30), address a0:ce:c8:cd:ba:d1
rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0
uhub3 at uhub1 port 1 configuration 1 interface 0 "Intel Rate Matching Hub" rev 2.00/0.03 addr 2
vscsi0 at root
scsibus3 at vscsi0: 256 targets
softraid0 at root
scsibus4 at softraid0: 256 targets
root on sd0a (364ead9504527228.a) swap on sd0b dump on sd0b
inteldrm0: 1920x1080, 32bpp
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0
wskbd1: connecting to wsdisplay0
wsdisplay0: screen 1-5 added (std, vt100 emulation)
iwm0: hw rev 0x210, fw ver 17.3216344376.0, address 34:13:e8:2c:05:1a

% syspatch -l                                                                                                                                                                                  
001_wscons
002_rpki
003_ssh


Reply | Threaded
Open this post in threaded view
|

Re: USB ure RTL8153 panics on release 6.7 + 001_wscons

Kevin Lo
On Tue, May 19, 2020 at 09:52:57AM -0700, Jonathon Fletcher wrote:

>
>
> >Synopsis: ure RTL8153 panics on 6.7 - was stable on 6.6
>
> >Category: <PR category (one line)>
>
> >Environment:
> System      : OpenBSD 6.7
> Details     : OpenBSD 6.7 (GENERIC.MP) #1: Sat May 16 16:33:02 MDT 2020
> [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>
> Architecture: OpenBSD.amd64
> Machine     : amd64
>
> >Description:
> ** PRELIMINARY BUG REPORT - INCOMPLETE INFO **
>
>
> USB ure with RTL8153 on 6.7 panics. Same hardware stable on 6.6.
>
> ure0 at uhub0 port 14 configuration 1 interface 0 "Realtek USB 10/100/1000 LAN" rev 3.00/30.00 addr 5
> ure0: RTL8153 (0x5c30), address a0:ce:c8:cd:ba:d1
> rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0
>
>
> Under load (estimated 50MB/s for approximate 5 minutes), kernel panics:
>
> panic: assertwaitok: non-zero mutex count: 1
> Stopped at db_enter+0xl0: popq %rbp
>     TID PID UID PRFLAGS PFLAGS CPU COMMAND
> db_enter() at db_enter+0x10
> panic(ffffffff81c8al98) at panic+0x128
> assertwaitok() at assertwaitok+0xc7
> mi_switch at mi_switch+0x40
> sleep_finish(ffff800022e816b8,1) at sleep_finish+0x84
> sleep_finish_all(ffff800022e816b8,1) at sleep_finish_all+0x21
> tsleepCfffffd84465a24b0,10,ffffffff81c9c412,0) at tsleep+0xd6
> usbd_transfer(fffffd84465a24b0) at usbd_transfer+0x204
> usbd_do_request_flagsCffff80000052e600,ffff800022e81810,ffff800022e8180c,0,0,1388) at usbd_do_request_fLags+0x139
> ure_reset(ffff800000538000) at ure_reset+0x5e
> ure_stop(ffff800000538000) at ure_stop+0x21
> ure_encap(ffff800000538000, fffffd809e390f00) at ure_encap+0xf2
> ure_start(ffff8000005380d0) at ure_start+0x8b
> if_qstart_compat(ffff800000538348) at if_qstart_conpat+0x2e
> end trace frame: 0xffff800022e819b0, count: 0
> https://www.openbsd.org/ddb.htnl describes the minimum info required in bug reports. Insufficient info makes it difficult to find and fix bugs.
> ddb{0}>
>
>
> Above panic OCR’d from a picture and may have errors. I hope to provide more info / trace later.
>
>
> Aside:
>
> Same panic occurred with RTL8156 - first 6.7 panic. After that I reverted to the RTL8153 above in case panic was limited to the newly-supported hardware.
>
> ure0 at uhub0 port 14 configuration 1 interface 0 "Realtek USB 10/100/1G/2.5G LAN" rev 3.20/30.00 addr 5
> ure0: RTL8156 (0x7030), address 00:e0:4c:ab:64:5a

Thanks for the report.  Could you test this diff?  Thanks.

Index: sys/dev/usb/if_ure.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_ure.c,v
retrieving revision 1.14
diff -u -p -u -p -r1.14 if_ure.c
--- sys/dev/usb/if_ure.c 10 Mar 2020 01:11:30 -0000 1.14
+++ sys/dev/usb/if_ure.c 21 May 2020 07:03:53 -0000
@@ -117,7 +117,7 @@ void ure_miibus_writereg(struct device
 void ure_lock_mii(struct ure_softc *);
 void ure_unlock_mii(struct ure_softc *);
 
-int ure_encap(struct ure_softc *, struct mbuf *);
+int ure_encap(struct ure_softc *, struct mbuf *, int);
 void ure_rxeof(struct usbd_xfer *, void *, usbd_status);
 void ure_txeof(struct usbd_xfer *, void *, usbd_status);
 int ure_rx_list_init(struct ure_softc *);
@@ -763,23 +763,22 @@ void
 ure_start(struct ifnet *ifp)
 {
  struct ure_softc *sc = ifp->if_softc;
+ struct ure_cdata *cd = &sc->ure_cdata;
  struct mbuf *m_head = NULL;
+ int idx;
 
  if (!(ifp->if_flags & IFF_RUNNING) || ifq_is_oactive(&ifp->if_snd) ||
     !(sc->ure_flags & URE_FLAG_LINK))
  return;
 
- for (;;) {
- if (sc->ure_cdata.tx_cnt == sc->ure_tx_list_cnt) {
- ifq_set_oactive(&ifp->if_snd);
- break;
- }
-
+ idx = cd->tx_prod;
+
+ while (cd->tx_cnt < sc->ure_tx_list_cnt) {
  m_head = ifq_deq_begin(&ifp->if_snd);
  if (m_head == NULL)
  break;
 
- if (ure_encap(sc, m_head)) {
+ if (ure_encap(sc, m_head, idx)) {
  ifq_deq_rollback(&ifp->if_snd, m_head);
  ifq_set_oactive(&ifp->if_snd);
  break;
@@ -790,8 +789,13 @@ ure_start(struct ifnet *ifp)
  if (ifp->if_bpf)
  bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
 #endif
- ifp->if_timer = 5;
+ idx = (idx + 1) % sc->ure_tx_list_cnt;
+ cd->tx_cnt++;
  }
+
+ cd->tx_prod = idx;
+
+ ifp->if_timer = 5;
 }
 
 void
@@ -1727,7 +1731,7 @@ ure_rxeof(struct usbd_xfer *xfer, void *
  memcpy(&rxhdr, buf, sizeof(rxhdr));
  total_len -= sizeof(rxhdr);
 
- pktlen = letoh32(rxhdr.ure_pktlen) & URE_RXPKT_LEN_MASK;
+ pktlen = lemtoh32(&rxhdr.ure_pktlen) & URE_RXPKT_LEN_MASK;
  DPRINTFN(4, ("next packet is %d bytes\n", pktlen));
  if (pktlen > total_len) {
  DPRINTF(("not enough bytes left for next packet\n"));
@@ -1745,8 +1749,8 @@ ure_rxeof(struct usbd_xfer *xfer, void *
  goto done;
  }
 
- cflags = letoh32(rxhdr.ure_csum);
- rxvlan = letoh32(rxhdr.ure_vlan);
+ cflags = lemtoh32(&rxhdr.ure_csum);
+ rxvlan = lemtoh32(&rxhdr.ure_vlan);
 
  /* Check IP header checksum. */
  if ((rxvlan & URE_RXPKT_IPV4) &&
@@ -1891,7 +1895,7 @@ ure_rx_list_init(struct ure_softc *sc)
 }
 
 int
-ure_encap(struct ure_softc *sc, struct mbuf *m)
+ure_encap(struct ure_softc *sc, struct mbuf *m, int idx)
 {
  struct ure_chain *c;
  usbd_status err;
@@ -1912,12 +1916,12 @@ ure_encap(struct ure_softc *sc, struct m
  cflags |= swap16(m->m_pkthdr.ether_vtag | URE_TXPKT_VLAN_TAG);
 #endif
 
- c = &sc->ure_cdata.tx_chain[sc->ure_cdata.tx_prod];
+ c = &sc->ure_cdata.tx_chain[idx];
 
  /* header */
- txhdr.ure_pktlen = htole32(m->m_pkthdr.len | URE_TXPKT_TX_FS |
+ htolem32(&txhdr.ure_pktlen, m->m_pkthdr.len | URE_TXPKT_TX_FS |
     URE_TXPKT_TX_LS);
- txhdr.ure_vlan = htole32(cflags);
+ htolem32(&txhdr.ure_vlan, cflags);
  memcpy(c->uc_buf, &txhdr, sizeof(txhdr));
  frm_len = sizeof(txhdr);
 
@@ -1932,14 +1936,10 @@ ure_encap(struct ure_softc *sc, struct m
     frm_len, USBD_FORCE_SHORT_XFER | USBD_NO_COPY, 10000, ure_txeof);
 
  err = usbd_transfer(c->uc_xfer);
- if (err != 0 && err != USBD_IN_PROGRESS) {
+ if (err != USBD_IN_PROGRESS) {
  ure_stop(sc);
  return (EIO);
  }
-
- sc->ure_cdata.tx_cnt++;
- sc->ure_cdata.tx_prod = (sc->ure_cdata.tx_prod + 1) %
-    sc->ure_tx_list_cnt;
 
  return (0);
 }

Reply | Threaded
Open this post in threaded view
|

Re: USB ure RTL8153 panics on release 6.7 + 001_wscons

Jonathon Fletcher-2

> On May 21, 2020, at 12:39 AM, Kevin Lo <[hidden email]> wrote:
>
> On Tue, May 19, 2020 at 09:52:57AM -0700, Jonathon Fletcher wrote:
>>
>>
>>> Synopsis: ure RTL8153 panics on 6.7 - was stable on 6.6
>>
>>> Environment:
>> System      : OpenBSD 6.7
>> Details     : OpenBSD 6.7 (GENERIC.MP) #1: Sat May 16 16:33:02 MDT 2020
>> [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>>
>> Architecture: OpenBSD.amd64
>> Machine     : amd64
>>
>>> Description:
>> ** PRELIMINARY BUG REPORT - INCOMPLETE INFO **
>>
>> USB ure with RTL8153 on 6.7 panics. Same hardware stable on 6.6.
>>
>> ure0 at uhub0 port 14 configuration 1 interface 0 "Realtek USB 10/100/1000 LAN" rev 3.00/30.00 addr 5
>> ure0: RTL8153 (0x5c30), address a0:ce:c8:cd:ba:d1
>> rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0
>>
>> Under load (estimated 50MB/s for approximate 5 minutes), kernel panics:

...

>> Aside:
>>
>> Same panic occurred with RTL8156 - first 6.7 panic. After that I reverted to the RTL8153 above in case panic was limited to the newly-supported hardware.
>>
>> ure0 at uhub0 port 14 configuration 1 interface 0 "Realtek USB 10/100/1G/2.5G LAN" rev 3.20/30.00 addr 5
>> ure0: RTL8156 (0x7030), address 00:e0:4c:ab:64:5a
>
> Thanks for the report.  Could you test this diff?  Thanks.

Kevin,

Thank you for the quick patch.

I have run this at 40-50MB/s for ~20mins for both RTL8153 and RTL8156.

No panic with your patch.

I am going to leave it running with the RTL8156 and will send an update if I see any problems.

Thanks,
Jonathon

Reply | Threaded
Open this post in threaded view
|

Re: USB ure RTL8153 panics on release 6.7 + 001_wscons

Jonathon Fletcher-2


> On May 21, 2020, at 7:04 PM, Jonathon Fletcher <[hidden email]> wrote:
>
>
>> On May 21, 2020, at 12:39 AM, Kevin Lo <[hidden email]> wrote:
>>
>> On Tue, May 19, 2020 at 09:52:57AM -0700, Jonathon Fletcher wrote:
>>>
>>>
>>>> Synopsis: ure RTL8153 panics on 6.7 - was stable on 6.6
>>>
>>>> Environment:
>>> System      : OpenBSD 6.7
>>> Details     : OpenBSD 6.7 (GENERIC.MP) #1: Sat May 16 16:33:02 MDT 2020
>>> [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>>>
>>> Architecture: OpenBSD.amd64
>>> Machine     : amd64
>>>
>>>> Description:
>>> ** PRELIMINARY BUG REPORT - INCOMPLETE INFO **
>>>
>>> USB ure with RTL8153 on 6.7 panics. Same hardware stable on 6.6.
>>>
>>> ure0 at uhub0 port 14 configuration 1 interface 0 "Realtek USB 10/100/1000 LAN" rev 3.00/30.00 addr 5
>>> ure0: RTL8153 (0x5c30), address a0:ce:c8:cd:ba:d1
>>> rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0
>>>
>>> Under load (estimated 50MB/s for approximate 5 minutes), kernel panics:
>
> ...
>
>>> Aside:
>>>
>>> Same panic occurred with RTL8156 - first 6.7 panic. After that I reverted to the RTL8153 above in case panic was limited to the newly-supported hardware.
>>>
>>> ure0 at uhub0 port 14 configuration 1 interface 0 "Realtek USB 10/100/1G/2.5G LAN" rev 3.20/30.00 addr 5
>>> ure0: RTL8156 (0x7030), address 00:e0:4c:ab:64:5a
>>
>> Thanks for the report.  Could you test this diff?  Thanks.
>
> Thank you for the quick patch.
>
> I have run this at 40-50MB/s for ~20mins for both RTL8153 and RTL8156.
>
> No panic with your patch.
>
> I am going to leave it running with the RTL8156 and will send an update if I see any problems.


Kevin,

This happened with the patch applied and using the RTL8156.

Same dmesg as original report.

assertwaitok: non-zero mutex count: 1
Stopped at db_enter+0xl0: popq %rbp
        TID PID UID PRFLRGS PFLAGS CPU COMMAND
db_enter() at db_enter+0xl0
panic(ffffffff81c8e578) at panic+0xl28
assertwaitok() at assertwaitok+0xc7
mi_suitch() at mi_switch+0x40
sleep_finish(ffff800022e81148,1) at sleep_finish+0x84
sleep_finish_all(ffff800022e81148,l) at sleep_finish_al1+0x21
tsleep(fffffd84465a24b0,10,ffffffff81c9bd4f,0) at tsleep+0xd6
usbd_transfer(fffffd84465a24b0) at usbd_transfer+0x204
usbd_do_request_flags(ffff80000052d500,ffff800022e812a0,ffff800022e8129c,0,0,1388) at usbd_do_request_flags+0x139
ure_reset(ffff800000533000) at ure_reset+0x5e
ure_stop(ffff800000533000) at ure_stop+0x21
ure_encap(ffff800000533000,fffffd808ecf9800,5) at ure_encap+0xf6
ure_start(ffff8000005330d0) at ure_start+0x98
if_qstart_compat(ffff800000533348) at if_qstart_compat+0x2e
end trace frame: 0xffff800022e81450, count: 0
https://www.openbsd.org/ddb.html describes the minimum info required in bug reports. Insufficient info makes it difficult to find and fix bugs.
ddb{1}>

Thanks,
Jonathon