On 5/2/2019 03:58, Doug Anderson wrote: > Hi, > > > On Wed, Apr 17, 2019 at 5:15 PM Douglas Anderson <dianders@xxxxxxxxxxxx> wrote: >> >> This is an attempt to rehash commit 0cf884e819e0 ("usb: dwc2: add bus >> suspend/resume for dwc2") on ToT. That commit was reverted in commit >> b0bb9bb6ce01 ("Revert "usb: dwc2: add bus suspend/resume for dwc2"") >> because apparently it broke the Altera SOCFPGA. >> >> With all the changes that have happened to dwc2 in the meantime, it's >> possible that the Altera SOCFPGA will just magically work with this >> change now. ...and it would be good to get bus suspend/resume >> implemented. >> >> This change is a forward port of one that's been living in the Chrome >> OS 3.14 kernel tree. >> >> Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx> >> --- >> This patch was last posted at: >> >> https://urldefense.proofpoint.com/v2/url?u=https-3A__lkml.kernel.org_r_1446237173-2D15263-2D1-2Dgit-2Dsend-2Demail-2Ddianders-40chromium.org&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=9hPBFKCJ_nBjJhGVrrlYOeOQjP_HlVzYqrC_D7niMJI&m=7rxT8EFX9mqUDtTL4P7iuzYNsYROe9rxHGCresSKPTg&s=lTaNUA2XIYPat417fkd1A4Zpvb5eyYtTc1H_NIfW8Vw&e= >> >> ...and appears to have died the death of silence. Maybe it could get >> some bake time in linuxnext if we can't find any proactive testing? >> >> I will also freely admit that I don't know tons about the theory >> behind this patch. I'm mostly just re-hashing the original commit >> from Kever that was reverted since: >> * Turning on partial power down on rk3288 doesn't "just work". I >> don't get hotplug events. This is despite dwc2 auto-detecting that >> we are power optimized. >> * If we don't do something like this commit we don't get into as low >> of a power mode. > > OK, I spent the day digging more into this patch to confirm that it's > really the right thing to do. ...and it still seems to be. > > First off: I'm pretty sure the above sentence "If we don't do > something like this commit we don't get into as low of a power mode." > is totally wrong. Luckily it's "after the cut" and not part of the > commit message. Specifically I did a bunch of power testing and I > couldn't find any instance saving power after this patch. > > ...but, then I looked more carefully at all the history of this > commit. I ended up at: > > https://urldefense.proofpoint.com/v2/url?u=https-3A__chromium-2Dreview.googlesource.com_c_chromiumos_third-5Fparty_kernel_-2B_306265_&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=9hPBFKCJ_nBjJhGVrrlYOeOQjP_HlVzYqrC_D7niMJI&m=7rxT8EFX9mqUDtTL4P7iuzYNsYROe9rxHGCresSKPTg&s=LiyyIyaCPmr88nJeI7TCGtoJBFLRWir_reikYtAHHDw&e= Looking at this code review I see that this patch fixes whatever issues you have on Chrome OS 3.14. But your patch has landed on the top of latest Kernel version. With the latest version I think you would not have the regression issue. So you are fixing Chrome OS 3.14. > > ...where I said that this fixes a resume speed regression. More > details could be found at the linked bug, AKA: > > https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.chromium.org_p_chromium_issues_detail-3Fid-3D548336&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=9hPBFKCJ_nBjJhGVrrlYOeOQjP_HlVzYqrC_D7niMJI&m=7rxT8EFX9mqUDtTL4P7iuzYNsYROe9rxHGCresSKPTg&s=7gK8ZGX2zZPqC98CDMhqxEY3Acm_TbYa3fpQjWtvexM&e= > > ...but, sadly, I wasn't as verbose as I usually am and didn't describe > my exact testing setup. So I tried to reproduce. ...and I was able > to. I tested on an rk3288-veyron-jerry with an empty USB hub plugged > into the left port (the host port) and my "servo 2" debug board hooked > up to the right port. The "power_Resume" test in Chrome OS certainly > showed a regression in 3.14 when doing a suspend/resume cycle. > > > Digging into the logs in 3.14, before this patch I saw this in the logs: > > usb 3-1: reset high-speed USB device number 2 using dwc2 > usb 3-1.7: reset high-speed USB device number 3 using dwc2 > > ...after this patch: > > usb 3-1: USB disconnect, device number 2 > usb 3-1.7: USB disconnect, device number 3 > usb 3-1: new high-speed USB device number 4 using dwc2 > usb 3-1: New USB device found, idVendor=1a40, idProduct=0201, bcdDevice= 1.00 > usb 3-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0 > usb 3-1: Product: USB 2.0 Hub [MTT] > usb 3-1.7: new high-speed USB device number 5 using dwc2 > usb 3-1.7: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11 > usb 3-1.7: New USB device strings: Mfr=0, Product=1, SerialNumber=0 > usb 3-1.7: Product: USB 2.0 Hub > > ...so basically my belief is that without this patch we're just sorta > leaving the device hanging and it get confused on resume. After this > patch we behave slightly better. > > I tested on 4.19 and found much the same. There: > > usb 2-1: reset high-speed USB device number 2 using dwc2 > usb 2-1.7: reset high-speed USB device number 3 using dwc2 > > vs. > > usb 2-1.7: USB disconnect, device number 3 > usb 2-1: USB disconnect, device number 2 > usb 2-1: new high-speed USB device number 4 using dwc2 > usb 2-1: New USB device found, idVendor=1a40, idProduct=0201, bcdDevice= 1.00 > usb 2-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0 > usb 2-1: Product: USB 2.0 Hub [MTT] > usb 2-1.7: new high-speed USB device number 5 using dwc2 > usb 2-1.7: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11 > usb 2-1.7: New USB device strings: Mfr=0, Product=1, SerialNumber=0 > usb 2-1.7: Product: USB 2.0 Hub > > > On 4.19 I didn't actually notice a the same resume time regression, > presumably because things are happening more asynchronously there (I > didn't confirm this). ...but in any case it seems like the right > thing to do to actually do the suspend. > > > I'll also re-iterate once more that I'm not claiming that my patch > helps with "partial power down". It merely makes the "power savings > disabled" case work more properly. > > > I'll also note that my patch is already in Felipe's "testing/next" > branch which I continue to believe is correct and good. > > -Doug > -- Regards, Artur