Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1006853imm; Mon, 9 Jul 2018 15:09:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcXcFv2myzgBOmEajtT5PFciIHzVKrY2DuKmjz/qkOZtJIMxlCkPRk30O4AuuqrmWTZIWes X-Received: by 2002:a65:6411:: with SMTP id a17-v6mr19952875pgv.287.1531174164607; Mon, 09 Jul 2018 15:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531174164; cv=none; d=google.com; s=arc-20160816; b=LamtjZTSOUCG+XMfQrF/eaCdRW9ooQ6yH3stkh0pfj9HeobnFWMICVw7tLde9G9iOo exqOyqwsmbbY2ftUVNg8SL6J3SPrJ4n6U/FCb3R0w3434hegeYciA17Wp1qm8qHRkDFN F1MLQO7KQCZF+Rrz9AGLXwbO2d+pzPb2pIeFqL9PwNonkVXza+BTcMu7SkcqdCm5NEGX bjzDPKdPhwPAQX2F09e4+Y/lTrqnPA5n8YXd1M+4DNj42AnFX2gawvIqKFSlkkn4+jie 59jT765wRc9OV4AklWeDWbK79+/l22kfVSsQm73mEY/migZNcH4z/qcgePrHZuhJlTOr aLng== 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=WUiNf+V/V9XL2NJIlHWqSlv5mvsQHLyrvVGow+AZBXs=; b=ENTxjqUNvqRZ6SRhP93VmisCTJJD97oUFKmoi2tFom5L8cPoxxdFa1toHbU6Fq3NNC w4zvvW8Eqjb68URzlqUCay4JwdxFl+GDFK8THDxvZXZUiuLu2OZTvGrQ7GbMAgVN8Ong vrB+82EImmShltSkms3w4F3oJttXIexJnWUDaqnXAiKgg/YS3FIDLFv20TSU0imJZ08c nwacdiwjeCF14co+DEy6vL3Z+sFDD8LUAUHTwT25VeWOQoE0D9QlD+VsvX/YbTStDsWc SlV1rdTSGwLGMz/5kCwbNr+gXQy+7oj0sSO5HvZCCjmyw5Y+ftwJtQPiuXYdQpgoLBAD tIvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XnpwkKLL; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r28-v6si14786853pgk.458.2018.07.09.15.08.46; Mon, 09 Jul 2018 15:09:24 -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=@google.com header.s=20161025 header.b=XnpwkKLL; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932800AbeGIWGx (ORCPT + 99 others); Mon, 9 Jul 2018 18:06:53 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:39420 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932554AbeGIWGv (ORCPT ); Mon, 9 Jul 2018 18:06:51 -0400 Received: by mail-yw0-f196.google.com with SMTP id r184-v6so1741209ywg.6 for ; Mon, 09 Jul 2018 15:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WUiNf+V/V9XL2NJIlHWqSlv5mvsQHLyrvVGow+AZBXs=; b=XnpwkKLLzmFcCXl8YhrxWoiIIheXmEdGs7qNxLSQTzDQH7T/Lk+tG4+KIJW7ldB7uP 6e8F1rAoBABuH2es0GJ3h3bOEU8RegMfGYZubYX22lqOVx61qcjvMbIZLKl4v4tyRBAq XFcFHeO5NwwCvUxLewyLj0kSaevcDhi4M59Tlwl921A7gIGHD5rLPFSGgZiC8Zm0rBpZ iWsjkmw9N+Tkuk7MhgdCeO0O2iQmPHVrzO4CUzyE85m0wBknTBx8+L4xmd38hD8oVXHq aCSMlQGE0vapEgtKYqkxsw8WwWGap7Zx0v445E+LzN/chDXMmhL+7DAT/gwi0pAHbvSl 5keA== 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=WUiNf+V/V9XL2NJIlHWqSlv5mvsQHLyrvVGow+AZBXs=; b=QKwGvXdpmDXqQoaw2uLaciiiBRoBzpvBVsrGxEKLstDG6PnhdhYIEw7Nq60XGqg/Z4 j6htvUjF2hgquppD64r9TGlwyEHV6e5dd9K/l2jiPu6z5Va5U6pPA9ZG26CiyjhQeU5Y 5S3B8mFoxVBIrA4NbfgxykUwu/El4yfGcZD0x/bf8BNbW5QCBI5/bTpVwZoozH36DyI8 yX0CCpQq1Vk9fjMenaygJsSza29T4paXYl5FBLZATz0W3H4DbwEMwnWHjjLP0pdkcixR lLBSNWSzcFlSJouu8XXEeOHB64lBSLf5DRme/RdAdutPZNw81RdqFTSCglRe2c524bWS IlDw== X-Gm-Message-State: APt69E2gjYvJe7KbGsDzFBD8eLVE7jv0/N2EDNL+36LlweSdyjU7xOHM cGPssfewrWYAgMPNmAuVxutQyr4GlOYgogE3dVI+ X-Received: by 2002:a81:5556:: with SMTP id j83-v6mr9456586ywb.134.1531174010697; Mon, 09 Jul 2018 15:06:50 -0700 (PDT) MIME-Version: 1.0 References: <1530600642-25090-1-git-send-email-kernelfans@gmail.com> <2108146.dv4EAOf6IP@aspire.rjw.lan> <8816662.k3KXbdkA2e@aspire.rjw.lan> In-Reply-To: From: Bjorn Helgaas Date: Mon, 9 Jul 2018 17:06:39 -0500 Message-ID: Subject: Re: [PATCH] driver core: Drop devices_kset_move_last() call from really_probe() To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Greg Kroah-Hartman , kernelfans@gmail.com, Linux Kernel Mailing List , Grygorii Strashko , Christoph Hellwig , Bjorn Helgaas , dyoung@redhat.com, linux-pci@vger.kernel.org, Lukas Wunner , Linux PM list , Kishon Vijay Abraham I 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 [+cc Kishon] On Mon, Jul 9, 2018 at 4:35 PM Rafael J. Wysocki wrote: > > On Mon, Jul 9, 2018 at 3:57 PM, Bjorn Helgaas wrote: > > On Fri, Jul 6, 2018 at 5:01 AM Rafael J. Wysocki wrote: > >> > >> From: Rafael J. Wysocki > >> > >> The devices_kset_move_last() call in really_probe() is a mistake > >> as it may cause parents to follow children in the devices_kset list > >> which then causes system shutdown to fail. Namely, if a device has > >> children before really_probe() is called for it (which is not > >> uncommon), that call will cause it to be reordered after the children > >> in the devices_kset list and the ordering of that list will not > >> reflect the correct device shutdown order. > >> > >> Also it causes the devices_kset list to be constantly reordered > >> until all drivers have been probed which is totally pointless > >> overhead in the majority of cases. > >> > >> For that reason, revert the really_probe() modifications made by > >> commit 52cdbdd49853. > > > > I'm sure you've considered this, but I can't figure out whether this > > patch will reintroduce the problem that was solved by 52cdbdd49853. > > That patch updated two places: (1) really_probe(), the change you're > > reverting here, and (2) device_move(). > > > > device_move() is only called from 4-5 places, none of which look > > related to the problem fixed by 52cdbdd49853, so it seems like that > > problem was probably resolved by the hunk you're reverting. > > That's right, but I don't want to revert all of it. The other parts > of it are kind of useful as they make the handling of the devices_kset > list be consistent with the handling of dpm_list. > > The hunk I'm reverting, however, is completely off. It not only is > incorrect (as per the above), but it also causes the devices_kset list > and dpm_list to be handled differently. If I understand correctly, you are saying: - the 52cdbdd49853 really_probe() hunk fixed a problem, but - that hunk was the wrong fix for it, and - this patch removes the wrong fix (and probably reintroduces the problem) If devices_kset is supposed to be ordered so children follow parents, I agree the really_probe() hunk doesn't make much sense because the parent/child relation is determined by the circuit design, not by the probe order. It just seems like it's worth being clear that we're reintroducing the problem fixed by 52cdbdd49853, so it needs to be solved a different way. Ideally that would be done before this patch so there's not a regression, and this changelog could mention what's happening. > It had attempted to fix something, but it failed miserably at that. If you're saying that 52cdbdd49853 *tried* to fix a DRA7XX_evm reboot problem, but in fact, it did not fix that problem, then I guess there should be no issue with reverting that hunk. > >> Fixes: 52cdbdd49853 (driver core: correct device's shutdown order) > >> Link: https://lore.kernel.org/lkml/CAFgQCTt7VfqM=UyCnvNFxrSw8Z6cUtAi3HUwR4_xPAc03SgHjQ@mail.gmail.com/ > >> Reported-by: Pingfan Liu > >> Signed-off-by: Rafael J. Wysocki > >> --- > >> drivers/base/dd.c | 8 -------- > >> 1 file changed, 8 deletions(-) > >> > >> Index: linux-pm/drivers/base/dd.c > >> =================================================================== > >> --- linux-pm.orig/drivers/base/dd.c > >> +++ linux-pm/drivers/base/dd.c > >> @@ -434,14 +434,6 @@ re_probe: > >> goto probe_failed; > >> } > >> > >> - /* > >> - * Ensure devices are listed in devices_kset in correct order > >> - * It's important to move Dev to the end of devices_kset before > >> - * calling .probe, because it could be recursive and parent Dev > >> - * should always go first > >> - */ > >> - devices_kset_move_last(dev); > >> - > >> if (dev->bus->probe) { > >> ret = dev->bus->probe(dev); > >> if (ret) > >>