From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00CBAC43144 for ; Tue, 26 Jun 2018 11:54:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B74D026A02 for ; Tue, 26 Jun 2018 11:54:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B74D026A02 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934809AbeFZLyK (ORCPT ); Tue, 26 Jun 2018 07:54:10 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49130 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934063AbeFZLyI (ORCPT ); Tue, 26 Jun 2018 07:54:08 -0400 Received: from localhost (li1825-44.members.linode.com [172.104.248.44]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 00A75C9E; Tue, 26 Jun 2018 11:54:06 +0000 (UTC) Date: Tue, 26 Jun 2018 19:54:02 +0800 From: Greg Kroah-Hartman To: Pingfan Liu Cc: linux-kernel@vger.kernel.org, Grygorii Strashko , Christoph Hellwig , Bjorn Helgaas , Dave Young , linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCHv2 2/2] drivers/base: reorder consumer and its children behind suppliers Message-ID: <20180626115402.GB30256@kroah.com> References: <1529912859-10475-1-git-send-email-kernelfans@gmail.com> <1529912859-10475-3-git-send-email-kernelfans@gmail.com> <20180625104505.GA3058@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 26, 2018 at 11:29:48AM +0800, Pingfan Liu wrote: > On Mon, Jun 25, 2018 at 6:45 PM Greg Kroah-Hartman > wrote: > > > > On Mon, Jun 25, 2018 at 03:47:39PM +0800, Pingfan Liu wrote: > > > commit 52cdbdd49853 ("driver core: correct device's shutdown order") > > > introduces supplier<-consumer order in devices_kset. The commit tries > > > to cleverly maintain both parent<-child and supplier<-consumer order by > > > reordering a device when probing. This method makes things simple and > > > clean, but unfortunately, breaks parent<-child order in some case, > > > which is described in next patch in this series. > > > > There is no "next patch in this series" :( > > > Oh, re-arrange the patches, and forget the comment in log > > > > Here this patch tries to resolve supplier<-consumer by only reordering a > > > device when it has suppliers, and takes care of the following scenario: > > > [consumer, children] [ ... potential ... ] supplier > > > ^ ^ > > > After moving the consumer and its children after the supplier, the > > > potentail section may contain consumers whose supplier is inside > > > children, and this poses the requirement to dry out all consumpers in > > > the section recursively. > > > > > > Cc: Greg Kroah-Hartman > > > 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 > > > --- > > > note: there is lock issue in this patch, should be fixed in next version > > > > Please send patches that you know are correct, why would I want to > > review this if you know it is not correct? > > > > And if the original commit is causing problems for you, why not just > > revert that instead of adding this much-increased complexity? > > > Revert the original commit, then it will expose the error order > "consumer <- supplier" again. > This patch tries to resolve the error and fix the following scenario: > step0: before the consumer device's probing, (note child_a is a > supplier of consumer_a, etc) > [ consumer-X, child_a, ...., child_z] [.... consumer_a, ..., > consumer_z, ....] supplier-X > ^^^ > affected range during moving^^^ > step1: When probing, moving consumer-X after supplier-X > [ child_a, ...., child_z] [.... consumer_a, ..., consumer_z, > ....] supplier-X, consumer-X > But it breaks "parent <-child" seq now, and should be fixed like: > step2: > [.... consumer_a, ..., consumer_z, ....] supplier-X [ > consumer-X, child_a, ...., child_z] <--- > descendants_reorder_after_pos() does it. > Again, the seq "consumer_a <- child_a" breaks the "supplier<-consumer" > order, should be fixed like: > step3: > [.... consumer_z, .....] supplier-X [ consumer-X, child_a, > consumer_a ...., child_z] <--- __device_reorder_consumer() does it. > ^^ affected range^^ > The moving of consumer_a brings us to face the same scenario of step1, > hence we need an external recursion. Something really got messed up here, and this all does not make any sense :( Can you try again? Also, please cc: Rafael on all of this, as he wrote all of this consumer/supplier logic and I am not that familiar with it at all. thanks, greg k-h