From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Nicholas Mc Guire <der.herr@hofr.at>
Cc: Jani Nikula <jani.nikula@linux.intel.com>,
intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org,
Nicholas Mc Guire <hofrat@osadl.org>,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH] drm/i915: use udelay for very short delays
Date: Thu, 15 Dec 2016 13:51:43 +0200 [thread overview]
Message-ID: <20161215115143.GY31595@intel.com> (raw)
In-Reply-To: <20161215103400.GA26125@osadl.at>
On Thu, Dec 15, 2016 at 10:34:00AM +0000, Nicholas Mc Guire wrote:
> On Thu, Dec 15, 2016 at 12:20:01PM +0200, Jani Nikula wrote:
> > On Thu, 15 Dec 2016, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > > On Thu, Dec 15, 2016 at 11:52:34AM +0200, Jani Nikula wrote:
> > >> On Thu, 15 Dec 2016, Nicholas Mc Guire <der.herr@hofr.at> wrote:
> > >> > On Thu, Dec 15, 2016 at 11:08:49AM +0200, Jani Nikula wrote:
> > >> >> On Thu, 15 Dec 2016, Nicholas Mc Guire <hofrat@osadl.org> wrote:
> > >> >> > Even on fast systems a 2 microsecond delay is most likely more efficient
> > >> >> > as a busy-wait loop. The overhead of a hrtimer does not seem warranted -
> > >> >> > change this to a udelay(2).
> > >> >>
> > >> >> Similar concerns as in [1]. We don't need the accuracy of udelay() here,
> > >> >> so this boils down to which is the better use of CPU. We could probably
> > >> >> relax the max delay more if that was helpful. But I'm not immediately
> > >> >> sold on "is most likely more efficient" which sounds like a gut feeling.
> > >> >>
> > >> >> I'm sorry it's not clear in my other reply that I do appreciate
> > >> >> addressing incorrect/silly use of usleep_range(); I'm just not (yet)
> > >> >> convinced udelay() is the answer.
> > >> >
> > >> > if the delay is not critical and all that is needed
> > >> > is an assurance that it is greater than X us then
> > >> > usleep_range is fine with a relaxed limit.
> > >> > So from what you wrote my patch proposal is wrong - the
> > >> > udelay() is not the way to got.
> > >> > My intent is to get rid of very small usleep_range() cases
> > >> > so if usleep_range(20,50) causes no issues with this driver
> > >> > and does not induce any performance penalty then that would
> > >> > be the way to go I think.
> > >>
> > >> Okay, so I looked at the code, and I looked at our spec, and I looked at
> > >> the MIPI D-PHY spec, and I cried a little.
> > >>
> > >> Long story short, I think usleep_range(10, 50) will be fine.
> > >
> > > Note that I really want to see a comment next to every delay like this
> > > documenting the actual hardware requirement, if the delay used by the
> > > code doesn't 100% match it.
> >
> > Our spec says, "Wait for 2us for ULPS to complete". That's a simplistic
> > view wrt D-PHY, and our code doesn't even match the spec. Hence the
> > tears. Want to propose a wording for the comment so we can apply this
> > change, without going for a full rewrite of the sequence?
> >
> is that suitable or am I overdoing it ?
>
> - usleep_range(2, 3);
> + /* delay for at least 2us - relaxed to 10-50 to allow
> + * hrtimer subsystem to optimize uncritical timer handling
> + */
That's entirely too verbose IMO, and the reason for using usleep_range()
is pretty obvious without spelling it out.
All we really want to know is what the spec says is the minimum
acceptable delay.
> + usleep_range(10, 50);
>
> thx!
> hofrat
--
Ville Syrjälä
Intel OTC
prev parent reply other threads:[~2016-12-15 11:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-15 4:29 [PATCH] drm/i915: use udelay for very short delays Nicholas Mc Guire
2016-12-15 9:08 ` Jani Nikula
2016-12-15 9:25 ` [Intel-gfx] " Daniel Vetter
2016-12-15 9:27 ` Daniel Vetter
2016-12-15 10:51 ` Nicholas Mc Guire
2016-12-15 11:39 ` Daniel Vetter
2016-12-15 9:28 ` Nicholas Mc Guire
2016-12-15 9:52 ` Jani Nikula
2016-12-15 10:10 ` Ville Syrjälä
2016-12-15 10:20 ` Jani Nikula
2016-12-15 10:34 ` Nicholas Mc Guire
2016-12-15 11:48 ` Jani Nikula
2016-12-15 11:51 ` Ville Syrjälä [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=20161215115143.GY31595@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniel.vetter@intel.com \
--cc=der.herr@hofr.at \
--cc=dri-devel@lists.freedesktop.org \
--cc=hofrat@osadl.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox