All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Thomas Gleixner <tglx@linutronix.de>,
	John Stultz <john.stultz@linaro.org>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 2/2] drm/i915: Handle inaccurate time conversion	issues
Date: Mon, 08 Dec 2014 14:34:24 +0200	[thread overview]
Message-ID: <87oaremib3.fsf@intel.com> (raw)
In-Reply-To: <1417166995-10803-2-git-send-email-daniel.vetter@ffwll.ch>

On Fri, 28 Nov 2014, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> So apparently jiffies<->nsec<->ktime isn't accurate or something. At
> elast if we timeout there's occasionally still a few hundred us left
> (in a 2 second timeout).
>
> Stuff I've tried and thrown out again:
> - Sampling the before timestamp before jiffies. Doesn't improve test
>   path rate at all.
> - Using jiffies. Way to inaccurate, which means way too much drift
>   with signals plus automatic ioctl restarting in userspace. In
>   hindsight we should have used an absolute timeout, but hey we need
>   something for v3 of the i915 gem wait interfaces ;-)
> - Trying to figure out where accuracy gets lost. gl testcase really
>   don't care all that much about this (as long as isn't not massively
>   off), it's just that the testcase gets a bit upset if it receives an
>   EITME with timeout > 0.
>
> So as long as we're in the ballbark it's good enough. So patch
> everything up if we're at most one jiffies off. I get's me a solid
> test again.
>
> This regression is probably introduced in
>
> commit 5ed0bdf21a85d78e04f89f15ccf227562177cbd9
> Author: Thomas Gleixner <tglx@linutronix.de>
> Date:   Wed Jul 16 21:05:06 2014 +0000
>
>     drm: i915: Use nsec based interfaces
>
>     Use ktime_get_raw_ns() and get rid of the back and forth timespec
>     conversions.
>
>     Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
>     Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>     Signed-off-by: John Stultz <john.stultz@linaro.org>
>
> Probably because I'm too lazy to confirm myself and still waiting for
> QA ;-)
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: John Stultz <john.stultz@linaro.org>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82749
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Pushed to drm-intel-next-fixes, thanks for the patch.

BR,
Jani.

> ---
>  drivers/gpu/drm/i915/i915_gem.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 002730d1409b..abdc5bcdbd0d 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1302,6 +1302,16 @@ int __i915_wait_seqno(struct intel_engine_cs *ring, u32 seqno,
>  		s64 tres = *timeout - (now - before);
>  
>  		*timeout = tres < 0 ? 0 : tres;
> +
> +		/*
> +		 * Apparently ktime isn't accurate enough and occasionally has a
> +		 * bit of mismatch in the jiffies<->nsecs<->ktime loop. So patch
> +		 * things up to make the test happy. We allow up to 1 jiffy.
> +		 *
> +		 * This is a regrssion from the timespec->ktime conversion.
> +		 */
> +		if (ret == -ETIME && *timeout < jiffies_to_usecs(1)*1000)
> +			*timeout = 0;
>  	}
>  
>  	return ret;
> -- 
> 1.9.3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2014-12-08 12:35 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28  9:29 [PATCH 1/2] drm/i915: compute wait_ioctl timeout correctly Daniel Vetter
2014-11-28  9:29 ` [PATCH 2/2] drm/i915: Handle inaccurate time conversion issues Daniel Vetter
2014-11-28 11:08   ` Chris Wilson
2014-11-28 13:30     ` Daniel Vetter
2014-11-28 12:13   ` Chris Wilson
2014-11-28 19:09   ` [PATCH 2/2] drm/i915: Handle inaccurate time conversion shuang.he
2014-12-08 12:34   ` Jani Nikula [this message]
2014-11-28 10:09 ` [PATCH 1/2] drm/i915: compute wait_ioctl timeout correctly Chris Wilson
2014-11-28 13:46 ` Dave Gordon
2014-12-02 14:56   ` Daniel Vetter
2014-12-02 15:22 ` [PATCH] " Daniel Vetter
2014-12-02 15:22   ` Daniel Vetter
2014-12-02 15:36   ` Daniel Vetter
2014-12-02 15:36     ` Daniel Vetter
2014-12-02 16:35     ` Chris Wilson
2014-12-02 16:35       ` [Intel-gfx] " Chris Wilson
2014-12-02 16:54       ` John Stultz
2014-12-03  9:22         ` Daniel Vetter
2014-12-03  9:22           ` [Intel-gfx] " Daniel Vetter
2014-12-03 10:28           ` Imre Deak
2014-12-03 10:28             ` [Intel-gfx] " Imre Deak
2014-12-03 14:30         ` Daniel Vetter
2014-12-03 14:30           ` [Intel-gfx] " Daniel Vetter
2014-12-03 19:07           ` John Stultz
2014-12-03 19:07             ` [Intel-gfx] " John Stultz
2014-12-04 10:42             ` Daniel Vetter
2014-12-04 10:42               ` [Intel-gfx] " Daniel Vetter
2014-12-04 17:42               ` John Stultz
2014-12-04 17:42                 ` [Intel-gfx] " John Stultz
2014-12-04 17:50                 ` Daniel Vetter
2014-12-04 17:50                   ` [Intel-gfx] " Daniel Vetter
2014-12-04 18:16                   ` John Stultz
2014-12-04 18:16                     ` [Intel-gfx] " John Stultz
2014-12-04 18:51                     ` Daniel Vetter
2014-12-04 18:51                       ` [Intel-gfx] " Daniel Vetter
2014-12-04 20:35                       ` John Stultz
2014-12-04 20:35                         ` [Intel-gfx] " John Stultz
2014-12-05  9:16                         ` Daniel Vetter
2014-12-05  9:16                           ` [Intel-gfx] " Daniel Vetter
2014-12-03  5:21     ` shuang.he
2014-12-03  5:51   ` shuang.he
2014-12-04 10:12 ` Daniel Vetter
2014-12-04 10:12   ` Daniel Vetter
2014-12-04 17:03   ` shuang.he
2014-12-04 17:45   ` John Stultz
2014-12-04 17:45     ` John Stultz
2014-12-08 12:34   ` Jani Nikula
2014-12-08 12:34     ` [Intel-gfx] " Jani Nikula

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=87oaremib3.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=john.stultz@linaro.org \
    --cc=tglx@linutronix.de \
    /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.