Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp2545494pxx; Sun, 1 Nov 2020 01:38:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZehka0/UOek+H/E6WCE30M/xiJtKnS8jPucvxYEt/e7kUH/UU3vMkE+w5t67pvlvRzh7D X-Received: by 2002:aa7:cd8e:: with SMTP id x14mr11680242edv.173.1604223482023; Sun, 01 Nov 2020 01:38:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604223482; cv=none; d=google.com; s=arc-20160816; b=XwrVZd3A/4IwpHSuUE2fAzNSEPnKQIGQd+NK01jVAqEaNR+qYAxvarST93v3nwaiOU 9R/mMD2u91R0hcu4wJMGGhdKKAMJF3uM35RA0x2CmeotwqhZxplLzw1Vwe3AVuQ7txtK BfUuNbuRpHya1Kc7ASny4EpZFydFwDxUuMrCqNnAG9A4xJIa/HK2GDLUYaSu7uF1BGl7 WC/85V4T4yMmt400HJ7jQArKNt6Uv/QX4pOSabPB1mq78rC54ArMcpcLOL/dTsL6bz0v 41wEm622XxHKfTYmvFWNFpiTSu4tUrjsIJeTBXthHBRwhHpvQy1ehKSEYrNa4d5TEhTJ qoAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/oce0um8WtSP2tmvhfN/pTJN1h/4xmOJQT+i6aiYn5A=; b=Nmm4qxg+jRiTfB8KYqJC2z0Zbi4SmirQZAZCsKh2f9XIpLdSzpQ8pJzM1qZDPNnhOe ZxsiGhBcYuYmcB7niYO42lwZDPQvybgvHlD0Mg8ow4aSIyeuervuqbS2yMU0GlBER+jg IMnNg1ezdSeK4WpJgQeJZY/D3YHF7dwHzzBzEKwy9jNCUKgteC6NJrWlQlcPORRN14xU xu/xt3PbOLC09CY5FznBNh8QuS68ZqlJy3L9GK910M5UfMxd3BhG/Wczsow5dAIVW+2T oQvevJxKzsvxg7TQOYyrYNM9xgUL6YVDCwjyNCgw7tIDSBnfGPKw+d95wvHI+kC4ZPVs yjdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l4P5TADe; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l31si8077159edl.524.2020.11.01.01.37.39; Sun, 01 Nov 2020 01:38:02 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=l4P5TADe; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726155AbgKAJgP (ORCPT + 99 others); Sun, 1 Nov 2020 04:36:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:34724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbgKAJgO (ORCPT ); Sun, 1 Nov 2020 04:36:14 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD87720870; Sun, 1 Nov 2020 09:36:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604223373; bh=oVVJbpuCpdFDPmn7BbTaHQR1soNKyFAe5s0qbdFJSrg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=l4P5TADe18hQahhs1sf/HEtUc3oe7X6ZnhtxpJ05cCMKio7OhXNKDgCPWIRSIoQZg 42/hnf1YiwUBs9+HisZKrNoCeHx2pt6EGQ5y+Oj5iKJdLX1R7mBAXulPRP6YAcd/1V rtElF6VytLpdVt8t/64yxvmw+nHszvoIZY0tHeZ0= Date: Sun, 1 Nov 2020 10:36:10 +0100 From: Greg Kroah-Hartman To: "Rafael J. Wysocki" Cc: Linux PM , LKML , Lukas Wunner , Saravana Kannan , Xiang Chen Subject: Re: [PATCH 0/3] PM: runtime: Fixes related to device links management Message-ID: <20201101093610.GA9168@kroah.com> References: <6543936.FbWAdBN1tG@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6543936.FbWAdBN1tG@kreacher> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 21, 2020 at 09:10:08PM +0200, Rafael J. Wysocki wrote: > 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]. > > While this series touches the driver core, it really is mostly related to > runtime PM, so I can apply it if that's OK. Please do, sorry for the delay in reviewing them: Reviewed-by: Greg Kroah-Hartman