lkml.org 
[lkml]   [2008]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [mm patch] i915: fix invalid opcode exception on cpus without clflush
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



\
 
 \ /
  Last update: 2008-01-18 03:17    [W:0.031 / U:0.928 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site