Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3378639imj; Tue, 19 Feb 2019 02:26:41 -0800 (PST) X-Google-Smtp-Source: AHgI3IY5Rv9f1KzRo3hkSsknZP3yNaHhufSC4qf1AZyS0edfg9zuZyqlsRcWt5e4J6Yp9tCD4qA1 X-Received: by 2002:a63:f806:: with SMTP id n6mr1148757pgh.19.1550572001379; Tue, 19 Feb 2019 02:26:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550572001; cv=none; d=google.com; s=arc-20160816; b=0W4oD1+aAuLyf/iOO8MRAriHIgrC9zpZF06vLQFMlLgSmuuzJEFzEDA6hWp1OeQrSV DrZX8Sykwa33LkfONmpWSPs/HONr59mLw8CWz4YEuk4QExZnCRnLykDsd4wtBQitdX1y p10KiUtsCdkj8KM4+typx6xl0Qhvb+eXEc92TPpV0ndw4Rix6TS8AouucbKng47/5DmN j7GulzD5LxwSpoZP28cQFTEkx17Bh88pahwujVz6HEpc2myBl+5d4JBKKl804jO98QLI 2DglH0y6cvhPGkZajMtBeOYQtwQ5oBrVuJybh1XgMCRQv3Jf5k8DDsNEcwZH+lymyswr TC1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=mRbLdYa0YQ4hDOEbu97IECr+bQAxsEB6jgUkcv3H+Y4=; b=XJbj7hHj6Z6NLuaLo9htQGubeIHCD7eBYLDzhzOt/H+5UYSBLFNTsqXwMTvFZZQhMq 9AkQyaHdepqp1i6/9Pz2rCT/YuujeQj+n0/+T4zKjsofMPPPBQ1IjN3CvCVptLvdgveh 6h/11K9d82xjt0m938kI8AWT33V0upy/nVu15v2uXXbI+19CuR0ye5yrnxJ6yGC2qQzP K/v2IdlrmF5Ougt8L+L8w1dGXBSVVt7+3eKA9xtY9C+Rq/62sXM+v9ug+l2pmIYpXymh FvDmxhgN0XGqT4+LDPOnBBBdiIO8LDWe+ez7IqBntzTrFdJ0Rt7LtT15pZOSjiGq+ZTf 0p9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=d60XzpJI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o37si15742790pgm.85.2019.02.19.02.26.25; Tue, 19 Feb 2019 02:26:41 -0800 (PST) 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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=d60XzpJI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728167AbfBSKYf (ORCPT + 99 others); Tue, 19 Feb 2019 05:24:35 -0500 Received: from hqemgate14.nvidia.com ([216.228.121.143]:18748 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728034AbfBSKYe (ORCPT ); Tue, 19 Feb 2019 05:24:34 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 19 Feb 2019 02:24:41 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 19 Feb 2019 02:24:33 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 19 Feb 2019 02:24:33 -0800 Received: from [10.21.132.148] (10.124.1.5) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 19 Feb 2019 10:24:30 +0000 Subject: Re: [RFT/RFC][PATCH] driver core: Fix PM-runtime for links added during consumer probe 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 References: <14371356.imFjPFOrCi@aspire.rjw.lan> From: Jon Hunter Message-ID: Date: Tue, 19 Feb 2019 10:24:29 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <14371356.imFjPFOrCi@aspire.rjw.lan> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL101.nvidia.com (172.20.187.10) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1550571881; bh=mRbLdYa0YQ4hDOEbu97IECr+bQAxsEB6jgUkcv3H+Y4=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=d60XzpJIwPamCwQggxdyiV4NDkcHBpSVY2nHwdVy3LUWKcF4q2uzY1SAsqq1yHOcQ SmhF/ArgdNnUXa2XsegtiC/wwGk2kf9Q6mr0z0KwpLh3dc8XHUoitO96WwXigX1YnC 74sYe8YTTMATJiKy4aiCxAIGqq1lhFMhTlTpeDtMauLhKmDiZJu66jsTZyN6MlyPMq V1p9URaJMwKla1gD8s+cIsn6LpvaTVQp+2NVuyG+fWa9u4lgR7V84s+5Znxcips4Lo 6H1vvNIj8n0524kg+x02x/yMb6k10BVkUU6a3/3CbmqFRVLiC9PPsQDIOf0CtRyU7T TowRP5Rai67FQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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