Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Jack Winter <jbh@alchemy.lu>
Subject: Re: [PATCH 1/2] drm/i915: fold wait_for_atomic_us into wait_for_atomic
Date: Thu, 28 Mar 2013 12:32:33 +0200	[thread overview]
Message-ID: <20130328103233.GH4469@intel.com> (raw)
In-Reply-To: <1364425405-1200-1-git-send-email-daniel.vetter@ffwll.ch>

On Thu, Mar 28, 2013 at 12:03:24AM +0100, Daniel Vetter wrote:
> Since
> 
> commit bcf9dcc1e6269fac674e41f25d007ff75f76e840
> Author: Chris Wilson <chris@chris-wilson.co.uk>
> Date:   Sun Jul 15 09:42:38 2012 +0100
> 
>     drm/i915: Workaround hang with BSD and forcewake on SandyBridge
> 
> and
> 
> commit 0cc2764cc4a4bd73df55f8893c871778cf7ddd0f
> Author: Ben Widawsky <ben@bwidawsk.net>
> Date:   Sat Sep 1 22:59:48 2012 -0700
> 
>     drm/i915: use cpu_relax() in wait_for_atomic
> 
> these two macros are essentially the same, so unify them. We keep the
> _us version since it's a nice documentation for smaller timeouts.
> 
> Cc: Jack Winter <jbh@alchemy.lu>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/intel_drv.h | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 54bc2ea..c8c1979 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -50,21 +50,10 @@
>  	ret__;								\
>  })
>  
> -#define wait_for_atomic_us(COND, US) ({ \
> -	unsigned long timeout__ = jiffies + usecs_to_jiffies(US);	\
> -	int ret__ = 0;							\
> -	while (!(COND)) {						\
> -		if (time_after(jiffies, timeout__)) {			\
> -			ret__ = -ETIMEDOUT;				\
> -			break;						\
> -		}							\
> -		cpu_relax();						\
> -	}								\
> -	ret__;								\
> -})
> -
>  #define wait_for(COND, MS) _wait_for(COND, MS, 1)
>  #define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0)
> +#define wait_for_atomic_us(COND, US) _wait_for((COND), \
> +					       usecs_to_jiffies((US)), 0)

usecs_to_jiffies() is wrong here. DIV_ROUND_UP((US), 1000) maybe,
or change _wait_for() to take the timeout in jiffies.

>  
>  #define KHz(x) (1000*x)
>  #define MHz(x) KHz(1000*x)
> -- 
> 1.7.11.7
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

  parent reply	other threads:[~2013-03-28 10:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-27 23:03 [PATCH 1/2] drm/i915: fold wait_for_atomic_us into wait_for_atomic Daniel Vetter
2013-03-27 23:03 ` [PATCH 2/2] drm/i915: fix up _wait_for macro Daniel Vetter
2013-03-28 11:00   ` Ville Syrjälä
2013-03-28 15:41     ` Daniel Vetter
2013-03-28 10:32 ` Ville Syrjälä [this message]
2013-03-28 10:31   ` [PATCH] drm/i915: fold wait_for_atomic_us into wait_for_atomic Daniel Vetter
2013-03-28 10:53     ` Ville Syrjälä

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=20130328103233.GH4469@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jbh@alchemy.lu \
    /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