public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Kyle McMartin <kyle@mcmartin.ca>
Cc: akpm@linux-foundation.org, airlied@linux.ie,
	linux-kernel@vger.kernel.org
Subject: Re: [mm patch] i915: fix invalid opcode exception on cpus without clflush
Date: Thu, 17 Jan 2008 21:03:17 -0500	[thread overview]
Message-ID: <479008E5.1070706@zytor.com> (raw)
In-Reply-To: <20080117235203.GB21681@phobos.i.cabal.ca>

Kyle McMartin wrote:
> i915_flush_ttm was unconditionally executing a clflush instruction
> to (obviously) flush the cache. Instead, check if the cpu supports
> clflush, and if not, fall back to calling wbinvd to flush the entire
> cache.
> 
> Signed-off-by: Kyle McMartin <kmcmartin@redhat.com>
> 
> --- a/drivers/char/drm/i915_buffer.c
> +++ b/drivers/char/drm/i915_buffer.c
> @@ -286,7 +286,18 @@ void i915_flush_ttm(struct drm_ttm *ttm)
>  		return;
>  
>  	DRM_MEMORYBARRIER();
> +
> +#ifdef CONFIG_X86_32
> +	/* Hopefully nobody has built an x86-64 processor without clflush */
> +	if (!cpu_has_clflush) {
> +		wbinvd();
> +		DRM_MEMORYBARRIER();
> +		return;
> +	}
> +#endif
> +
>  	for (i = ttm->num_pages - 1; i >= 0; i--)
>  		drm_cache_flush_page(drm_ttm_get_page(ttm, i));
> +
>  	DRM_MEMORYBARRIER();
>  }

The #ifdef is bogus.  If it's required, it should go into 
asm-x86/required_features.h and then cpu_has_clflush is static; 
otherwise it's just plain wrong.

	-hpa


  reply	other threads:[~2008-01-18  2:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-17 23:52 [mm patch] i915: fix invalid opcode exception on cpus without clflush Kyle McMartin
2008-01-18  2:03 ` H. Peter Anvin [this message]
2008-01-18  2:24   ` Harvey Harrison
2008-01-18  2:31   ` Kyle McMartin

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=479008E5.1070706@zytor.com \
    --to=hpa@zytor.com \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=kyle@mcmartin.ca \
    --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