From: Pingfan Liu <kernelfans@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
Grygorii Strashko <grygorii.strashko@ti.com>,
Christoph Hellwig <hch@infradead.org>,
Bjorn Helgaas <helgaas@kernel.org>,
Dave Young <dyoung@redhat.com>,
linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
rafael.j.wysocki@intel.com
Subject: Re: [PATCHv2 2/2] drivers/base: reorder consumer and its children behind suppliers
Date: Tue, 3 Jul 2018 14:48:00 +0800 [thread overview]
Message-ID: <CAFgQCTuztrZbFJF3_NgZrq2r0ngSmcnkXMB=CgvMNgzQkwe+4w@mail.gmail.com> (raw)
In-Reply-To: <20180626115402.GB30256@kroah.com>
On Tue, Jun 26, 2018 at 7:54 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> 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
> > <gregkh@linuxfoundation.org> 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 <gregkh@linuxfoundation.org>
> > > > Cc: Grygorii Strashko <grygorii.strashko@ti.com>
> > > > Cc: Christoph Hellwig <hch@infradead.org>
> > > > Cc: Bjorn Helgaas <helgaas@kernel.org>
> > > > Cc: Dave Young <dyoung@redhat.com>
> > > > Cc: linux-pci@vger.kernel.org
> > > > Cc: linuxppc-dev@lists.ozlabs.org
> > > > Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
> > > > ---
> > > > 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.
>
Cc Rafael J. Wysocki for the context. I will send out V3 soon.
Regards,
Pingfan
prev parent reply other threads:[~2018-07-03 6:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 7:47 [PATCHv2 0/2] drivers/base: bugfix for supplier<-consumer ordering in device_kset Pingfan Liu
2018-06-25 7:47 ` [PATCHv2 1/2] drivers/base: only reordering consumer device when probing Pingfan Liu
2018-06-25 7:47 ` [PATCHv2 2/2] drivers/base: reorder consumer and its children behind suppliers Pingfan Liu
2018-06-25 10:45 ` Greg Kroah-Hartman
2018-06-26 3:29 ` Pingfan Liu
2018-06-26 11:54 ` Greg Kroah-Hartman
2018-07-03 6:48 ` Pingfan Liu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFgQCTuztrZbFJF3_NgZrq2r0ngSmcnkXMB=CgvMNgzQkwe+4w@mail.gmail.com' \
--to=kernelfans@gmail.com \
--cc=dyoung@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=grygorii.strashko@ti.com \
--cc=hch@infradead.org \
--cc=helgaas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=rafael.j.wysocki@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).