projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
84c33a6
)
drm/i915: Don't prefault the entire obj if the vma is smaller
author
Ville Syrjälä
<
[email protected]
>
Tue, 17 Jun 2014 18:03:00 +0000
(21:03 +0300)
committer
Daniel Vetter
<
[email protected]
>
Tue, 17 Jun 2014 22:48:35 +0000
(
00:48
+0200)
Take the minimum of the object size and the vma size and prefault
only that much. Avoids a SIGBUS when mmapping only a portion of the
object.
Prefaulting was introduced here:
commit
b90b91d87038f6b257b40a02b42ed4f9705e06f0
Author: Chris Wilson <
[email protected]
>
Date: Tue Jun 10 12:14:40 2014 +0100
drm/i915: Prefault the entire object on first page fault
Cc: Chris Wilson <
[email protected]
>
Signed-off-by: Ville Syrjälä <
[email protected]
>
Testcase: igt/gem_mmap/short-mmap
Signed-off-by: Daniel Vetter <
[email protected]
>
drivers/gpu/drm/i915/i915_gem.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/i915/i915_gem.c
b/drivers/gpu/drm/i915/i915_gem.c
index 7f643db268295048f5efd480b89ef708891f84eb..d8364135c2e557771b269e0edd05a3220c16d8f0 100644
(file)
--- a/
drivers/gpu/drm/i915/i915_gem.c
+++ b/
drivers/gpu/drm/i915/i915_gem.c
@@
-1570,9
+1570,12
@@
int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
pfn >>= PAGE_SHIFT;
if (!obj->fault_mappable) {
+ unsigned long size = min_t(unsigned long,
+ vma->vm_end - vma->vm_start,
+ obj->base.size);
int i;
- for (i = 0; i <
obj->base.
size >> PAGE_SHIFT; i++) {
+ for (i = 0; i < size >> PAGE_SHIFT; i++) {
ret = vm_insert_pfn(vma,
(unsigned long)vma->vm_start + i * PAGE_SIZE,
pfn + i);