x86: Use clflushopt in drm_clflush_page
authorRoss Zwisler <ross.zwisler@linux.intel.com>
Wed, 26 Feb 2014 19:06:51 +0000 (12:06 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Thu, 27 Feb 2014 16:26:20 +0000 (08:26 -0800)
If clflushopt is available on the system, use it instead of clflush in
drm_clflush_page.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Link: http://lkml.kernel.org/r/1393441612-19729-4-git-send-email-ross.zwisler@linux.intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
drivers/gpu/drm/drm_cache.c

index bb8f58012189af7651c20c2d9b1da1ed390ebcfd..c518fb6cfb63b1551d8d6d07eb58dec8fce20d04 100644 (file)
 #include <drm/drmP.h>
 
 #if defined(CONFIG_X86)
+
+/*
+ * clflushopt is an unordered instruction which needs fencing with mfence or
+ * sfence to avoid ordering issues.  For drm_clflush_page this fencing happens
+ * in the caller.
+ */
 static void
 drm_clflush_page(struct page *page)
 {
@@ -44,7 +50,7 @@ drm_clflush_page(struct page *page)
 
        page_virtual = kmap_atomic(page);
        for (i = 0; i < PAGE_SIZE; i += size)
-               clflush(page_virtual + i);
+               clflushopt(page_virtual + i);
        kunmap_atomic(page_virtual);
 }