From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Hunter Subject: Re: [RFT/RFC][PATCH] driver core: Fix PM-runtime for links added during consumer probe Date: Tue, 19 Feb 2019 10:24:29 +0000 Message-ID: References: <14371356.imFjPFOrCi@aspire.rjw.lan> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <14371356.imFjPFOrCi@aspire.rjw.lan> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: "Rafael J. Wysocki" , Ulf Hansson Cc: Greg Kroah-Hartman , LKML , Linux PM , Daniel Vetter , Lukas Wunner , Andrzej Hajda , Russell King - ARM Linux , Lucas Stach , Linus Walleij , Thierry Reding , Laurent Pinchart , Marek Szyprowski , linux-tegra List-Id: linux-pm@vger.kernel.org On 18/02/2019 22:08, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Commit 4c06c4e6cf63 ("driver core: Fix possible supplier PM-usage > counter imbalance") introduced a regression that causes suppliers > to be suspended prematurely for device links added during consumer > driver probe if the initial PM-runtime status of the consumer is > "suspended" and the consumer is resumed after adding the link and > before pm_runtime_put_suppliers() is called. In that case, > pm_runtime_put_suppliers() will drop the rpm_active refcount for > the link by one and (since rpm_active is equal to two after the > preceding consumer resume) the supplier's PM-runtime usage counter > will be decremented, which may cause the supplier to suspend even > though the consumer's PM-runtime status is "active". > > For this reason, partially revert commit 4c06c4e6cf63 as the problem > it tried to fix needs to be addressed somewhat differently, and > change pm_runtime_get_suppliers() and pm_runtime_put_suppliers() so > that the latter only drops rpm_active references acquired by the > former. [This requires adding a new field to struct device_link, > but I coulnd't find a cleaner way to address the issue that would > work in all cases.] > > Fixes: 4c06c4e6cf63 ("driver core: Fix possible supplier PM-usage counter imbalance") > Reported-by: Jon Hunter > Signed-off-by: Rafael J. Wysocki > --- > > On top of driver-core/driver-core-next. > > Jon, Ulf, please test! Thanks Rafael this works for me! Tested-by: Jon Hunter Cheers Jon -- nvpublic