lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 25 Mar 2020 15:00:20 +0000
From:   Qais Yousef <qais.yousef@....com>
To:     Alan Stern <stern@...land.harvard.edu>
Cc:     Oliver Neukum <oneukum@...e.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: lockdep warning in urb.c:363 usb_submit_urb

On 03/24/20 15:22, Alan Stern wrote:
> On Tue, 24 Mar 2020, Qais Yousef wrote:
> 
> > On 03/24/20 11:56, Alan Stern wrote:
> 
> > > This certainly reinforces the initial impression that the cause of the
> > > warnings is a bug in the platform code.  You should ask the appropriate
> > > maintainer.
> > 
> > The device-tree compatible node returns "generic-ohci".
> > drivers/usb/host/ohci-platform.c returns you as the maintainer :-)
> 
> I'm the maintainer of the driver for the device.  But the device
> structure itself (the one named 7ffb0000.ohci) gets created by 
> device-tree -- that's what I was referring to.
> 
> Here's the first error message:
> 
> usb usb2: runtime PM trying to activate child device usb2 but parent (7ffb0000.ohci) is not active
> 
> The runtime PM status of 7ffb0000.ohci is set in ohci_platform_probe(),
> which does:
> 
>         pm_runtime_set_active(&dev->dev);
> 
> The runtime PM status can change, and there aren't any debugging 
> statements in ohci_platform_suspend() or ohci_platform_resume() (or 
> ohci_suspend()/ohci_resume() in ohci-hcd.c, for that matter).  Maybe 
> you can add some so we can see if anything strange is going on.
> 
> Any maybe you can find out exactly where that error message is coming 
> from by calling dump_stack() immediately after the dev_err() line 
> (approximately line 1198 in drivers/base/power/runtime.c).
> 
> (Also, you might want to turn off rcutorture.  It adds a lot of 
> messages to the system log that are irrelevant for our purposes.)

Thanks for all the hints Alan.

I think I figured it out, the below patch seems to fix it for me. Looking
at other drivers resume functions it seems we're missing the
pm_runtime_disable()->set_active()->enable() dance. Doing that fixes the
warning and the dev_err() in driver/base/power.

I don't see xhci-plat.c doing that, I wonder if it needs it too.

I'm not well versed about the details and the rules here. So my fix could be
a hack, though it does seem the right thing to do.

I wonder why the power core doesn't handle this transparently..

Requested dmesg is attached too.


diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 7addfc2cbadc..eb92c8092fae 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -299,6 +299,10 @@ static int ohci_platform_resume(struct device *dev)
        }

        ohci_resume(hcd, false);
+
+       pm_runtime_disable(dev);
+       pm_runtime_set_active(dev);
+       pm_runtime_enable(dev);
        return 0;
 }
 #endif /* CONFIG_PM_SLEEP */


Thanks

--
Qais Yousef

View attachment "usb.dmesg" of type "text/plain" (49531 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ