All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Doug Anderson <dianders@chromium.org>
Cc: Stephen Boyd <swboyd@chromium.org>,
	Alexandru Ardelean <alexandru.ardelean@analog.com>,
	Daniel Campello <campello@chromium.org>,
	Enrico Granata <egranata@chromium.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio <linux-iio@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Dmitry Torokhov <dtor@chromium.org>
Subject: Re: [PATCH] iio: sx9310: Prefer async probe
Date: Sat, 29 Aug 2020 18:17:54 +0100	[thread overview]
Message-ID: <20200829181754.52d3cc3b@archlinux> (raw)
In-Reply-To: <CAD=FV=W3=kRFH0TzEAX0DWS7jb113LuWUJqVS686EyRzexvoRA@mail.gmail.com>

On Sat, 29 Aug 2020 09:56:41 -0700
Doug Anderson <dianders@chromium.org> wrote:

> Hi,
> 
> On Sat, Aug 29, 2020 at 8:12 AM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > On Fri, 28 Aug 2020 17:01:18 -0700
> > Douglas Anderson <dianders@chromium.org> wrote:
> >  
> > > On one board I found that:
> > >   probe of 5-0028 returned 1 after 259547 usecs
> > >
> > > There's no reason to block probe of all other devices on our probe.
> > > Turn on async probe.
> > >
> > > Signed-off-by: Douglas Anderson <dianders@chromium.org>
> > > ---
> > > NOTE: I haven't done any analysis of the driver to see _why_ it's so
> > > slow, only that I have measured it to be slow.  Someone could
> > > certainly take the time to profile / optimize it, but in any case it
> > > still won't hurt to be async.  
> >
> > Hmm. It is vanishingly rare to use that flag  
> 
> My guess is that people just haven't been spending as much time
> optimizing boot performance recently.  I've been trying to do this and
> finding that there are quite a few drivers that could benefit from
> this flag.
> 
> In theory this flag should probably be on by default and it looks like
> that was Dmitry's original intention but the state of the world 5
> years ago was that it wasn't quite ready for this.  I think, in
> particular, drivers that are more core to the system (IOMMUs, clocks,
> regulators, etc) may not have been ready, but misc peripherals should
> be no problem.

That fits with my understanding.  Would be great to have it on
by default though I guess it could make for some really hard to debug
race conditions.


> 
> 
> > so I'm not particularly
> > keen on starting to deploy it when we don't know why a particular
> > driver is taking so long.  I agree it should be safe but I don't
> > like oddities I don't understand!
> >
> > There are some sleeps in there but they are all of the order of a few
> > msecs.
> >
> > Could it be there is a regulator that is coming up very slowly?
> >
> > Any other ideas?  
> 
> I can do a little bit of profiling next week, but even if we get this
> down from 250 ms to 10 ms I'd still like to see async probe turned on.
> There's no reason for it to be off and every little bit counts.
Agreed. However, I'd like a comment next to the place we turn it on
saying what delays we are trying to mitigate by enabling it in this
driver.

Jonathan

> 
> 
> > Jonathan
> >  
> > >
> > > This is a very safe flag to turn on since:
> > >
> > > 1. It's not like our probe order was defined by anything anyway.  When
> > > we probe is at the whim of when our i2c controller probes and that can
> > > be any time.
> > >
> > > 2. If some other driver needs us then they have to handle the fact
> > > that we might not have probed yet anyway.
> > >
> > > 3. There may be other drivers probing at the same time as us anyway
> > > because _they_ used async probe.
> > >
> > > While I won't say that it's impossible to tickle a bug by turning on
> > > async probe, I would assert that in almost all cases the bug was
> > > already there and needed to be fixed anyway.
> > >
> > > ALSO NOTE: measurement / testing was done on the downstream Chrome OS
> > > 5.4 tree.  I confirmed compiling on mainline.
> > >
> > >  drivers/iio/proximity/sx9310.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/iio/proximity/sx9310.c b/drivers/iio/proximity/sx9310.c
> > > index dc2e11b43431..444cafc53408 100644
> > > --- a/drivers/iio/proximity/sx9310.c
> > > +++ b/drivers/iio/proximity/sx9310.c
> > > @@ -1054,6 +1054,7 @@ static struct i2c_driver sx9310_driver = {
> > >               .acpi_match_table = ACPI_PTR(sx9310_acpi_match),
> > >               .of_match_table = of_match_ptr(sx9310_of_match),
> > >               .pm = &sx9310_pm_ops,
> > > +             .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> > >       },
> > >       .probe          = sx9310_probe,
> > >       .id_table       = sx9310_id,  
> >  


  reply	other threads:[~2020-08-29 17:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-29  0:01 [PATCH] iio: sx9310: Prefer async probe Douglas Anderson
2020-08-29 15:12 ` Jonathan Cameron
2020-08-29 16:56   ` Doug Anderson
2020-08-29 17:17     ` Jonathan Cameron [this message]
2020-08-31 18:59       ` Doug Anderson
2020-09-01  7:03         ` Stephen Boyd
2020-09-01 13:45           ` Jonathan Cameron
2020-09-01 15:23             ` Doug Anderson

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=20200829181754.52d3cc3b@archlinux \
    --to=jic23@kernel.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=campello@chromium.org \
    --cc=dianders@chromium.org \
    --cc=dtor@chromium.org \
    --cc=egranata@chromium.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=swboyd@chromium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.