Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1678910ybb; Thu, 26 Mar 2020 05:28:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvddVixMl8o5tfA8U3+fbfF92tEG11VlhqRB0hS9dyDAcPIJcIrn4XpNsdwR5jBnPZOG0CH X-Received: by 2002:a05:6830:1495:: with SMTP id s21mr6351756otq.35.1585225707111; Thu, 26 Mar 2020 05:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585225707; cv=none; d=google.com; s=arc-20160816; b=lDE8RlOYocLGFp71/h+dkGwQRZTeCzpaFeZGjZwGefaBun6yQgpV8nqEWcd/hWnwbT oQm2z0Zl4DBCcBwmm6uFk53Fho1CtGra1axMB4JpBUblr/o4wpP5L/4o/iNUAhlFEVPg F/X3cxVnI/w771WOm5maK6oHkIMIssgXq9prpqrTUn3zg4CqJpmd6w+KMU+/QTavUI04 km1XvLPrXtnvMLRltVfGFVkwBMXjOUxDTl9dGK9QR54u+/xUbaR/QzGAteDh3izXO0EV hV+khrZyM92bGPl8OJ/sl7zEutDuCDAPeRZJhra+D23+MwleKwe2F2ls3Q02QL7pQhvO giGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=AWsaBRnWHlH3H0P4qK8zmbVf0Zv+tjy0fUsnHqQMgp4=; b=T3F9N/Oh+zFLRJMEqKmnkk6fkSluRnpan3qK4dwHSel4CYI2DE+1J8fysdrs/r1YS/ uCecLvm3F26yQbm5iRhLo9NQkY8FI6EyUktXQP0X5qKbqDIPWLTyTKHsbA6Ot6VAGG3F 3xC49zl9OeE/i1tP5Te9Gx3v7rGcYCiH1af+XdyaSKxyoaLSD92w0Cylhcy+U37L12zz Dc4IvjvxOSE78ZYRYASsZ6zwTNX3BvtPOKCo0qwP59xVOaWdWyfMqryqMQmaj8hgy9RA Bq8Xu8609+nvUn8UPe2wQ6DXfw1oPdEQmEXIVmbK0rrcKjpDTMmG60bve+j8vY0Y8PDx lzaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si999530oig.108.2020.03.26.05.28.14; Thu, 26 Mar 2020 05:28:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728140AbgCZM1u (ORCPT + 99 others); Thu, 26 Mar 2020 08:27:50 -0400 Received: from foss.arm.com ([217.140.110.172]:59878 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727781AbgCZM1u (ORCPT ); Thu, 26 Mar 2020 08:27:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6623C30E; Thu, 26 Mar 2020 05:27:49 -0700 (PDT) Received: from e107158-lin (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4B55D3F71F; Thu, 26 Mar 2020 05:27:48 -0700 (PDT) Date: Thu, 26 Mar 2020 12:27:45 +0000 From: Qais Yousef To: "Rafael J. Wysocki" Cc: Alan Stern , "Rafael J. Wysocki" , Oliver Neukum , Greg Kroah-Hartman , USB list , Linux-pm mailing list , Kernel development list Subject: Re: lockdep warning in urb.c:363 usb_submit_urb Message-ID: <20200326122744.kbtlmev2ravn3wey@e107158-lin> References: <20200325150017.xhabucfo3v6i234o@e107158-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/25/20 22:28, Rafael J. Wysocki wrote: > On Wed, Mar 25, 2020 at 9:49 PM Alan Stern wrote: > > > > On Wed, 25 Mar 2020, Qais Yousef wrote: > > > > > 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. > > > > Ah, yes. This should have been added years ago; guess I forgot. :-( > > > > > 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.. > > > > Initially, we didn't want the PM core to do this automatically because > > we thought some devices might want to remain runtime-suspended > > following a system resume, and only the device driver would know what > > to do. > > > > Raphael, now that we have the direct_complete mechanism, can we revisit > > this? Should the PM core automatically call pm_runtime_set_active() if > > dev->power.direct_complete isn't set? Perhaps in device_resume_early() > > prior to the pm_runtime_enable() call? > > > > It's possible we discussed this and decided against it at the time when > > direct_complete was added, but if so I don't remember what was said. > > Me neither. :-) > > That said complexity has grown since then and there are the > DPM_FLAG_SMART_SUSPEND and DPM_FLAG_LEAVE_SUSPENDED flags that can be > used to control that behavior to some extent. > > Setting DPM_FLAG_SMART_SUSPEND alone, in particular, causes > pm_runtime_set_active() to be called at the noirq stage of device > resume either by the core or by bus types (e.g. PCI) etc. > > It looks like ohci-platform might use DPM_FLAG_SMART_SUSPEND, but I > need to take a closer look at that (possibly later this week). Okay I take it this was root caused correctly and now it's a question of which is a better fix. Thanks! -- Qais Yousef