Re: CVS commit: src/sys/dev/usb
Hi, On 2022/05/14 19:44, Taylor R Campbell wrote: > Module Name: src > Committed By: riastradh > Date: Sat May 14 19:44:37 UTC 2022 > > Modified Files: > src/sys/dev/usb: xhci.c > > Log Message: > xhci(4): Handle race between software abort and hardware stall. xhci_abortx is expected to stop given single xfer, but it actually stops all xfers in pipe. When usbd_ar_pipe stops the first xfer in up_queue of isoc pipe such as uvideo(4), HCI generates multiple Transfer Events (UVIDEO_NXFERS (3) for uvideo) in order xfers are posted. ux_status of first xfer is set to USBD_CANCELLED by usbd_xfer_abort, so usbd_xfer_trycomplete in xhci_event_transfer fails and usb_transfer_complete is not called (xhci_abortx does it instead). However, other two xfers has ux_status = USBD_IN_PROGRESS, depending on how quick events are generated, xhci_event_transfer may call usb_transfer_complete for them before xhci_abortx calls usb_transfer_complete. It may fire KASSERT failure "not start of queue."
Re: CVS commit: src/sys/dev/usb
On Thu, Apr 2, 2020 at 8:37 PM Nick Hudson wrote: > > Module Name:src > Committed By: skrll > Date: Thu Apr 2 11:37:23 UTC 2020 > > Modified Files: > src/sys/dev/usb: xhci.c xhcivar.h > > Log Message: > Reduce the memory footprint by allocating a ring per endpoint/pipe on > pipe open. > > From sc.dying on tech-kern Thank you for applying the patch.
cpsw build fix (Re: CVS commit: src/sys/arch/evbarm/conf)
Hi, On 2019/10/27 18:00, Jared D. McNeill wrote: > Module Name: src > Committed By: jmcneill > Date: Sun Oct 27 18:00:46 UTC 2019 > > Modified Files: > src/sys/arch/evbarm/conf: GENERIC > > Log Message: > Add support for TI AM335x This patch should fix if_cpsw.c build when KERNHIST is enabled. --- src/sys/arch/arm/ti/if_cpsw.c.orig 2019-11-03 11:47:41.761668066 + +++ src/sys/arch/arm/ti/if_cpsw.c 2019-11-22 20:47:58.241695788 + @@ -182,7 +182,7 @@ KERNHIST_DEFINE(cpswhist); #define KERNHIST_CALLED_5(NAME, i, j, k, l) \ do { \ _kernhist_call = atomic_inc_uint_nv(&_kernhist_cnt); \ - KERNHIST_LOG(NAME, "called! %x %x %x %x", i, j, k, l); \ + KERNHIST_LOG(NAME, "called! %jx %jx %jx %jx", i, j, k, l); \ } while (/*CONSTCOND*/ 0) #else #define KERNHIST_CALLED_5(NAME, i, j, k, l) @@ -219,7 +219,7 @@ cpsw_set_txdesc_next(struct cpsw_softc * const bus_size_t o = sizeof(struct cpsw_cpdma_bd) * i + 0; KERNHIST_FUNC(__func__); - KERNHIST_CALLED_5(cpswhist, sc, i, n, 0); + KERNHIST_CALLED_5(cpswhist, (uintptr_t)sc, i, n, 0); bus_space_write_4(sc->sc_bst, sc->sc_bsh_txdescs, o, n); } @@ -230,7 +230,7 @@ cpsw_set_rxdesc_next(struct cpsw_softc * const bus_size_t o = sizeof(struct cpsw_cpdma_bd) * i + 0; KERNHIST_FUNC(__func__); - KERNHIST_CALLED_5(cpswhist, sc, i, n, 0); + KERNHIST_CALLED_5(cpswhist, (uintptr_t)sc, i, n, 0); bus_space_write_4(sc->sc_bst, sc->sc_bsh_rxdescs, o, n); } @@ -244,7 +244,7 @@ cpsw_get_txdesc(struct cpsw_softc * cons const bus_size_t c = __arraycount(bdp->word); KERNHIST_FUNC(__func__); - KERNHIST_CALLED_5(cpswhist, sc, i, bdp, 0); + KERNHIST_CALLED_5(cpswhist, (uintptr_t)sc, i, (uintptr_t)bdp, 0); bus_space_read_region_4(sc->sc_bst, sc->sc_bsh_txdescs, o, dp, c); KERNHIST_LOG(cpswhist, "%08x %08x %08x %08x\n", @@ -260,7 +260,7 @@ cpsw_set_txdesc(struct cpsw_softc * cons const bus_size_t c = __arraycount(bdp->word); KERNHIST_FUNC(__func__); - KERNHIST_CALLED_5(cpswhist, sc, i, bdp, 0); + KERNHIST_CALLED_5(cpswhist, (uintptr_t)sc, i, (uintptr_t)bdp, 0); KERNHIST_LOG(cpswhist, "%08x %08x %08x %08x\n", dp[0], dp[1], dp[2], dp[3]); @@ -276,7 +276,7 @@ cpsw_get_rxdesc(struct cpsw_softc * cons const bus_size_t c = __arraycount(bdp->word); KERNHIST_FUNC(__func__); - KERNHIST_CALLED_5(cpswhist, sc, i, bdp, 0); + KERNHIST_CALLED_5(cpswhist, (uintptr_t)sc, i, (uintptr_t)bdp, 0); bus_space_read_region_4(sc->sc_bst, sc->sc_bsh_rxdescs, o, dp, c); @@ -293,7 +293,7 @@ cpsw_set_rxdesc(struct cpsw_softc * cons const bus_size_t c = __arraycount(bdp->word); KERNHIST_FUNC(__func__); - KERNHIST_CALLED_5(cpswhist, sc, i, bdp, 0); + KERNHIST_CALLED_5(cpswhist, (uintptr_t)sc, i, (uintptr_t)bdp, 0); KERNHIST_LOG(cpswhist, "%08x %08x %08x %08x\n", dp[0], dp[1], dp[2], dp[3]); @@ -607,7 +607,7 @@ cpsw_start(struct ifnet *ifp) u_int mlen; KERNHIST_FUNC(__func__); - KERNHIST_CALLED_5(cpswhist, sc, 0, 0, 0); + KERNHIST_CALLED_5(cpswhist, (uintptr_t)sc, 0, 0, 0); if (__predict_false((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)) { @@ -1140,7 +1140,7 @@ cpsw_rxintr(void *arg) u_int len, off; KERNHIST_FUNC(__func__); - KERNHIST_CALLED_5(cpswhist, sc, 0, 0, 0); + KERNHIST_CALLED_5(cpswhist, (uintptr_t)sc, 0, 0, 0); for (;;) { KASSERT(sc->sc_rxhead < CPSW_NRXDESCS); @@ -1225,7 +1225,7 @@ cpsw_txintr(void *arg) u_int cpi; KERNHIST_FUNC(__func__); - KERNHIST_CALLED_5(cpswhist, sc, 0, 0, 0); + KERNHIST_CALLED_5(cpswhist, (uintptr_t)sc, 0, 0, 0); KASSERT(sc->sc_txrun); > > > To generate a diff of this commit: > cvs rdiff -u -r1.55 -r1.56 src/sys/arch/evbarm/conf/GENERIC > > Please note that diffs are not public domain; they are subject to the > copyright notices on the relevant files. >
Re: CVS commit: src/sys/dev/usb
On Wed, Aug 7, 2019 at 7:06 AM Nick Hudson wrote: > > Module Name:src > Committed By: skrll > Date: Wed Aug 7 07:05:54 UTC 2019 > > Modified Files: > src/sys/dev/usb: if_smsc.c > Removed Files: > src/sys/dev/usb: if_smscvar.h > > Log Message: > Convert smsc(4) to usbnet Should buflen in smsc_rxeof_loop() be initialised as `pktlen - ETHER_ALIGN' if it is instead of m_adj(ETHER_ALIGN) ?
Re: CVS commit: src/sys/dev/usb
On Fri, Jun 28, 2019 at 1:57 AM matthew green wrote: > > Module Name:src > Committed By: mrg > Date: Fri Jun 28 01:57:43 UTC 2019 > > Modified Files: > src/sys/dev/usb: if_axen.c if_cdce.c if_ure.c > > Log Message: > more smp cleanup for ure(4)/axen(4)/cdce(4): Thank you for working! > - convert IFF_ALLMULTI to ETHER_F_ALLMULTI, using ETHER_LOCK() > - remove IFF_OACTIVE use, and simply check the ring count in start cdce_start_locked() has the last one. > - assert/take more locks > - XXX: IFF_RUNNING is not properly protected (all driver problem) > - fix axen_timer setting so it actually runs > - document a locking issue in stop callback: > stop is called with the softc lock held, but the lock order > in all other places is ifnet -> softc -> rx -> tx, so taking > ifnet lock when softc lock is held would be problematic ure_init_locked() calls ure_stop() with sc->ure_lock held, so it would cause 'locking against myself' perhaps when ifconfig such as IFF_DEBUG while the interface is up. > - in rxeof check for stopping/dying more often. i managed to > trigger a pagefault in cdce_rxeof() when yanking an active > device as it attempted to usbd_setup_xfer() on closed pipes. > - add missing USBD_MPSAFE and cdce_stopping resetting for cdce(4) > > between this and other recent clean ups increase performance of > these drivers mostly. some numbers (in mbit/sec): > > old:new: > driver in out in+out in out in+out > -- --- -- -- --- -- > cdce39 32 44 38 33 54 > axen44 34 45 48 37 42 > ure 36 34 35 36 38 38 > > i'm not sure why axen drops a little with in+out. cdce is > helped quite a lot, and ure a little. it is disappointing that > ure does not outperform cdce -- it's the same actual hardware, > and the device-specific (ure) should outperform the generic > cdce driver... > > > To generate a diff of this commit: > cvs rdiff -u -r1.48 -r1.49 src/sys/dev/usb/if_axen.c > cvs rdiff -u -r1.50 -r1.51 src/sys/dev/usb/if_cdce.c > cvs rdiff -u -r1.12 -r1.13 src/sys/dev/usb/if_ure.c > > Please note that diffs are not public domain; they are subject to the > copyright notices on the relevant files. >
Re: CVS commit: src/sys/dev/usb
On Mon, Jun 24, 2019 at 9:39 AM Ryota Ozaki wrote: > > On Mon, Jun 24, 2019 at 6:27 PM matthew green wrote: > > > > > Only KERNEL_LOCK (and some splsoftnet) is required for the network stack > > > now. Remaining splnets are for network drivers. (softnet_lock is also > > > required > > > in some cases but it's another story...) > > > > great! i studied the code and i couldn't find any issues > > in any of the relevant paths, so i'm glad to hear it's > > supposed to be like this. > > > > for one particular case (ether_ioctl) how is this diff: > > > > - * Common ioctls for Ethernet interfaces. Note, we must be > > - * called at splnet(). > > + * Common ioctls for Ethernet interfaces. > > + * > > + * Non IFEF_MPSAFE drivers must call this function at at least called > > + * at splsoftnet(). > > > > or should they also be with kernel lock? > > Yes. > > Also I think splnet is still needed for ether_ioctl for sure because > it has to care not only the network stack but also network drivers. > > ozaki-r Thank you all for detailed explanations. I hope the source would be -DNET_MPSAFE by default. Thanks,
Re: CVS commit: src/sys/dev/usb
On Sun, Jun 23, 2019 at 10:40 PM matthew green wrote: > > sc dying writes: > > hi, > > > > On Sat, Jun 22, 2019 at 9:54 AM matthew green wrote: > > > > > > Module Name:src > > > Committed By: mrg > > > Date: Sat Jun 22 09:53:56 UTC 2019 > > > > > > Modified Files: > > > src/sys/dev/usb: if_axen.c > > > > > > Log Message: > > > mark this driver MPSAFE for usb tasks and pipes, if(4), and callouts. > > > remove remaining redundant spl calls. > > > > Should ether_ioctl be wrapped with splnet? > > ure, cdce and usmsc also need splnet. > > splnet is obsolete in modern USB network drivers. > all the code runs at softipl. > > removing spl was done entirely on purpose. I saw the comment of ether_ioctl in sys/net/if_ethersubr.c > Note, we must be called at splnet(). so I asked. > > > Should if_percpuq_enqueue be called with rxlock held? > > I'm not sure, but I cannot find the reason it is called > > after rxlock is unlocked. > > if_percpuq_enqueue() wants to be called with no locks held. > > > .mrg.
Re: CVS commit: src/sys/dev/usb
hi, On Sun, Jun 23, 2019 at 2:14 AM matthew green wrote: > > Module Name:src > Committed By: mrg > Date: Sun Jun 23 02:14:15 UTC 2019 > > Modified Files: > src/sys/dev/usb: if_cdce.c if_ure.c if_urevar.h > > Log Message: > make cdce(4) and ure(4) usb and mpsafe: > > - introduce locking ala smsc(4)/axen(4) style > - convert to mpsafe interfaces > - add tick task to cdce(4) to deal with missing watchdog, and > actually make the watchdog do something > - convert DELAY() to usbd_delay_ms() in cdce(4) and don't increase > the time in a potentially unbounded way > - remove spl calls Should not ure_init_locked check ure_stopping? If ure_stopping == true, no one clear it. (But, it works anyway because ure_stop_locked does not set ure_stopping.)
Re: CVS commit: src/sys/dev/usb
hi, On Sat, Jun 22, 2019 at 9:54 AM matthew green wrote: > > Module Name:src > Committed By: mrg > Date: Sat Jun 22 09:53:56 UTC 2019 > > Modified Files: > src/sys/dev/usb: if_axen.c > > Log Message: > mark this driver MPSAFE for usb tasks and pipes, if(4), and callouts. > remove remaining redundant spl calls. Should ether_ioctl be wrapped with splnet? ure, cdce and usmsc also need splnet. Should if_percpuq_enqueue be called with rxlock held? I'm not sure, but I cannot find the reason it is called after rxlock is unlocked. Thanks,
Re: CVS commit: src/sys/dev/usb
On Sat, Feb 9, 2019 at 8:18 AM Rin Okuyama wrote: > > Hi, > > On 2019/02/08 23:16, sc dying wrote: > > On 2019/01/31 05:51, Rin Okuyama wrote: > >> By the way, I find that the system hangs silently by > >> "ifconfig mueN down" or detaching LAN7500 from USB port when > >> multiple outstanding requests are enabled. This does not occur > >> when MUE_TX_LIST_CNT = MUE_RX_LIST_CNT = 1. Do you have any ideas > >> to fix it? > > > > My axen dongle locks up if AXEN_RX_LIST_CNT > 1 > > when ifconfig down on amd64 8.99.34. > > > > db{0}> bt > > breakpoint() at netbsd:breakpoint+0x5 > > comintr() at netbsd:comintr+0x861 > > Xhandle_ioapic_edge4() at netbsd:Xhandle_ioapic_edge4+0x66 > > --- interrupt --- > > xhci_device_bulk_abort() at netbsd:xhci_device_bulk_abort+0x1c > > usbd_ar_pipe() at netbsd:usbd_ar_pipe+0x1e9 > > usbd_abort_pipe() at netbsd:usbd_abort_pipe+0x27 > > axen_stop() at netbsd:axen_stop+0xc4 > > axen_ioctl() at netbsd:axen_ioctl+0x1d9 > > doifioctl() at netbsd:doifioctl+0xa99 > > sys_ioctl() at netbsd:sys_ioctl+0x11c > > syscall() at netbsd:syscall+0xb4 > > --- syscall (number 54) --- > > 732731d1a88a: > > > > Looks like kernel goes infinite loop in usbd_ar_pipe by some reason. > > It tries to abort NOT_STARTED xfers. > > Can you tell me how to reproduce this failure? > "ifconfig down" works for me on RPI3B+. I tested on intel 3000 series CPU + Ivebridge with kernel from my local tree. But I found it does not happen with the lastest kernel from https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/amd64/binary/kernel/netbsd-GENERIC.gz.
Re: CVS commit: src/sys/dev/usb
On 2019/01/31 05:51, Rin Okuyama wrote: > By the way, I find that the system hangs silently by > "ifconfig mueN down" or detaching LAN7500 from USB port when > multiple outstanding requests are enabled. This does not occur > when MUE_TX_LIST_CNT = MUE_RX_LIST_CNT = 1. Do you have any ideas > to fix it? My axen dongle locks up if AXEN_RX_LIST_CNT > 1 when ifconfig down on amd64 8.99.34. db{0}> bt breakpoint() at netbsd:breakpoint+0x5 comintr() at netbsd:comintr+0x861 Xhandle_ioapic_edge4() at netbsd:Xhandle_ioapic_edge4+0x66 --- interrupt --- xhci_device_bulk_abort() at netbsd:xhci_device_bulk_abort+0x1c usbd_ar_pipe() at netbsd:usbd_ar_pipe+0x1e9 usbd_abort_pipe() at netbsd:usbd_abort_pipe+0x27 axen_stop() at netbsd:axen_stop+0xc4 axen_ioctl() at netbsd:axen_ioctl+0x1d9 doifioctl() at netbsd:doifioctl+0xa99 sys_ioctl() at netbsd:sys_ioctl+0x11c syscall() at netbsd:syscall+0xb4 --- syscall (number 54) --- 732731d1a88a: Looks like kernel goes infinite loop in usbd_ar_pipe by some reason. It tries to abort NOT_STARTED xfers.
Re: CVS commit: [netbsd-7] src
On 2017/07/26 15:22, Soren Jacobsen wrote: > Module Name: src > Committed By: snj > Date: Wed Jul 26 15:22:37 UTC 2017 > > Modified Files: > src/external/broadcom/rpi-firmware/dist [netbsd-7]: bootcode.bin >fixup.dat fixup_cd.dat start.elf start_cd.elf > src/sys/arch/arm/arm32 [netbsd-7]: cpu.c > src/sys/arch/arm/broadcom [netbsd-7]: bcm2835_bsc.c bcm2835_plcom.c > src/sys/arch/arm/cortex [netbsd-7]: gtmr.c > src/sys/arch/arm/include [netbsd-7]: armreg.h vfpreg.h > src/sys/arch/arm/vfp [netbsd-7]: vfp_init.c > src/sys/arch/evbarm/rpi [netbsd-7]: rpi_machdep.c vcprop.h > > Log Message: > Pull up following revision(s) (requested by jmcneill in ticket #1435): > sys/arch/arm/arm32/cpu.c: 1.113 via patch > sys/arch/arm/broadcom/bcm2835_bsc.c: 1.6 via patch > sys/arch/arm/broadcom/bcm2835_plcom.c: 1.4 via patch > sys/arch/arm/cortex/gtmr.c: 1.18 via patch > sys/arch/arm/include/armreg.h: 1.110 via patch > sys/arch/arm/include/vfpreg.h: 1.15 via patch > sys/arch/arm/vfp/vfp_init.c: 1.50 via patch > sys/arch/evbarm/rpi/rpi_machdep.c: 1.59, 1.70-1.72 via patch > sys/arch/evbarm/rpi/vcprop.h: 1.16 > Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs. > While I'm here add some A57/A72 info as well. > My RPI3 works with FB console - the uart needs some help with its clocks. > -- > Do invalidate the cache as RPI2 build with Clang can't fetch the memory > config otherwise. > -- > Use the VC property mailbox to request the UART clock rate and use it > appropriately > Newer firmwares use 48MHz > -- > Disable BSC0 on Raspberry Pi 3 and Zero W boards. Does rpi_machdep.c forget to set property "disable" in rpi_device_register?