Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp640213pxu; Fri, 23 Oct 2020 09:34:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNuFGg1gGRKcqOEdNkpLGuohGrtBGXXtZ3zD56Eo2Rhn9JBX5he+NUWwUBumYhLoAJmsms X-Received: by 2002:a50:ec02:: with SMTP id g2mr1048352edr.104.1603470876977; Fri, 23 Oct 2020 09:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603470876; cv=none; d=google.com; s=arc-20160816; b=nNIUFZprpCqevpEn4v6n/l0zAtghkeXYbNDedR8SH/4ihG3ESObWFnfkWuEipmZTu0 /ImZ3gJAscY9uj29ssPkcof83uaZ9MVdSdxDQ3a9Ghx3PVcc2mH/jEi7+mU5KT3tWUlL FKEn/pfV3YJKLY6WO/xE8Kv8P1hkvdaTpuv7XkqlNiqeSYhRm6KJQLK+r52PavhWzIHg KuE+pB0txcJnjYaCmsC/l0JoeBvUwNVrPsT4/Dm1Rf/DkVDmJR1pJ+4nqFDatuq1txVu TMS8F7kQXwtoxVsziDKCzk5+ry9VvCazQehcatFk0FeJvjbqsSSkcDObih1o4OBZ2jPW YJqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=u7OZ7g5s+ZfRK1GU7bhvcQ588qcFXD8gAszYUX9vuaI=; b=FpgEn9zyB+W7aJN40+hG1TfrSTC2/1lqpfTdntqx4zmwTVLP027g+/EtwUZgd4Qk6i j1GasYLJRc0R9ciIaZmrkjHKlWZ0ovpJaW5jI5gDqQt6qlr+QsvLcA/zYW8aIBHvs9iN 9w029eUYioJYRAoYfLLLQB2OY3t6ZfUEcq6ZKKHzLpdP7bQXLJ5pi+JNx+pAvk/v7n7z 8/HMY8Xn6ehXPbfV55L/TfDwRYCLahkjILYXuJVJsB+J54yVBFIXdVUAJHiOFQdK09MH sSG7deA3R2EYSd6DjP4ynEcEKnquCYZscsZ/IvUSQue+8iSHeRk48vjNIgiNeY+s82UC fcBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a23si1168687ejg.50.2020.10.23.09.34.14; Fri, 23 Oct 2020 09:34:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S465548AbgJWPGy convert rfc822-to-8bit (ORCPT + 99 others); Fri, 23 Oct 2020 11:06:54 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:50356 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S465544AbgJWPGy (ORCPT ); Fri, 23 Oct 2020 11:06:54 -0400 Received: from 89-64-88-190.dynamic.chello.pl (89.64.88.190) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.491) id e7860b8843c45b1e; Fri, 23 Oct 2020 17:06:52 +0200 From: "Rafael J. Wysocki" To: "chenxiang (M)" Cc: Greg Kroah-Hartman , Linux PM , LKML , Lukas Wunner , Saravana Kannan Subject: Re: [PATCH 0/3] PM: runtime: Fixes related to device links management Date: Fri, 23 Oct 2020 17:06:51 +0200 Message-ID: <3725593.WVS78bcaU2@kreacher> In-Reply-To: <7ebacb82-dc0c-3938-660d-52810607ac00@hisilicon.com> References: <6543936.FbWAdBN1tG@kreacher> <7ebacb82-dc0c-3938-660d-52810607ac00@hisilicon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, October 23, 2020 5:50:04 AM CEST chenxiang (M) wrote: > Hi Rafael, > > 在 2020/10/22 3:10, Rafael J. Wysocki 写道: > > Hi Greg & all, > > > > Commit d12544fb2aa9 ("PM: runtime: Remove link state checks in > > rpm_get/put_supplier()") merged recently introduced a weakness > > in the handling of device links in the runtime PM framework that > > may be confusing and even harmful. > > > > Namely, the checks removed by that commit prevented PM-runtime from > > getting or dropping references to the supplier device whose driver > > was going away via its links to consumers, which specifically allowed > > the pm_runtime_clean_up_links() called from __device_release_driver() > > to run without interfering with runtime suspend/resume of consumer > > devices (which still might happen even though the drivers had been > > unbound from them by that time). > > > > After the above commit, calling pm_runtime_clean_up_links() from > > __device_release_driver() makes a little sense and it may be interfering > > destructively with regular PM-runtime suspend/resume control flows, so > > it needs to be either fixed or dropped altogether. I prefer the latter, > > because among other things this removes an arbitrary difference in the > > handling of managed device links with respect to the stateless ones, > > so patch [2/3] is doing just that. > > > > However, in some rare cases pm_runtime_clean_up_links() may help to clean > > up leftover PM-runtime references, so if that function goes away, they > > need to be cleaned up elsewhere. That's why patch [1/3] modifies > > __device_link_del() to drop them upon device link removal (which also > > needs to be done for stateless device links and that's why I'm regarding > > this patch as a fix). > > > > Finally, to avoid pointless overhead related to suspending and resuming > > the target device for multiple times in a row in __device_release_driver(), > > it is better to resume it upfront before checking its links to consumers, > > which is done by patch [3/3]. > > > I have tested the patchset, and it solves my reported issue, so please > feel free to add : > Tested-by: Xiang Chen Thank you!