Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp122125imm; Wed, 4 Jul 2018 19:33:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcHLr0o88WEBz8yOyX/u1QZ2c3uxs0B6C/yphgeWqS45fEoyqK+lW9Xv2U8FoOzxOKJ4keG X-Received: by 2002:a17:902:28a6:: with SMTP id f35-v6mr4247767plb.110.1530758017024; Wed, 04 Jul 2018 19:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530758016; cv=none; d=google.com; s=arc-20160816; b=NhLxEKH+yVibmxALr3q08/DexoF0VBv4seZs2eVv41imSG/6kL8+YoO4AmF081bc3X wLubMa8hM2conf3yFQblG3GeN/gvhHfJHrgdo+Q1PnP/LQXshxBI1f8XtmsJnojM736v pVlv8f8gEyVQhHc+I8ovD+vVLNcrX5/bqHsdDWmL192ymn90WKXqbJFpHfzMGPbE8lhx iXw11+tLkMrLGAL/5BiW52w3L/EGLx1HwjNOA131xmjykmycXwaRVjbF0TZymIaQ55hI nnTF8pCKJZnpBsIxqVy7eIbWt+wcQU4iS9m/fzQR+nAgm19miqidLAxh8ppCxXbMdNdw kMDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=UEN44L0WpcaoMtnBt/HKS3cdaZtZh9S3j+gpjnm+Fc0=; b=tqm5Lh5hB1I5bLNTtQk6QJlxhz7hxWQs8syZZvh574pRLMxgv5+xpM6cucVSX/ill6 R2lk3tXeP4pSf6wfk+w/QjSl1clX/u7dGN2qWeVnZahuhFYdxcJzLxlW4USHGJ/H4zgh HmOazCCyKyZZ8iSaYKD643CfWD9b3Dv/m+JAyqwV0rt/izLSnx5Thty1ryKfenp7dTYg XRUOaK9i7/Gk2NG6hoFi5t4P1IGmQC1dKQ6GQkjB7aJrEApCcRuaOq7mVXhDh6LI7aPP kctpJkK7Qzig44aAhhfjQ6wEU05BmZL13qwruqTJkt5lX+MNAjbZI/e0kzQ2FsVAkLbC JHIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ok1uE2Ue; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4-v6si4896447pfa.263.2018.07.04.19.33.20; Wed, 04 Jul 2018 19:33:36 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ok1uE2Ue; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753151AbeGECch (ORCPT + 99 others); Wed, 4 Jul 2018 22:32:37 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:42452 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753062AbeGECcf (ORCPT ); Wed, 4 Jul 2018 22:32:35 -0400 Received: by mail-io0-f193.google.com with SMTP id r24-v6so6316631ioh.9; Wed, 04 Jul 2018 19:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UEN44L0WpcaoMtnBt/HKS3cdaZtZh9S3j+gpjnm+Fc0=; b=ok1uE2Uea6HURBK3INWnxeIT8wksJUedxleVs8JOaNAEMbIfZmclQW2Id5xe/ouO6s LadAZvqCb5kmaxHzROmpw03yM38LFQqRfYNl1YHC9L0qtb6oyVUkF34W4GtgPthsA2od JkgrNQNLDxzz6X61ME6VK24TyCHOsx1ic8kpEiaHK9BMN0ouPmoUQ/fpyHBq6p665dUC IjopS2OG/upCaFgr6t0GMgRZho1Ky9DTkAiYUW80EPadk8bjoj5oNh6rtMf/3TzLZTa9 r55fBaGb5WNMebCW465psEO2U6SgDd/1TuiVO9VhPiJq28xvaoN9y2EAP82QVjFfornI uqLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UEN44L0WpcaoMtnBt/HKS3cdaZtZh9S3j+gpjnm+Fc0=; b=dnf/Lm7mrYa4c8zZdK3nKhmc84IWYXEf3/d3NF0lJaKCLaqqC/5iVZ3+Aa0LN4Vf+h ioElhwYYY+42UDzjbIgXOabD0zNVTxGyxOQfQRsCgMd5Cgfhf7GH4nH5SXZHaAmZyScq FweHL5Yn6sr3/xcPbf+7DY2j/hsU6JAC/cAX+Bny0W5TitL99zvs/80WHQvKtNFyO2cD 50PmPyLkS2Ir9SH0VHrcPNXFhiWimRQ7dsuSJrxNx9bl1X/T5dxisoTiDe7vGbJVhB87 DH72qNiLfSUXGS3jgRLqtGvjoHBCNXtfeZUM584D4v8nPNx0Y/QIZ22w/C2yBRI2uApT UEFw== X-Gm-Message-State: AOUpUlGurpo8ILTTe8BBPZ1rBtjNNDTvxIkpPu9aFx1dnHlVseE+Vsj7 xcgkkatarmsM4blFE/g3RtEirgnuGZ99NVr+cw== X-Received: by 2002:a6b:1e91:: with SMTP id e139-v6mr3546673ioe.36.1530757955212; Wed, 04 Jul 2018 19:32:35 -0700 (PDT) MIME-Version: 1.0 References: <1530600642-25090-1-git-send-email-kernelfans@gmail.com> <3375966.ydPZj5TMVj@aspire.rjw.lan> <2842715.a5PfnD4e6X@aspire.rjw.lan> In-Reply-To: <2842715.a5PfnD4e6X@aspire.rjw.lan> From: Pingfan Liu Date: Thu, 5 Jul 2018 10:32:23 +0800 Message-ID: Subject: Re: [PATCHv3 3/4] drivers/base: clean up the usage of devices_kset_move_last() To: rjw@rjwysocki.net Cc: Grygorii Strashko , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Christoph Hellwig , Bjorn Helgaas , Dave Young , linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-pm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 4, 2018 at 6:18 PM Rafael J. Wysocki wrote: > > On Wednesday, July 4, 2018 6:40:09 AM CEST Pingfan Liu wrote: > > On Tue, Jul 3, 2018 at 10:28 PM Rafael J. Wysocki wrote: > > > > > > On Tuesday, July 3, 2018 8:50:41 AM CEST Pingfan Liu wrote: > > > > Clean up the referring to the code in commit 52cdbdd49853 ("driver core: > > > > correct device's shutdown order"). So later we can revert it safely. > > > > > > > > Cc: Greg Kroah-Hartman > > > > Cc: Rafael J. Wysocki > > > > Cc: Grygorii Strashko > > > > Cc: Christoph Hellwig > > > > Cc: Bjorn Helgaas > > > > Cc: Dave Young > > > > Cc: linux-pci@vger.kernel.org > > > > Cc: linuxppc-dev@lists.ozlabs.org > > > > Signed-off-by: Pingfan Liu > > > > --- > > > > drivers/base/core.c | 7 ------- > > > > 1 file changed, 7 deletions(-) > > > > > > > > diff --git a/drivers/base/core.c b/drivers/base/core.c > > > > index 684b994..db3deb8 100644 > > > > --- a/drivers/base/core.c > > > > +++ b/drivers/base/core.c > > > > @@ -127,13 +127,6 @@ static int device_reorder_to_tail(struct device *dev, void *not_used) > > > > { > > > > struct device_link *link; > > > > > > > > - /* > > > > - * Devices that have not been registered yet will be put to the ends > > > > - * of the lists during the registration, so skip them here. > > > > - */ > > > > - if (device_is_registered(dev)) > > > > - devices_kset_move_last(dev); > > > > - > > > > if (device_pm_initialized(dev)) > > > > device_pm_move_last(dev); > > > > > > You can't do this. > > > > > > If you do it, that will break power management in some situations. > > > > > Could you shed light on it? I had a quick browsing of pm code, but it > > is a big function, and I got lost in it. > > If the above code causes failure, then does it imply that the seq in > > devices_kset should be the same as dpm_list? > > Generally, yes it should. > > > But in device_shutdown(), it only intersect with pm by > > pm_runtime_get_noresume(dev) and pm_runtime_barrier(dev). How do these > > function affect the seq in dpm_list? > > They are not related to dpm_list directly. > > However, if you shut down a supplier device before its consumer and that > involves power management, then the consumer shutdown may fail and lock up > the system > Ah, get your point. The patch in this series "[PATCHv3 2/4] drivers/base: utilize device tree info to shutdown devices" still obey the shutdown order "parent<-child" and "supplier<-consumer". It just utilizes device-tree info to achieve this, since it turns out not easy to maintain such order in devices_kset. As I described in the commit log of [2/4], it needs two nested recursion, and should consider the breakage of devices_kset's spinlock. > I asked you elsewhere to clearly describe the problem you are trying to > address. Please do that in the first place. > OK, I will reply your question in [0/4] Thanks, Pingfan