All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>,
	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 18:24:28 -0800	[thread overview]
Message-ID: <1200623068.5724.111.camel@brick> (raw)
In-Reply-To: <479008E5.1070706@zytor.com>

On Thu, 2008-01-17 at 21:03 -0500, H. Peter Anvin wrote:
> 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.

I think Andi's CPA patches have some changes regarding wbinvd and
clflush handling, perhaps you can leverage some of his work?

Harvey


  reply	other threads:[~2008-01-18  2:24 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
2008-01-18  2:24   ` Harvey Harrison [this message]
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=1200623068.5724.111.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --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 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.