From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Widawsky Subject: Re: drm_clflush_pages performance Date: Mon, 17 Sep 2012 10:17:39 -0700 Message-ID: <20120917101739.7d7fa69e@bwidawsk.net> References: <051c15$4aplnv@AZSMGA002.ch.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from shiva.chad-versace.us (209-20-75-48.static.cloud-ips.com [209.20.75.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E9A29E8C6 for ; Mon, 17 Sep 2012 10:17:53 -0700 (PDT) In-Reply-To: <051c15$4aplnv@AZSMGA002.ch.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Chris Wilson Cc: intel-gfx List-Id: intel-gfx@lists.freedesktop.org On Sun, 16 Sep 2012 08:12:46 +0100 Chris Wilson wrote: > On Sat, 15 Sep 2012 18:06:03 -0400, Dave Airlie wrote: > > On Sat, Sep 15, 2012 at 10:41 AM, hank peng 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