* drm_clflush_pages performance
@ 2012-09-15 14:41 hank peng
2012-09-15 22:06 ` Dave Airlie
0 siblings, 1 reply; 4+ messages in thread
From: hank peng @ 2012-09-15 14:41 UTC (permalink / raw)
To: intel-gfx
I noticed that drm_clflush_pages function will first choose clfush
instead of wbinvd, its code like this:
void
drm_clflush_pages(struct page *pages[], unsigned long num_pages)
{
#if defined(CONFIG_X86)
if (cpu_has_clflush) {
drm_cache_flush_clflush(pages, num_pages);
return;
}
if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0)
printk(KERN_ERR "Timed out waiting for cache flush.\n");
I think using clfush will be slower than using wbinvd, so I wonder if
I use wbinvd first, what else impact will it bring?
--
The simplest is not all best but the best is surely the simplest!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: drm_clflush_pages performance
2012-09-15 14:41 drm_clflush_pages performance hank peng
@ 2012-09-15 22:06 ` Dave Airlie
2012-09-16 7:12 ` Chris Wilson
0 siblings, 1 reply; 4+ messages in thread
From: Dave Airlie @ 2012-09-15 22:06 UTC (permalink / raw)
To: hank peng; +Cc: intel-gfx
On Sat, Sep 15, 2012 at 10:41 AM, hank peng <pengxihan@gmail.com> wrote:
> I noticed that drm_clflush_pages function will first choose clfush
> instead of wbinvd, its code like this:
>
> void
> drm_clflush_pages(struct page *pages[], unsigned long num_pages)
> {
>
> #if defined(CONFIG_X86)
> if (cpu_has_clflush) {
> drm_cache_flush_clflush(pages, num_pages);
> return;
> }
>
> if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0)
> printk(KERN_ERR "Timed out waiting for cache flush.\n");
>
>
> I think using clfush will be slower than using wbinvd, so I wonder if
> I use wbinvd first, what else impact will it bring?
clflush is faster than wbinvd for a lot use cases,
There may be a threshold point where it makes sense to wbinvd, but it
will affect all processes using the cache not just ones using the
specific pages.
Dave.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: drm_clflush_pages performance
2012-09-15 22:06 ` Dave Airlie
@ 2012-09-16 7:12 ` Chris Wilson
2012-09-17 17:17 ` Ben Widawsky
0 siblings, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2012-09-16 7:12 UTC (permalink / raw)
To: Dave Airlie, hank peng; +Cc: intel-gfx
On Sat, 15 Sep 2012 18:06:03 -0400, Dave Airlie <airlied@gmail.com> wrote:
> On Sat, Sep 15, 2012 at 10:41 AM, hank peng <pengxihan@gmail.com> wrote:
> > I noticed that drm_clflush_pages function will first choose clfush
> > instead of wbinvd, its code like this:
> >
> > void
> > drm_clflush_pages(struct page *pages[], unsigned long num_pages)
> > {
> >
> > #if defined(CONFIG_X86)
> > if (cpu_has_clflush) {
> > drm_cache_flush_clflush(pages, num_pages);
> > return;
> > }
> >
> > if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0)
> > printk(KERN_ERR "Timed out waiting for cache flush.\n");
> >
> >
> > I think using clfush will be slower than using wbinvd, so I wonder if
> > I use wbinvd first, what else impact will it bring?
>
> clflush is faster than wbinvd for a lot use cases,
>
> There may be a threshold point where it makes sense to wbinvd, but it
> will affect all processes using the cache not just ones using the
> specific pages.
The other factor is that on recent machines the cost of
smp_function_call() outweighs the cost of flushing the cache to memory.
I made the unfortunate mistake of accidentally enabling the wbinvd path
recently...
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: drm_clflush_pages performance
2012-09-16 7:12 ` Chris Wilson
@ 2012-09-17 17:17 ` Ben Widawsky
0 siblings, 0 replies; 4+ messages in thread
From: Ben Widawsky @ 2012-09-17 17:17 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
On Sun, 16 Sep 2012 08:12:46 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Sat, 15 Sep 2012 18:06:03 -0400, Dave Airlie <airlied@gmail.com> wrote:
> > On Sat, Sep 15, 2012 at 10:41 AM, hank peng <pengxihan@gmail.com> wrote:
> > > I noticed that drm_clflush_pages function will first choose clfush
> > > instead of wbinvd, its code like this:
> > >
> > > void
> > > drm_clflush_pages(struct page *pages[], unsigned long num_pages)
> > > {
> > >
> > > #if defined(CONFIG_X86)
> > > if (cpu_has_clflush) {
> > > drm_cache_flush_clflush(pages, num_pages);
> > > return;
> > > }
> > >
> > > if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0)
> > > printk(KERN_ERR "Timed out waiting for cache flush.\n");
> > >
> > >
> > > I think using clfush will be slower than using wbinvd, so I wonder if
> > > I use wbinvd first, what else impact will it bring?
> >
> > clflush is faster than wbinvd for a lot use cases,
> >
> > There may be a threshold point where it makes sense to wbinvd, but it
> > will affect all processes using the cache not just ones using the
> > specific pages.
>
> The other factor is that on recent machines the cost of
> smp_function_call() outweighs the cost of flushing the cache to memory.
> I made the unfortunate mistake of accidentally enabling the wbinvd path
> recently...
> -Chris
>
Maybe it makes some sense based on the object size. For example, if we
had a 1GB bo, it might make more sense to wbinvd.
--
Ben Widawsky, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-17 17:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-15 14:41 drm_clflush_pages performance hank peng
2012-09-15 22:06 ` Dave Airlie
2012-09-16 7:12 ` Chris Wilson
2012-09-17 17:17 ` Ben Widawsky
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.