Commit 8448661d authored by Chris Wilson's avatar Chris Wilson

drm/i915: Convert clflushed pagetables over to WC maps

We flush the entire page every time we update a few bytes, making the
update of a page table many, many times slower than is required. If we
create a WC map of the page for our updates, we can avoid the clflush
but incur additional cost for creating the pagetable. We amoritize that
cost by reusing page vmappings, and only changing the page protection in
batches.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
parent cbc4e9e6
...@@ -2481,8 +2481,6 @@ struct drm_i915_private { ...@@ -2481,8 +2481,6 @@ struct drm_i915_private {
/* Used to save the pipe-to-encoder mapping for audio */ /* Used to save the pipe-to-encoder mapping for audio */
struct intel_encoder *av_enc_map[I915_MAX_PIPES]; struct intel_encoder *av_enc_map[I915_MAX_PIPES];
I915_SELFTEST_DECLARE(struct fault_attr vm_fault);
/* /*
* NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
* will be rejected. Instead look for a better place. * will be rejected. Instead look for a better place.
......
This diff is collapsed.
...@@ -36,9 +36,11 @@ ...@@ -36,9 +36,11 @@
#include <linux/io-mapping.h> #include <linux/io-mapping.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/pagevec.h>
#include "i915_gem_timeline.h" #include "i915_gem_timeline.h"
#include "i915_gem_request.h" #include "i915_gem_request.h"
#include "i915_selftest.h"
#define I915_GTT_PAGE_SIZE 4096UL #define I915_GTT_PAGE_SIZE 4096UL
#define I915_GTT_MIN_ALIGNMENT I915_GTT_PAGE_SIZE #define I915_GTT_MIN_ALIGNMENT I915_GTT_PAGE_SIZE
...@@ -247,6 +249,7 @@ struct i915_address_space { ...@@ -247,6 +249,7 @@ struct i915_address_space {
struct drm_mm mm; struct drm_mm mm;
struct i915_gem_timeline timeline; struct i915_gem_timeline timeline;
struct drm_i915_private *i915; struct drm_i915_private *i915;
struct device *dma;
/* Every address space belongs to a struct file - except for the global /* Every address space belongs to a struct file - except for the global
* GTT that is owned by the driver (and so @file is set to NULL). In * GTT that is owned by the driver (and so @file is set to NULL). In
* principle, no information should leak from one context to another * principle, no information should leak from one context to another
...@@ -297,6 +300,9 @@ struct i915_address_space { ...@@ -297,6 +300,9 @@ struct i915_address_space {
*/ */
struct list_head unbound_list; struct list_head unbound_list;
struct pagevec free_pages;
bool pt_kmap_wc;
/* FIXME: Need a more generic return type */ /* FIXME: Need a more generic return type */
gen6_pte_t (*pte_encode)(dma_addr_t addr, gen6_pte_t (*pte_encode)(dma_addr_t addr,
enum i915_cache_level level, enum i915_cache_level level,
...@@ -326,6 +332,8 @@ struct i915_address_space { ...@@ -326,6 +332,8 @@ struct i915_address_space {
int (*bind_vma)(struct i915_vma *vma, int (*bind_vma)(struct i915_vma *vma,
enum i915_cache_level cache_level, enum i915_cache_level cache_level,
u32 flags); u32 flags);
I915_SELFTEST_DECLARE(struct fault_attr fault_attr);
}; };
#define i915_is_ggtt(V) (!(V)->file) #define i915_is_ggtt(V) (!(V)->file)
......
...@@ -832,17 +832,17 @@ static int shrink_hole(struct drm_i915_private *i915, ...@@ -832,17 +832,17 @@ static int shrink_hole(struct drm_i915_private *i915,
unsigned long prime; unsigned long prime;
int err; int err;
i915->vm_fault.probability = 999; vm->fault_attr.probability = 999;
atomic_set(&i915->vm_fault.times, -1); atomic_set(&vm->fault_attr.times, -1);
for_each_prime_number_from(prime, 0, ULONG_MAX - 1) { for_each_prime_number_from(prime, 0, ULONG_MAX - 1) {
i915->vm_fault.interval = prime; vm->fault_attr.interval = prime;
err = __shrink_hole(i915, vm, hole_start, hole_end, end_time); err = __shrink_hole(i915, vm, hole_start, hole_end, end_time);
if (err) if (err)
break; break;
} }
memset(&i915->vm_fault, 0, sizeof(i915->vm_fault)); memset(&vm->fault_attr, 0, sizeof(vm->fault_attr));
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment