On Fri, Aug 24, 2018 at 06:02:20AM +0000, sc.dy...@gmail.com wrote: > On 2018/08/19 09:40, Stefan Sperling wrote: > > On Sun, Aug 19, 2018 at 11:05:04AM +0200, Stefan Sperling wrote: > >> On Sun, Aug 19, 2018 at 09:56:33AM +0200, Remi Locherer wrote: > >>> It would help if you could send a clean version that applies to -current. > >> > >> One of the attachments was in fact clean but yes, this > >> thread has been much too noisy to follow easily. > >> > >> Try this. > > > > Unfortunately, while this diff does indeed work on xhci(4), I've just > > found that this diff breaks axen(4) attached to ehci(4) completely. > > > > I see several "axen0: rxeof: too short transfer" in dmesg and > > almost all packets are lost. Even my Ethernet switch gives up > > eventually and disables the port. > > > > So this diff is not ready to be committed. > > I didn't check if axen works on ehci. > On my ehci (intel PCH) that bug is reproduced, and > I found that it works on ehci with 16kB RX buffer. > I preserve the original bufsz decision code.
I applied axen5.diff and xhci.diff and tested the resulting kernel on an old Samsung notebook that has ehci and xhci (demesg and usbdevs below). When the axen dongle is attached via xhci it gets link but dhclient never gets a lease. This works when attached via ehci. But after some light traffic (browsing with netsurf) the systme panics. Here the output from ddb (copied by hand): kernel: page fault trap, code=0 Stopped at memcpy+0x15: repe movsq (%rsi),%es:(rdi) ddb{1}> show panic kernel page fault uvm_fault(0xffffffdef19438, 0x0, 0, 1) -> e memcpy(79e3..........) at memcpy+0x15 end trace frame: 0xffff800032e06cd0, cound: 0 ddb{1} trace memcpy(79e...........) at memcpy+0x15 ptcread(5b11cd.....) at ptcread+0x1eb spec_read(70e.....) at spec_read+0xab VOP_READ(4b037......) at VOP_RAED+0x49 vn_read(af8b.....) at dofilereadv+0xe0 sys_read(9862....) at sys_read+0x5c syscall(822b.....) at syscall+0x32a Xsyscall(0,3,0,3,f,1954e...) at Xsyscall+0x128 end of kernel end trace frame 0x7f7ffffd3430, count: -9 ddb{1}> mach ddb 0 Stopped at x86_ipi_db+0x12: popq %r11 ddb{0}> trace x86_ipi_db(5d...) at x86_ipi_db+0x12 x86_ipi_handler() at x86_ipi_handler+0x80 Xresume_lapic_ipi(9,ff.........) at Xresume_lapic_ipi+0x23 ___mp_lock(58ifaff....) at ___mp_lock+0x68 intr_handler(a26f9....) at intr_handler+0x40 Xintr_ioapic_edge12_untramp(6,fff.......) at Xintr_ioapic_edge12_untramp+0x19f ___mp_lock(58faff...) at___mp_lock+0x68 intr_handler(a26f9....) at intr_handler+040 Xintr_ioapic_edge25_untramp(0,3,......) at Xintr_ioapic_edge25_untramp+0x19f acpicpu_idle() at acpicpu_idle+0x166 sched_idle(0) at sced_idle+0x245 end trace frame: 0x0, count: -11 ddb{0} This does not happen when running a snapshot kernel. dmesg + usbdevs -vvv OpenBSD 6.4-beta (GENERIC.MP) #0: Sat Aug 25 19:45:29 CEST 2018 r...@530u.relo.ch:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 8462659584 (8070MB) avail mem = 8196993024 (7817MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xe0840 (63 entries) bios0: vendor Phoenix Technologies Ltd. version "05XK" date 02/10/2012 bios0: SAMSUNG ELECTRONICS CO., LTD. 530U3BI/530U4BI/530U4BH acpi0 at bios0: rev 2 acpi0: sleep states S0 S1 S3 S4 S5 acpi0: tables DSDT FACP SLIC SSDT ASF! HPET APIC MCFG SSDT SSDT UEFI UEFI UEFI acpi0: wakeup devices P0P1(S4) GLAN(S4) HDEF(S4) PXSX(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) RP06(S4) PXSX(S4) RP07(S4) PXSX(S4) [...] acpitimer0 at acpi0: 3579545 Hz, 24 bits acpihpet0 at acpi0: 14318179 Hz acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Core(TM) i5-2467M CPU @ 1.60GHz, 1597.58 MHz, 06-2a-07 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,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,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.1.2, IBE cpu1 at mainbus0: apid 2 (application processor) cpu1: Intel(R) Core(TM) i5-2467M CPU @ 1.60GHz, 1895.69 MHz, 06-2a-07 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,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN cpu1: 256KB 64b/line 8-way L2 cache cpu1: smt 0, core 1, package 0 ioapic0 at mainbus0: apid 14 pa 0xfec00000, version 20, 24 pins acpimcfg0 at acpi0 acpimcfg0: addr 0xf8000000, bus 0-63 acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus -1 (P0P1) acpiprt2 at acpi0: bus 1 (RP01) acpiprt3 at acpi0: bus -1 (RP02) acpiprt4 at acpi0: bus -1 (RP03) acpiprt5 at acpi0: bus 2 (RP04) acpiprt6 at acpi0: bus 3 (RP05) acpiprt7 at acpi0: bus -1 (RP06) acpiprt8 at acpi0: bus -1 (RP07) acpiprt9 at acpi0: bus -1 (RP08) acpiprt10 at acpi0: bus -1 (PEG0) acpiprt11 at acpi0: bus -1 (PEG1) acpiprt12 at acpi0: bus -1 (PEG2) acpiprt13 at acpi0: bus -1 (PEG3) acpiec0 at acpi0 acpicpu0 at acpi0: C2(500@80 io@0x414), C1(1000@1 halt), PSS acpicpu1 at acpi0: C2(500@80 io@0x414), C1(1000@1 halt), PSS acpipwrres0 at acpi0: FN00, resource for FAN0 acpipwrres1 at acpi0: FN01, resource for FAN1 acpipwrres2 at acpi0: FN02, resource for FAN2 acpipwrres3 at acpi0: FN03, resource for FAN3 acpipwrres4 at acpi0: FN04, resource for FAN4 acpitz0 at acpi0: critical temperature is 99 degC acpitz1 at acpi0: critical temperature is 99 degC acpibat0 at acpi0: BAT1 type LION oem "SAMSUNG Electronics" acpicmos0 at acpi0 "ETD0B00" at acpi0 not configured acpiac0 at acpi0: AC unit online acpibtn0 at acpi0: LID0 acpibtn1 at acpi0: PWRB "PNP0C0B" at acpi0 not configured "PNP0C0B" at acpi0 not configured "PNP0C0B" at acpi0 not configured "PNP0C0B" at acpi0 not configured "PNP0C0B" at acpi0 not configured acpivideo0 at acpi0: GFX0 acpivout0 at acpivideo0: DD02 cpu0: Enhanced SpeedStep 1597 MHz: speeds: 1601, 1600, 1500, 1400, 1300, 1200, 1100, 1000, 900, 800 MHz pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "Intel Core 2G Host" rev 0x09 inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics 3000" rev 0x09 drm0 at inteldrm0 inteldrm0: msi inteldrm0: 1366x768, 32bpp wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation) wsdisplay0: screen 1-5 added (std, vt100 emulation) "Intel 6 Series MEI" rev 0x04 at pci0 dev 22 function 0 not configured ehci0 at pci0 dev 26 function 0 "Intel 6 Series USB" rev 0x04: apic 14 int 16 usb0 at ehci0: USB revision 2.0 uhub0 at usb0 configuration 1 interface 0 "Intel EHCI root hub" rev 2.00/1.00 addr 1 azalia0 at pci0 dev 27 function 0 "Intel 6 Series HD Audio" rev 0x04: msi azalia0: codecs: Realtek ALC269, Intel/0x2805, using Realtek ALC269 audio0 at azalia0 ppb0 at pci0 dev 28 function 0 "Intel 6 Series PCIE" rev 0xb4: msi pci1 at ppb0 bus 1 iwn0 at pci1 dev 0 function 0 "Intel Centrino Advanced-N 6030" rev 0x34: msi, MIMO 2T2R, MoW, address 88:53:2e:b6:8b:9a ppb1 at pci0 dev 28 function 3 "Intel 6 Series PCIE" rev 0xb4: msi pci2 at ppb1 bus 2 re0 at pci2 dev 0 function 0 "Realtek 8168" rev 0x06: RTL8168E/8111E-VL (0x2c80), msi, address e8:03:9a:38:8a:0a rgephy0 at re0 phy 7: RTL8169S/8110S/8211 PHY, rev. 5 ppb2 at pci0 dev 28 function 4 "Intel 6 Series PCIE" rev 0xb4: msi pci3 at ppb2 bus 3 xhci0 at pci3 dev 0 function 0 "ASMedia ASM1042 xHCI" rev 0x00: msi, xHCI 0.150 usb1 at xhci0: USB revision 3.0 uhub1 at usb1 configuration 1 interface 0 "ASMedia xHCI root hub" rev 3.00/1.00 addr 1 ehci1 at pci0 dev 29 function 0 "Intel 6 Series USB" rev 0x04: apic 14 int 23 usb2 at ehci1: USB revision 2.0 uhub2 at usb2 configuration 1 interface 0 "Intel EHCI root hub" rev 2.00/1.00 addr 1 pcib0 at pci0 dev 31 function 0 "Intel HM65 LPC" rev 0x04 ahci0 at pci0 dev 31 function 2 "Intel 6 Series AHCI" rev 0x04: msi, AHCI 1.3 ahci0: port 0: 6.0Gb/s ahci0: port 1: 3.0Gb/s scsibus1 at ahci0: 32 targets sd0 at scsibus1 targ 0 lun 0: <ATA, Samsung SSD 840, DXM0> SCSI3 0/direct fixed naa.500253855003b103 sd0: 122104MB, 512 bytes/sector, 250069680 sectors, thin sd1 at scsibus1 targ 1 lun 0: <ATA, SanDisk iSSD P4, SSD> SCSI3 0/direct fixed naa.5001b4550c45159a sd1: 15272MB, 512 bytes/sector, 31277232 sectors, thin ichiic0 at pci0 dev 31 function 3 "Intel 6 Series SMBus" rev 0x04: apic 14 int 18 iic0 at ichiic0 spdmem0 at iic0 addr 0x52: 4GB DDR3 SDRAM PC3-10600 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, using wsdisplay0 pms0 at pckbc0 (aux slot) wsmouse0 at pms0 mux 0 pms0: Elantech Touchpad, version 3, firmware 0x450f00 pcppi0 at isa0 port 0x61 spkr0 at pcppi0 vmm0 at mainbus0: VMX/EPT uhub3 at uhub0 port 1 configuration 1 interface 0 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2 uvideo0 at uhub3 port 4 configuration 1 interface 0 "123 WebCam SC-13HDL11431N" rev 2.00/0.01 addr 3 video0 at uvideo0 uhub4 at uhub2 port 1 configuration 1 interface 0 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2 ugen0 at uhub4 port 5 "Intel product 0x0189" rev 2.00/69.19 addr 3 vscsi0 at root scsibus2 at vscsi0: 256 targets softraid0 at root scsibus3 at softraid0: 256 targets root on sd1a (c5c74842f74e2fd2.a) swap on sd1b dump on sd1b WARNING: / was not properly unmounted axen0 at uhub1 port 1 configuration 1 interface 0 "ASIX Elec. Corp. AX88179" rev 3.00/1.00 addr 2 axen0: AX88179, address 74:da:38:49:ed:82 rgephy1 at axen0 phy 3: RTL8169S/8110S/8211 PHY, rev. 5 rgephy1 detached axen0 detached axen0 at uhub1 port 1 configuration 1 interface 0 "ASIX Elec. Corp. AX88179" rev 3.00/1.00 addr 2 axen0: AX88179, address 74:da:38:49:ed:82 rgephy1 at axen0 phy 3: RTL8169S/8110S/8211 PHY, rev. 5 rgephy1 detached axen0 detached axen0 at uhub3 port 2 configuration 1 interface 0 "ASIX Elec. Corp. AX88179" rev 2.10/1.00 addr 4 axen0: AX88179, address 74:da:38:49:ed:82 rgephy1 at axen0 phy 3: RTL8169S/8110S/8211 PHY, rev. 5 axen0: usb errors on rx: IOERROR rgephy1 detached axen0 detached axen0 at uhub1 port 1 configuration 1 interface 0 "ASIX Elec. Corp. AX88179" rev 3.00/1.00 addr 2 axen0: AX88179, address 74:da:38:49:ed:82 rgephy1 at axen0 phy 3: RTL8169S/8110S/8211 PHY, rev. 5 rgephy1 detached axen0 detached axen0 at uhub3 port 2 configuration 1 interface 0 "ASIX Elec. Corp. AX88179" rev 2.10/1.00 addr 4 axen0: AX88179, address 74:da:38:49:ed:82 rgephy1 at axen0 phy 3: RTL8169S/8110S/8211 PHY, rev. 5 Controller /dev/usb0: addr 01: 8086:0000 Intel, EHCI root hub high speed, self powered, config 1, rev 1.00 driver: uhub0 port 01: 0000.0503 connect enabled power port 02: 0000.0500 power addr 02: 8087:0024 Intel, Rate Matching Hub high speed, self powered, config 1, rev 0.00 driver: uhub3 port 01: 0000.0100 power port 02: 0000.0503 connect enabled power port 03: 0000.0100 power port 04: 0000.0503 connect enabled power port 05: 0000.0100 power port 06: 0000.0100 power addr 03: 2232:1018 123, WebCam SC-13HDL11431N high speed, power 500 mA, config 1, rev 0.01 driver: uvideo0 addr 04: 0b95:1790 ASIX Elec. Corp., AX88179 high speed, power 248 mA, config 1, rev 1.00, iSerialNumber 00000000000151 driver: axen0 Controller /dev/usb1: addr 01: 1b21:0000 ASMedia, xHCI root hub super speed, self powered, config 1, rev 1.00 driver: uhub1 port 01: 0040.02c0 power ss.inactive port 02: 0000.02a0 power Rx.detect port 03: 0010.02a0 power Rx.detect port 04: 0000.02a0 power Rx.detect Controller /dev/usb2: addr 01: 8086:0000 Intel, EHCI root hub high speed, self powered, config 1, rev 1.00 driver: uhub2 port 01: 0000.0503 connect enabled power port 02: 0000.0500 power addr 02: 8087:0024 Intel, Rate Matching Hub high speed, self powered, config 1, rev 0.00 driver: uhub4 port 01: 0000.0100 power port 02: 0000.0100 power port 03: 0000.0100 power port 04: 0000.0100 power port 05: 0000.0103 connect enabled power port 06: 0000.0100 power addr 03: 8086:0189 Intel, product 0x0189 full speed, self powered, config 1, rev 69.19 driver: ugen0