From owner-freebsd-arm@freebsd.org Fri Jul 31 12:29:37 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 56D5B9AF3E7 for ; Fri, 31 Jul 2015 12:29:37 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (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 DABA31CD2 for ; Fri, 31 Jul 2015 12:29:36 +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 897771FE022; Fri, 31 Jul 2015 14:29:29 +0200 (CEST) Message-ID: <55BB6A7F.3060402@selasky.org> Date: Fri, 31 Jul 2015 14:30:55 +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: Svatopluk Kraus CC: "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> <55BB2A5F.9000502@selasky.org> <55BB3CC6.4030002@selasky.org> In-Reply-To: Content-Type: multipart/mixed; boundary="------------080704010005060204020007" 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 12:29:37 -0000 This is a multi-part message in MIME format. --------------080704010005060204020007 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 07/31/15 13:55, Svatopluk Kraus wrote: > On Fri, Jul 31, 2015 at 11:15 AM, Hans Petter Selasky wrote: >> Hi, >> >> I did some testing myself and I see the polling handler can loop many times >> when USB is active. Instead of 2 as a polling limit I've set 16. Hope this >> works too. Works fine over here. >> >> https://svnweb.freebsd.org/changeset/base/286118 >> Hi, > > Definitely, some limitation was needed there. Thanks. > > Unfortunatelly, it turned out that it does not help with my problem. > It has affected system response time in good way for some time after > the trigger is pulled. However, after 17 hours when buildworld > finished, system response time is bad again. > > It also turns out that I have a problem with booting my kernels. So I > cannot test the extra "clear RX FIFO level interrupt" patch as even > this one line of code causes that kernel does not boot. It freezes at > very beginning and even first printf is not printed. Thus I have to > debug this problem firstly. It will be very funny without either jtag > or early printf. ;) > I'll possibly order an RPI2 for myself. > Meantime, I have noticed that after reboot (system is 99% idle), I'm > getting the following output from vmstat: > > > IMO, 24000 interrupts per a second for bcm283x_dwco is too many. Yes, that's right. BTW: I see you are using RPI2 while I'm using an RPI-B. That's probably why this won't preproduce over here. I've made another patch to not write the GINTMSK with same values. Not sure if it makes any difference. --HPS --------------080704010005060204020007 Content-Type: text/x-diff; name="dwc_otg.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dwc_otg.diff" Index: dwc_otg.c =================================================================== --- dwc_otg.c (revision 286118) +++ dwc_otg.c (working copy) @@ -576,8 +576,10 @@ DPRINTFN(5, "RX status clear\n"); /* enable RX FIFO level interrupt */ - sc->sc_irq_mask |= GINTMSK_RXFLVLMSK; - DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); + if (!(sc->sc_irq_mask & GINTMSK_RXFLVLMSK)) { + sc->sc_irq_mask |= GINTMSK_RXFLVLMSK; + DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); + } /* clear cached status */ sc->sc_last_rx_status = 0; @@ -2656,8 +2658,10 @@ goto repeat; /* disable RX FIFO level interrupt */ - sc->sc_irq_mask &= ~GINTMSK_RXFLVLMSK; - DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); + if (sc->sc_irq_mask & GINTMSK_RXFLVLMSK) { + sc->sc_irq_mask &= ~GINTMSK_RXFLVLMSK; + DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); + } } if (sc->sc_flags.status_device_mode == 0 && sc->sc_xfer_complete == 0) { --------------080704010005060204020007--