From owner-freebsd-arm@freebsd.org Fri Jul 31 07:55:56 2015 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA56A9AF475 for ; Fri, 31 Jul 2015 07:55:56 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B5A315E8 for ; Fri, 31 Jul 2015 07:55:56 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 55D671FE022 for ; Fri, 31 Jul 2015 09:55:53 +0200 (CEST) Message-ID: <55BB2A5F.9000502@selasky.org> Date: Fri, 31 Jul 2015 09:57:19 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: freebsd-arm@FreeBSD.org Subject: Re: DWC OTG TX path optimisation for 11-current References: <55A7D8CE.4020809@selasky.org> <55B23276.8090703@selasky.org> <55B73113.2020308@selasky.org> <55B8AB76.7030603@selasky.org> <55B8B297.1010008@selasky.org> <20150729154516.GH78154@funkthat.com> <55B8F5EC.2050908@selasky.org> <46ad096c958.1a82a175@mail.schwarzes.net> <55B9C3E2.5040501@selasky.org> <46ae815c7c3.447237c8@mail.schwarzes.net> <46aece00b53.3c1cdc1f@mail.schwarzes.net> In-Reply-To: <46aece00b53.3c1cdc1f@mail.schwarzes.net> Content-Type: multipart/mixed; boundary="------------000600070201000204010603" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 07:55:56 -0000 This is a multi-part message in MIME format. --------------000600070201000204010603 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 07/31/15 05:52, Andreas Schwarz wrote: > On 31.07.15, Andreas Schwarz wrote: >> On 30.07.15, Hans Petter Selasky wrote: >>> On 07/29/15 21:41, Andreas Schwarz wrote: >>>> On 29.07.15, Hans Petter Selasky wrote: >>>> >>>>> On 07/29/15 17:45, John-Mark Gurney wrote: >>>>>> Just for your information, when I start buildworld, the system >>>>>>> responds very fast (console, ssh). After about one hour, it starts to >>>>>>> print the following warnings: >>>>> >>>>> Did this happen before r285935 aswell or only after this revision? >>>> >>>> This will happen since ~r283xxx, there are some reports in this ml, >>>> have a look at my post from 2015-06-03. >>>> >>> >>> If this is easy to reproduce for you, can you try the SMSC patch I made? >> >> It's not so easy to reproduce, it will occur under high load (and disk IO) >> situations, e.g.when building the world (-j4). But not in every case, >> sometimes buildworld complete without a problem. >> >> If the system is in this state, it will react very very slow. System load >> is high (without a causing process) and it will often hang (during shutdown) >> when performing a reboot. >> >> I'll try your patch. > > This was fast. Patch (smsc.diff) did not help. I've applied the patch, compiled and > installed the new kernel and started to build the kernel tool-chain. Just 10 minutes > ago the problem occur again. > Hi, Can you try this patch separately from the attached one? > Index: sys/dev/usb/controller/dwc_otg.c > =================================================================== > --- sys/dev/usb/controller/dwc_otg.c (revision 286002) > +++ sys/dev/usb/controller/dwc_otg.c (working copy) > @@ -579,6 +579,9 @@ > sc->sc_irq_mask |= GINTMSK_RXFLVLMSK; > DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); > > + /* clear RX FIFO level interrupt */ > + DWC_OTG_WRITE_4(sc, DOTG_GINTSTS, GINTSTS_RXFLVL); > + > /* clear cached status */ > sc->sc_last_rx_status = 0; > } The attached patch will add some more debug prints so that I know what is going on in the problematic function. You'll need to C&P me the resulting console prints. --HPS --------------000600070201000204010603 Content-Type: text/x-diff; name="dwc_otg.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dwc_otg.diff" Index: dev/usb/controller/dwc_otg.c =================================================================== --- dev/usb/controller/dwc_otg.c (revision 286002) +++ dev/usb/controller/dwc_otg.c (working copy) @@ -2554,8 +2554,17 @@ uint32_t temp; uint8_t got_rx_status; uint8_t x; + uint32_t count = 0; + int came_from = -1; + static uint32_t max_count; repeat: + if (++count > max_count && came_from != -1) { + max_count = count; + printf("MAX=%d CAME=%d STS=0x%08x ACTIVE=0x%08x\n", + (int)max_count, came_from, sc->sc_last_rx_status, + sc->sc_active_rx_ep); + } /* get all channel interrupts */ for (x = 0; x != sc->sc_host_ch_max; x++) { temp = DWC_OTG_READ_4(sc, DOTG_HCINT(x)); @@ -2593,6 +2602,7 @@ DPRINTFN(5, "channel halt complete ch=%u\n", ep_no); } dwc_otg_common_rx_ack(sc); + came_from = 1; goto repeat; } @@ -2612,6 +2622,7 @@ /* check if we should dump the data */ if (!(sc->sc_active_rx_ep & (1U << ep_no))) { dwc_otg_common_rx_ack(sc); + came_from = 2; goto repeat; } @@ -2634,6 +2645,7 @@ /* check if we should dump the data */ if (!(sc->sc_active_rx_ep & (1U << ep_no))) { dwc_otg_common_rx_ack(sc); + came_from = 3; goto repeat; } @@ -2646,8 +2658,10 @@ if (got_rx_status) { /* check if data was consumed */ - if (sc->sc_last_rx_status == 0) + if (sc->sc_last_rx_status == 0) { + came_from = 4; goto repeat; + } /* disable RX FIFO level interrupt */ sc->sc_irq_mask &= ~GINTMSK_RXFLVLMSK; @@ -2656,8 +2670,10 @@ if (sc->sc_flags.status_device_mode == 0 && sc->sc_xfer_complete == 0) { /* update host transfer schedule, so that new transfers can be issued */ - if (dwc_otg_update_host_transfer_schedule_locked(sc)) + if (dwc_otg_update_host_transfer_schedule_locked(sc)) { + came_from = 5; goto repeat; + } } } --------------000600070201000204010603--