* [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
@ 2019-01-07 8:56 ` Joonas Lahtinen
0 siblings, 0 replies; 19+ messages in thread
From: Joonas Lahtinen @ 2019-01-07 8:56 UTC (permalink / raw)
To: Intel graphics driver community testing & development
Cc: Joonas Lahtinen, stable, Akash Goel, Chris Wilson,
Tvrtko Ursulin, Adam Zabrocki
Make sure the underlying VMA in the process address space is the
same as it was during vm_mmap to avoid applying WC to wrong VMA.
A more long-term solution would be to have vm_mmap_locked variant
in linux/mmap.h for when caller wants to hold mmap_sem for an
extended duration.
Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
Reported-by: Adam Zabrocki <adamza@microsoft.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.0+
Cc: Akash Goel <akash.goel@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Adam Zabrocki <adamza@microsoft.com>
---
drivers/gpu/drm/i915/i915_gem.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 062c8395557c..f1d594a53978 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1680,6 +1680,15 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
return 0;
}
+static inline bool
+match_gem_vma(struct vm_area_struct *vma, struct file *filp,
+ unsigned long addr, unsigned long size)
+{
+ return vma && vma->vm_file == filp &&
+ vma->vm_start == addr &&
+ (vma->vm_end - vma->vm_start) == size;
+}
+
/**
* i915_gem_mmap_ioctl - Maps the contents of an object, returning the address
* it is mapped to.
@@ -1738,7 +1747,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
return -EINTR;
}
vma = find_vma(mm, addr);
- if (vma)
+ if (match_gem_vma(vma, obj->base.filp, addr, args->size))
vma->vm_page_prot =
pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
else
--
2.17.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
@ 2019-01-07 8:56 ` Joonas Lahtinen
0 siblings, 0 replies; 19+ messages in thread
From: Joonas Lahtinen @ 2019-01-07 8:56 UTC (permalink / raw)
To: Intel graphics driver community testing & development
Cc: Joonas Lahtinen, stable, Akash Goel, Chris Wilson,
Tvrtko Ursulin, Adam Zabrocki
Make sure the underlying VMA in the process address space is the
same as it was during vm_mmap to avoid applying WC to wrong VMA.
A more long-term solution would be to have vm_mmap_locked variant
in linux/mmap.h for when caller wants to hold mmap_sem for an
extended duration.
Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
Reported-by: Adam Zabrocki <adamza@microsoft.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.0+
Cc: Akash Goel <akash.goel@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Adam Zabrocki <adamza@microsoft.com>
---
drivers/gpu/drm/i915/i915_gem.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 062c8395557c..f1d594a53978 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1680,6 +1680,15 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
return 0;
}
+static inline bool
+match_gem_vma(struct vm_area_struct *vma, struct file *filp,
+ unsigned long addr, unsigned long size)
+{
+ return vma && vma->vm_file == filp &&
+ vma->vm_start == addr &&
+ (vma->vm_end - vma->vm_start) == size;
+}
+
/**
* i915_gem_mmap_ioctl - Maps the contents of an object, returning the address
* it is mapped to.
@@ -1738,7 +1747,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
return -EINTR;
}
vma = find_vma(mm, addr);
- if (vma)
+ if (match_gem_vma(vma, obj->base.filp, addr, args->size))
vma->vm_page_prot =
pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
else
--
2.17.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/2] drm/i915: Handle vm_mmap error during I915_GEM_MMAP ioctl with WC set
2019-01-07 8:56 ` Joonas Lahtinen
@ 2019-01-07 8:56 ` Joonas Lahtinen
-1 siblings, 0 replies; 19+ messages in thread
From: Joonas Lahtinen @ 2019-01-07 8:56 UTC (permalink / raw)
To: Intel graphics driver community testing & development
Cc: Joonas Lahtinen, stable, Akash Goel, Chris Wilson,
Tvrtko Ursulin, Adam Zabrocki
Add err goto label and use it when VMA can't be established or changes
underneath.
Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
Reported-by: Adam Zabrocki <adamza@microsoft.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.0+
Cc: Akash Goel <akash.goel@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Adam Zabrocki <adamza@microsoft.com>
---
drivers/gpu/drm/i915/i915_gem.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index f1d594a53978..97cbc0e27e3e 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1738,6 +1738,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
addr = vm_mmap(obj->base.filp, 0, args->size,
PROT_READ | PROT_WRITE, MAP_SHARED,
args->offset);
+ if (IS_ERR((void *)addr))
+ goto err;
+
if (args->flags & I915_MMAP_WC) {
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
@@ -1753,17 +1756,22 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
else
addr = -ENOMEM;
up_write(&mm->mmap_sem);
+ if (IS_ERR((void *)addr))
+ goto err;
/* This may race, but that's ok, it only gets set */
WRITE_ONCE(obj->frontbuffer_ggtt_origin, ORIGIN_CPU);
}
i915_gem_object_put(obj);
- if (IS_ERR((void *)addr))
- return addr;
args->addr_ptr = (uint64_t) addr;
return 0;
+
+err:
+ i915_gem_object_put(obj);
+
+ return addr;
}
static unsigned int tile_row_pages(const struct drm_i915_gem_object *obj)
--
2.17.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/2] drm/i915: Handle vm_mmap error during I915_GEM_MMAP ioctl with WC set
@ 2019-01-07 8:56 ` Joonas Lahtinen
0 siblings, 0 replies; 19+ messages in thread
From: Joonas Lahtinen @ 2019-01-07 8:56 UTC (permalink / raw)
To: Intel graphics driver community testing & development
Cc: stable, Akash Goel, Adam Zabrocki
Add err goto label and use it when VMA can't be established or changes
underneath.
Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
Reported-by: Adam Zabrocki <adamza@microsoft.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.0+
Cc: Akash Goel <akash.goel@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Adam Zabrocki <adamza@microsoft.com>
---
drivers/gpu/drm/i915/i915_gem.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index f1d594a53978..97cbc0e27e3e 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1738,6 +1738,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
addr = vm_mmap(obj->base.filp, 0, args->size,
PROT_READ | PROT_WRITE, MAP_SHARED,
args->offset);
+ if (IS_ERR((void *)addr))
+ goto err;
+
if (args->flags & I915_MMAP_WC) {
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
@@ -1753,17 +1756,22 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
else
addr = -ENOMEM;
up_write(&mm->mmap_sem);
+ if (IS_ERR((void *)addr))
+ goto err;
/* This may race, but that's ok, it only gets set */
WRITE_ONCE(obj->frontbuffer_ggtt_origin, ORIGIN_CPU);
}
i915_gem_object_put(obj);
- if (IS_ERR((void *)addr))
- return addr;
args->addr_ptr = (uint64_t) addr;
return 0;
+
+err:
+ i915_gem_object_put(obj);
+
+ return addr;
}
static unsigned int tile_row_pages(const struct drm_i915_gem_object *obj)
--
2.17.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
2019-01-07 8:56 ` Joonas Lahtinen
@ 2019-01-07 9:13 ` Chris Wilson
-1 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2019-01-07 9:13 UTC (permalink / raw)
To: Intel graphics driver community testing & development,
Joonas Lahtinen
Cc: Joonas Lahtinen, stable, Akash Goel, Tvrtko Ursulin, Adam Zabrocki
Quoting Joonas Lahtinen (2019-01-07 08:56:55)
> Make sure the underlying VMA in the process address space is the
> same as it was during vm_mmap to avoid applying WC to wrong VMA.
>
> A more long-term solution would be to have vm_mmap_locked variant
> in linux/mmap.h for when caller wants to hold mmap_sem for an
> extended duration.
>
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 062c8395557c..f1d594a53978 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1680,6 +1680,15 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
> return 0;
> }
>
> +static inline bool
> +match_gem_vma(struct vm_area_struct *vma, struct file *filp,
> + unsigned long addr, unsigned long size)
With the exception of there isn't anything gem specific here,
> +{
> + return vma && vma->vm_file == filp &&
> + vma->vm_start == addr &&
> + (vma->vm_end - vma->vm_start) == size;
and we can break this up into separate ifs with a forgiving compiler,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
I still couldn't see an easy way of passing pgprot bits into do_mmap to
avoid the race entirely.
-Chris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
@ 2019-01-07 9:13 ` Chris Wilson
0 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2019-01-07 9:13 UTC (permalink / raw)
To: Intel graphics driver community testing & development
Cc: Joonas Lahtinen, stable, Akash Goel, Tvrtko Ursulin, Adam Zabrocki
Quoting Joonas Lahtinen (2019-01-07 08:56:55)
> Make sure the underlying VMA in the process address space is the
> same as it was during vm_mmap to avoid applying WC to wrong VMA.
>
> A more long-term solution would be to have vm_mmap_locked variant
> in linux/mmap.h for when caller wants to hold mmap_sem for an
> extended duration.
>
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 062c8395557c..f1d594a53978 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1680,6 +1680,15 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
> return 0;
> }
>
> +static inline bool
> +match_gem_vma(struct vm_area_struct *vma, struct file *filp,
> + unsigned long addr, unsigned long size)
With the exception of there isn't anything gem specific here,
> +{
> + return vma && vma->vm_file == filp &&
> + vma->vm_start == addr &&
> + (vma->vm_end - vma->vm_start) == size;
and we can break this up into separate ifs with a forgiving compiler,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
I still couldn't see an easy way of passing pgprot bits into do_mmap to
avoid the race entirely.
-Chris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] drm/i915: Handle vm_mmap error during I915_GEM_MMAP ioctl with WC set
2019-01-07 8:56 ` Joonas Lahtinen
@ 2019-01-07 9:18 ` Chris Wilson
-1 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2019-01-07 9:18 UTC (permalink / raw)
To: Intel graphics driver community testing & development,
Joonas Lahtinen
Cc: Joonas Lahtinen, stable, Akash Goel, Tvrtko Ursulin, Adam Zabrocki
Quoting Joonas Lahtinen (2019-01-07 08:56:56)
> Add err goto label and use it when VMA can't be established or changes
> underneath.
>
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
Dubious. All it changes is one branch where the error is forced to
-ENOMEM.
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index f1d594a53978..97cbc0e27e3e 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1738,6 +1738,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> addr = vm_mmap(obj->base.filp, 0, args->size,
> PROT_READ | PROT_WRITE, MAP_SHARED,
> args->offset);
> + if (IS_ERR((void *)addr))
> + goto err;
> +
> if (args->flags & I915_MMAP_WC) {
> struct mm_struct *mm = current->mm;
> struct vm_area_struct *vma;
> @@ -1753,17 +1756,22 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> else
> addr = -ENOMEM;
> up_write(&mm->mmap_sem);
> + if (IS_ERR((void *)addr))
> + goto err;
The issue still remains that we are returning having called vm_mmap and
leaving the vma intact. And we've established above that calling
vm_munmap() is a race.
-Chris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] drm/i915: Handle vm_mmap error during I915_GEM_MMAP ioctl with WC set
@ 2019-01-07 9:18 ` Chris Wilson
0 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2019-01-07 9:18 UTC (permalink / raw)
To: Intel graphics driver community testing & development
Cc: Joonas Lahtinen, stable, Akash Goel, Tvrtko Ursulin, Adam Zabrocki
Quoting Joonas Lahtinen (2019-01-07 08:56:56)
> Add err goto label and use it when VMA can't be established or changes
> underneath.
>
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
Dubious. All it changes is one branch where the error is forced to
-ENOMEM.
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index f1d594a53978..97cbc0e27e3e 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1738,6 +1738,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> addr = vm_mmap(obj->base.filp, 0, args->size,
> PROT_READ | PROT_WRITE, MAP_SHARED,
> args->offset);
> + if (IS_ERR((void *)addr))
> + goto err;
> +
> if (args->flags & I915_MMAP_WC) {
> struct mm_struct *mm = current->mm;
> struct vm_area_struct *vma;
> @@ -1753,17 +1756,22 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> else
> addr = -ENOMEM;
> up_write(&mm->mmap_sem);
> + if (IS_ERR((void *)addr))
> + goto err;
The issue still remains that we are returning having called vm_mmap and
leaving the vma intact. And we've established above that calling
vm_munmap() is a race.
-Chris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
2019-01-07 8:56 ` Joonas Lahtinen
@ 2019-01-07 9:24 ` Tvrtko Ursulin
-1 siblings, 0 replies; 19+ messages in thread
From: Tvrtko Ursulin @ 2019-01-07 9:24 UTC (permalink / raw)
To: Joonas Lahtinen,
Intel graphics driver community testing & development
Cc: stable, Akash Goel, Chris Wilson, Adam Zabrocki
On 07/01/2019 08:56, Joonas Lahtinen wrote:
> Make sure the underlying VMA in the process address space is the
> same as it was during vm_mmap to avoid applying WC to wrong VMA.
>
> A more long-term solution would be to have vm_mmap_locked variant
> in linux/mmap.h for when caller wants to hold mmap_sem for an
> extended duration.
>
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 062c8395557c..f1d594a53978 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1680,6 +1680,15 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
> return 0;
> }
>
> +static inline bool
> +match_gem_vma(struct vm_area_struct *vma, struct file *filp,
> + unsigned long addr, unsigned long size)
> +{
> + return vma && vma->vm_file == filp &&
> + vma->vm_start == addr &&
> + (vma->vm_end - vma->vm_start) == size;
> +}
> +
> /**
> * i915_gem_mmap_ioctl - Maps the contents of an object, returning the address
> * it is mapped to.
> @@ -1738,7 +1747,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> return -EINTR;
> }
> vma = find_vma(mm, addr);
> - if (vma)
> + if (match_gem_vma(vma, obj->base.filp, addr, args->size))
> vma->vm_page_prot =
> pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
> else
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
@ 2019-01-07 9:24 ` Tvrtko Ursulin
0 siblings, 0 replies; 19+ messages in thread
From: Tvrtko Ursulin @ 2019-01-07 9:24 UTC (permalink / raw)
To: Joonas Lahtinen,
Intel graphics driver community testing & development
Cc: stable, Akash Goel, Chris Wilson, Adam Zabrocki
On 07/01/2019 08:56, Joonas Lahtinen wrote:
> Make sure the underlying VMA in the process address space is the
> same as it was during vm_mmap to avoid applying WC to wrong VMA.
>
> A more long-term solution would be to have vm_mmap_locked variant
> in linux/mmap.h for when caller wants to hold mmap_sem for an
> extended duration.
>
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 062c8395557c..f1d594a53978 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1680,6 +1680,15 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
> return 0;
> }
>
> +static inline bool
> +match_gem_vma(struct vm_area_struct *vma, struct file *filp,
> + unsigned long addr, unsigned long size)
> +{
> + return vma && vma->vm_file == filp &&
> + vma->vm_start == addr &&
> + (vma->vm_end - vma->vm_start) == size;
> +}
> +
> /**
> * i915_gem_mmap_ioctl - Maps the contents of an object, returning the address
> * it is mapped to.
> @@ -1738,7 +1747,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> return -EINTR;
> }
> vma = find_vma(mm, addr);
> - if (vma)
> + if (match_gem_vma(vma, obj->base.filp, addr, args->size))
> vma->vm_page_prot =
> pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
> else
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
^ permalink raw reply [flat|nested] 19+ messages in thread
* ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
2019-01-07 8:56 ` Joonas Lahtinen
` (3 preceding siblings ...)
(?)
@ 2019-01-07 9:27 ` Patchwork
-1 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-01-07 9:27 UTC (permalink / raw)
To: Joonas Lahtinen; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
URL : https://patchwork.freedesktop.org/series/54797/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5364 -> Patchwork_11198
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/54797/revisions/1/mbox/
Known issues
------------
Here are the changes found in Patchwork_11198 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_basic@cs-compute:
- fi-kbl-8809g: NOTRUN -> FAIL [fdo#108094]
* igt@amdgpu/amd_prime@amd-to-i915:
- fi-kbl-8809g: NOTRUN -> FAIL [fdo#107341]
* igt@gem_exec_suspend@basic-s4-devices:
- fi-blb-e6850: PASS -> INCOMPLETE [fdo#107718]
* igt@i915_selftest@live_evict:
- fi-bsw-kefka: PASS -> DMESG-WARN [fdo#107709]
* igt@pm_rpm@module-reload:
- fi-icl-u2: PASS -> DMESG-WARN [fdo#108654]
#### Possible fixes ####
* igt@amdgpu/amd_basic@userptr:
- fi-kbl-8809g: DMESG-WARN [fdo#108965] -> PASS
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: FAIL [fdo#108767] -> PASS
* igt@kms_frontbuffer_tracking@basic:
- fi-byt-clapper: FAIL [fdo#103167] -> PASS
* igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#107341]: https://bugs.freedesktop.org/show_bug.cgi?id=107341
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107709]: https://bugs.freedesktop.org/show_bug.cgi?id=107709
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#108094]: https://bugs.freedesktop.org/show_bug.cgi?id=108094
[fdo#108654]: https://bugs.freedesktop.org/show_bug.cgi?id=108654
[fdo#108767]: https://bugs.freedesktop.org/show_bug.cgi?id=108767
[fdo#108965]: https://bugs.freedesktop.org/show_bug.cgi?id=108965
Participating hosts (43 -> 39)
------------------------------
Additional (1): fi-kbl-7560u
Missing (5): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-glk-j4005
Build changes
-------------
* Linux: CI_DRM_5364 -> Patchwork_11198
CI_DRM_5364: 53364c9f70e33458fe848372778f8d0eba994f91 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4756: 75081c6bfb9998bd7cbf35a7ac0578c683fe55a8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11198: e6454c963d6c544b9395ffe92a8ac443f8e6080f @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
e6454c963d6c drm/i915: Handle vm_mmap error during I915_GEM_MMAP ioctl with WC set
877d1741097f drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_11198/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] drm/i915: Handle vm_mmap error during I915_GEM_MMAP ioctl with WC set
2019-01-07 8:56 ` Joonas Lahtinen
@ 2019-01-07 9:29 ` Tvrtko Ursulin
-1 siblings, 0 replies; 19+ messages in thread
From: Tvrtko Ursulin @ 2019-01-07 9:29 UTC (permalink / raw)
To: Joonas Lahtinen,
Intel graphics driver community testing & development
Cc: stable, Akash Goel, Chris Wilson, Adam Zabrocki
On 07/01/2019 08:56, Joonas Lahtinen wrote:
> Add err goto label and use it when VMA can't be established or changes
> underneath.
>
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index f1d594a53978..97cbc0e27e3e 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1738,6 +1738,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> addr = vm_mmap(obj->base.filp, 0, args->size,
> PROT_READ | PROT_WRITE, MAP_SHARED,
> args->offset);
> + if (IS_ERR((void *)addr))
> + goto err;
> +
> if (args->flags & I915_MMAP_WC) {
> struct mm_struct *mm = current->mm;
> struct vm_area_struct *vma;
> @@ -1753,17 +1756,22 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> else
> addr = -ENOMEM;
> up_write(&mm->mmap_sem);
> + if (IS_ERR((void *)addr))
> + goto err;
>
> /* This may race, but that's ok, it only gets set */
> WRITE_ONCE(obj->frontbuffer_ggtt_origin, ORIGIN_CPU);
> }
> i915_gem_object_put(obj);
> - if (IS_ERR((void *)addr))
> - return addr;
>
> args->addr_ptr = (uint64_t) addr;
>
> return 0;
> +
> +err:
> + i915_gem_object_put(obj);
> +
> + return addr;
> }
>
> static unsigned int tile_row_pages(const struct drm_i915_gem_object *obj)
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] drm/i915: Handle vm_mmap error during I915_GEM_MMAP ioctl with WC set
@ 2019-01-07 9:29 ` Tvrtko Ursulin
0 siblings, 0 replies; 19+ messages in thread
From: Tvrtko Ursulin @ 2019-01-07 9:29 UTC (permalink / raw)
To: Joonas Lahtinen,
Intel graphics driver community testing & development
Cc: stable, Akash Goel, Chris Wilson, Adam Zabrocki
On 07/01/2019 08:56, Joonas Lahtinen wrote:
> Add err goto label and use it when VMA can't be established or changes
> underneath.
>
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index f1d594a53978..97cbc0e27e3e 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1738,6 +1738,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> addr = vm_mmap(obj->base.filp, 0, args->size,
> PROT_READ | PROT_WRITE, MAP_SHARED,
> args->offset);
> + if (IS_ERR((void *)addr))
> + goto err;
> +
> if (args->flags & I915_MMAP_WC) {
> struct mm_struct *mm = current->mm;
> struct vm_area_struct *vma;
> @@ -1753,17 +1756,22 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> else
> addr = -ENOMEM;
> up_write(&mm->mmap_sem);
> + if (IS_ERR((void *)addr))
> + goto err;
>
> /* This may race, but that's ok, it only gets set */
> WRITE_ONCE(obj->frontbuffer_ggtt_origin, ORIGIN_CPU);
> }
> i915_gem_object_put(obj);
> - if (IS_ERR((void *)addr))
> - return addr;
>
> args->addr_ptr = (uint64_t) addr;
>
> return 0;
> +
> +err:
> + i915_gem_object_put(obj);
> +
> + return addr;
> }
>
> static unsigned int tile_row_pages(const struct drm_i915_gem_object *obj)
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
^ permalink raw reply [flat|nested] 19+ messages in thread
* ✗ Fi.CI.IGT: failure for series starting with [1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
2019-01-07 8:56 ` Joonas Lahtinen
` (4 preceding siblings ...)
(?)
@ 2019-01-07 10:44 ` Patchwork
2019-01-07 10:58 ` Chris Wilson
-1 siblings, 1 reply; 19+ messages in thread
From: Patchwork @ 2019-01-07 10:44 UTC (permalink / raw)
To: Joonas Lahtinen; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
URL : https://patchwork.freedesktop.org/series/54797/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_5364_full -> Patchwork_11198_full
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_11198_full absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_11198_full, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_11198_full:
### IGT changes ###
#### Possible regressions ####
* igt@gem_userptr_blits@readonly-unsync:
- shard-apl: PASS -> TIMEOUT
* igt@kms_draw_crc@draw-method-rgb565-mmap-wc-untiled:
- shard-apl: PASS -> FAIL
- shard-glk: PASS -> FAIL
- shard-kbl: PASS -> FAIL
#### Warnings ####
* igt@kms_ccs@pipe-a-bad-aux-stride:
- shard-apl: SKIP -> PASS
* igt@tools_test@tools_test:
- shard-glk: PASS -> SKIP
Known issues
------------
Here are the changes found in Patchwork_11198_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@kms_atomic_transition@1x-modeset-transitions:
- shard-skl: NOTRUN -> FAIL [fdo#107815] / [fdo#108470] +1
* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
- shard-skl: NOTRUN -> DMESG-WARN [fdo#107956]
* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-c:
- shard-apl: NOTRUN -> DMESG-WARN [fdo#107956] +1
* igt@kms_busy@extended-pageflip-hang-newfb-render-c:
- shard-glk: PASS -> DMESG-WARN [fdo#107956]
* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-a:
- shard-iclb: NOTRUN -> DMESG-WARN [fdo#107956]
* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-c:
- shard-apl: PASS -> DMESG-WARN [fdo#107956]
* igt@kms_chv_cursor_fail@pipe-b-128x128-top-edge:
- shard-skl: NOTRUN -> FAIL [fdo#104671]
* igt@kms_cursor_crc@cursor-128x128-sliding:
- shard-iclb: NOTRUN -> FAIL [fdo#103232]
* igt@kms_cursor_crc@cursor-128x42-sliding:
- shard-apl: PASS -> FAIL [fdo#103232]
- shard-glk: PASS -> FAIL [fdo#103232]
* igt@kms_fbcon_fbt@psr:
- shard-iclb: NOTRUN -> FAIL [fdo#107882]
* igt@kms_flip@flip-vs-expired-vblank:
- shard-skl: NOTRUN -> FAIL [fdo#105363]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-gtt:
- shard-skl: NOTRUN -> FAIL [fdo#103167]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
- shard-iclb: PASS -> FAIL [fdo#103167] +4
* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-pwrite:
- shard-glk: PASS -> FAIL [fdo#103167]
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
- shard-skl: NOTRUN -> FAIL [fdo#103191] / [fdo#107362] +1
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
- shard-iclb: PASS -> INCOMPLETE [fdo#107713]
* igt@kms_plane@pixel-format-pipe-c-planes-source-clamping:
- shard-skl: NOTRUN -> DMESG-WARN [fdo#106885]
* igt@kms_plane@plane-position-covered-pipe-b-planes:
- shard-glk: PASS -> FAIL [fdo#103166] +1
* igt@kms_plane_alpha_blend@pipe-a-alpha-7efc:
- shard-skl: NOTRUN -> FAIL [fdo#107815] / [fdo#108145] +2
* igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max:
- shard-skl: NOTRUN -> FAIL [fdo#108145] +1
* igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
- shard-iclb: PASS -> FAIL [fdo#103166] +1
* igt@kms_plane_multiple@atomic-pipe-b-tiling-yf:
- shard-skl: NOTRUN -> FAIL [fdo#103166] / [fdo#107815]
* igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-iclb: PASS -> DMESG-WARN [fdo#107724]
* igt@kms_setmode@basic:
- shard-skl: NOTRUN -> FAIL [fdo#99912]
- shard-kbl: PASS -> FAIL [fdo#99912]
* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-skl: NOTRUN -> INCOMPLETE [fdo#104108] / [fdo#107773]
* igt@pm_rpm@legacy-planes:
- shard-iclb: PASS -> INCOMPLETE [fdo#108840]
* igt@pm_rps@min-max-config-loaded:
- shard-glk: PASS -> FAIL [fdo#102250]
#### Possible fixes ####
* igt@gem_exec_async@concurrent-writes-vebox:
- shard-skl: INCOMPLETE -> PASS
* igt@kms_atomic_transition@plane-all-transition-nonblocking-fencing:
- shard-apl: DMESG-WARN [fdo#103558] / [fdo#105602] / [fdo#109225] -> PASS
* igt@kms_available_modes_crc@available_mode_test_crc:
- shard-apl: FAIL [fdo#106641] -> PASS
* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-a:
- shard-glk: DMESG-WARN [fdo#107956] -> PASS
* igt@kms_color@pipe-c-ctm-max:
- shard-apl: FAIL [fdo#108147] -> PASS
* igt@kms_cursor_crc@cursor-256x256-sliding:
- shard-skl: FAIL [fdo#103232] -> PASS
* igt@kms_cursor_crc@cursor-256x256-suspend:
- shard-apl: FAIL [fdo#103191] / [fdo#103232] -> PASS
* igt@kms_cursor_crc@cursor-256x85-onscreen:
- shard-glk: FAIL [fdo#103232] -> PASS
* igt@kms_cursor_crc@cursor-256x85-random:
- shard-apl: FAIL [fdo#103232] -> PASS +5
* igt@kms_cursor_legacy@all-pipes-torture-bo:
- shard-hsw: DMESG-WARN [fdo#107122] -> PASS
* igt@kms_fbcon_fbt@fbc-suspend:
- shard-iclb: INCOMPLETE [fdo#107713] -> PASS +1
* igt@kms_flip@basic-flip-vs-dpms:
- shard-kbl: DMESG-WARN [fdo#103313] / [fdo#105345] -> PASS
* igt@kms_flip@flip-vs-dpms-off-vs-modeset:
- shard-apl: DMESG-WARN [fdo#103558] / [fdo#105602] -> PASS +44
* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-skl: FAIL [fdo#105363] -> PASS
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
- shard-apl: FAIL [fdo#103167] -> PASS
* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-onoff:
- shard-iclb: FAIL [fdo#103167] -> PASS +4
* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-c:
- shard-skl: FAIL [fdo#107362] -> PASS
* igt@kms_plane@plane-position-covered-pipe-b-planes:
- shard-iclb: FAIL [fdo#103166] -> PASS
* igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl: FAIL [fdo#107815] -> PASS
* igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
- shard-glk: FAIL [fdo#103166] -> PASS +1
* igt@kms_plane_scaling@pipe-b-scaler-with-rotation:
- shard-iclb: DMESG-WARN [fdo#107724] -> PASS
* igt@perf_pmu@rc6-runtime-pm-long:
- shard-iclb: FAIL [fdo#105010] -> PASS
- shard-skl: FAIL [fdo#105010] -> PASS
* igt@pm_rpm@reg-read-ioctl:
- shard-iclb: INCOMPLETE [fdo#107713] / [fdo#108840] -> PASS
* igt@pm_rpm@system-suspend-execbuf:
- shard-apl: DMESG-WARN [fdo#108131] -> PASS
#### Warnings ####
* igt@i915_suspend@shrink:
- shard-skl: INCOMPLETE [fdo#106886] -> DMESG-WARN [fdo#107886] / [fdo#108784]
* igt@kms_cursor_crc@cursor-128x128-suspend:
- shard-glk: FAIL [fdo#103232] -> INCOMPLETE [fdo#103359] / [k.org#198133]
* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
- shard-apl: DMESG-FAIL [fdo#103558] / [fdo#105602] / [fdo#108145] -> FAIL [fdo#108145]
[fdo#102250]: https://bugs.freedesktop.org/show_bug.cgi?id=102250
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103313]: https://bugs.freedesktop.org/show_bug.cgi?id=103313
[fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
[fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#104671]: https://bugs.freedesktop.org/show_bug.cgi?id=104671
[fdo#105010]: https://bugs.freedesktop.org/show_bug.cgi?id=105010
[fdo#105345]: https://bugs.freedesktop.org/show_bug.cgi?id=105345
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
[fdo#106885]: https://bugs.freedesktop.org/show_bug.cgi?id=106885
[fdo#106886]: https://bugs.freedesktop.org/show_bug.cgi?id=106886
[fdo#107122]: https://bugs.freedesktop.org/show_bug.cgi?id=107122
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#107773]: https://bugs.freedesktop.org/show_bug.cgi?id=107773
[fdo#107815]: https://bugs.freedesktop.org/show_bug.cgi?id=107815
[fdo#107882]: https://bugs.freedesktop.org/show_bug.cgi?id=107882
[fdo#107886]: https://bugs.freedesktop.org/show_bug.cgi?id=107886
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108131]: https://bugs.freedesktop.org/show_bug.cgi?id=108131
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108147]: https://bugs.freedesktop.org/show_bug.cgi?id=108147
[fdo#108470]: https://bugs.freedesktop.org/show_bug.cgi?id=108470
[fdo#108784]: https://bugs.freedesktop.org/show_bug.cgi?id=108784
[fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
[fdo#109225]: https://bugs.freedesktop.org/show_bug.cgi?id=109225
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133
Participating hosts (7 -> 7)
------------------------------
No changes in participating hosts
Build changes
-------------
* Linux: CI_DRM_5364 -> Patchwork_11198
CI_DRM_5364: 53364c9f70e33458fe848372778f8d0eba994f91 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4756: 75081c6bfb9998bd7cbf35a7ac0578c683fe55a8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11198: e6454c963d6c544b9395ffe92a8ac443f8e6080f @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_11198/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: ✗ Fi.CI.IGT: failure for series starting with [1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
2019-01-07 10:44 ` ✗ Fi.CI.IGT: failure " Patchwork
@ 2019-01-07 10:58 ` Chris Wilson
0 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2019-01-07 10:58 UTC (permalink / raw)
To: Joonas Lahtinen, Patchwork; +Cc: intel-gfx
Quoting Patchwork (2019-01-07 10:44:01)
> ### IGT changes ###
>
> #### Possible regressions ####
>
> * igt@gem_userptr_blits@readonly-unsync:
> - shard-apl: PASS -> TIMEOUT
>
> * igt@kms_draw_crc@draw-method-rgb565-mmap-wc-untiled:
> - shard-apl: PASS -> FAIL
> - shard-glk: PASS -> FAIL
> - shard-kbl: PASS -> FAIL
igt_fb doesn't compute a page aligned size, and igt_draw ends up making
a mmap request not rounding up to the page boundary. I wonder if that
hasn't been causing a few flip-flips...
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
2019-01-07 8:56 ` Joonas Lahtinen
@ 2019-02-07 13:38 ` Joonas Lahtinen
-1 siblings, 0 replies; 19+ messages in thread
From: Joonas Lahtinen @ 2019-02-07 13:38 UTC (permalink / raw)
To: Intel graphics driver community testing & development
Cc: stable, Akash Goel, Chris Wilson, Tvrtko Ursulin, Adam Zabrocki
Quoting Joonas Lahtinen (2019-01-07 10:56:55)
> Make sure the underlying VMA in the process address space is the
> same as it was during vm_mmap to avoid applying WC to wrong VMA.
>
> A more long-term solution would be to have vm_mmap_locked variant
> in linux/mmap.h for when caller wants to hold mmap_sem for an
> extended duration.
These are now merged to drm-tip, and will head to 5.1 and then
to stable kernels.
Thanks for the report and reviews!
Regards, Joonas
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 062c8395557c..f1d594a53978 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1680,6 +1680,15 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
> return 0;
> }
>
> +static inline bool
> +match_gem_vma(struct vm_area_struct *vma, struct file *filp,
> + unsigned long addr, unsigned long size)
> +{
> + return vma && vma->vm_file == filp &&
> + vma->vm_start == addr &&
> + (vma->vm_end - vma->vm_start) == size;
> +}
> +
> /**
> * i915_gem_mmap_ioctl - Maps the contents of an object, returning the address
> * it is mapped to.
> @@ -1738,7 +1747,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> return -EINTR;
> }
> vma = find_vma(mm, addr);
> - if (vma)
> + if (match_gem_vma(vma, obj->base.filp, addr, args->size))
> vma->vm_page_prot =
> pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
> else
> --
> 2.17.2
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
@ 2019-02-07 13:38 ` Joonas Lahtinen
0 siblings, 0 replies; 19+ messages in thread
From: Joonas Lahtinen @ 2019-02-07 13:38 UTC (permalink / raw)
To: Intel graphics driver community testing & development
Cc: stable, Akash Goel, Chris Wilson, Tvrtko Ursulin, Adam Zabrocki
Quoting Joonas Lahtinen (2019-01-07 10:56:55)
> Make sure the underlying VMA in the process address space is the
> same as it was during vm_mmap to avoid applying WC to wrong VMA.
>
> A more long-term solution would be to have vm_mmap_locked variant
> in linux/mmap.h for when caller wants to hold mmap_sem for an
> extended duration.
These are now merged to drm-tip, and will head to 5.1 and then
to stable kernels.
Thanks for the report and reviews!
Regards, Joonas
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user mappings for objects")
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 062c8395557c..f1d594a53978 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1680,6 +1680,15 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
> return 0;
> }
>
> +static inline bool
> +match_gem_vma(struct vm_area_struct *vma, struct file *filp,
> + unsigned long addr, unsigned long size)
> +{
> + return vma && vma->vm_file == filp &&
> + vma->vm_start == addr &&
> + (vma->vm_end - vma->vm_start) == size;
> +}
> +
> /**
> * i915_gem_mmap_ioctl - Maps the contents of an object, returning the address
> * it is mapped to.
> @@ -1738,7 +1747,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> return -EINTR;
> }
> vma = find_vma(mm, addr);
> - if (vma)
> + if (match_gem_vma(vma, obj->base.filp, addr, args->size))
> vma->vm_page_prot =
> pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
> else
> --
> 2.17.2
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
2019-02-07 13:38 ` Joonas Lahtinen
@ 2019-02-08 0:03 ` Adam Zabrocki
-1 siblings, 0 replies; 19+ messages in thread
From: Adam Zabrocki @ 2019-02-08 0:03 UTC (permalink / raw)
To: Joonas Lahtinen,
Intel graphics driver community testing & development
Cc: stable, Akash Goel, Chris Wilson, Tvrtko Ursulin
Thanks for the patch for both issues!
Best regards,
Adam
-----Original Message-----
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Sent: Thursday, February 7, 2019 5:39 AM
To: Intel graphics driver community testing & development <intel-gfx@lists.freedesktop.org>
Cc: stable@vger.kernel.org; Akash Goel <akash.goel@intel.com>; Chris Wilson <chris@chris-wilson.co.uk>; Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>; Adam Zabrocki <adamza@microsoft.com>
Subject: Re: [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
Quoting Joonas Lahtinen (2019-01-07 10:56:55)
> Make sure the underlying VMA in the process address space is the same
> as it was during vm_mmap to avoid applying WC to wrong VMA.
>
> A more long-term solution would be to have vm_mmap_locked variant in
> linux/mmap.h for when caller wants to hold mmap_sem for an extended
> duration.
These are now merged to drm-tip, and will head to 5.1 and then to stable kernels.
Thanks for the report and reviews!
Regards, Joonas
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user
> mappings for objects")
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c
> b/drivers/gpu/drm/i915/i915_gem.c index 062c8395557c..f1d594a53978
> 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1680,6 +1680,15 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
> return 0;
> }
>
> +static inline bool
> +match_gem_vma(struct vm_area_struct *vma, struct file *filp,
> + unsigned long addr, unsigned long size) {
> + return vma && vma->vm_file == filp &&
> + vma->vm_start == addr &&
> + (vma->vm_end - vma->vm_start) == size; }
> +
> /**
> * i915_gem_mmap_ioctl - Maps the contents of an object, returning the address
> * it is mapped to.
> @@ -1738,7 +1747,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> return -EINTR;
> }
> vma = find_vma(mm, addr);
> - if (vma)
> + if (match_gem_vma(vma, obj->base.filp, addr,
> + args->size))
> vma->vm_page_prot =
> pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
> else
> --
> 2.17.2
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
@ 2019-02-08 0:03 ` Adam Zabrocki
0 siblings, 0 replies; 19+ messages in thread
From: Adam Zabrocki @ 2019-02-08 0:03 UTC (permalink / raw)
To: Joonas Lahtinen,
Intel graphics driver community testing & development
Cc: stable, Akash Goel, Chris Wilson, Tvrtko Ursulin
Thanks for the patch for both issues!
Best regards,
Adam
-----Original Message-----
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Sent: Thursday, February 7, 2019 5:39 AM
To: Intel graphics driver community testing & development <intel-gfx@lists.freedesktop.org>
Cc: stable@vger.kernel.org; Akash Goel <akash.goel@intel.com>; Chris Wilson <chris@chris-wilson.co.uk>; Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>; Adam Zabrocki <adamza@microsoft.com>
Subject: Re: [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
Quoting Joonas Lahtinen (2019-01-07 10:56:55)
> Make sure the underlying VMA in the process address space is the same
> as it was during vm_mmap to avoid applying WC to wrong VMA.
>
> A more long-term solution would be to have vm_mmap_locked variant in
> linux/mmap.h for when caller wants to hold mmap_sem for an extended
> duration.
These are now merged to drm-tip, and will head to 5.1 and then to stable kernels.
Thanks for the report and reviews!
Regards, Joonas
> Fixes: 1816f9236303 ("drm/i915: Support creation of unbound wc user
> mappings for objects")
> Reported-by: Adam Zabrocki <adamza@microsoft.com>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.0+
> Cc: Akash Goel <akash.goel@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Adam Zabrocki <adamza@microsoft.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c
> b/drivers/gpu/drm/i915/i915_gem.c index 062c8395557c..f1d594a53978
> 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1680,6 +1680,15 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
> return 0;
> }
>
> +static inline bool
> +match_gem_vma(struct vm_area_struct *vma, struct file *filp,
> + unsigned long addr, unsigned long size) {
> + return vma && vma->vm_file == filp &&
> + vma->vm_start == addr &&
> + (vma->vm_end - vma->vm_start) == size; }
> +
> /**
> * i915_gem_mmap_ioctl - Maps the contents of an object, returning the address
> * it is mapped to.
> @@ -1738,7 +1747,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> return -EINTR;
> }
> vma = find_vma(mm, addr);
> - if (vma)
> + if (match_gem_vma(vma, obj->base.filp, addr,
> + args->size))
> vma->vm_page_prot =
> pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
> else
> --
> 2.17.2
>
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2019-02-08 0:03 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-07 8:56 [PATCH 1/2] drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set Joonas Lahtinen
2019-01-07 8:56 ` Joonas Lahtinen
2019-01-07 8:56 ` [PATCH 2/2] drm/i915: Handle vm_mmap error " Joonas Lahtinen
2019-01-07 8:56 ` Joonas Lahtinen
2019-01-07 9:18 ` Chris Wilson
2019-01-07 9:18 ` Chris Wilson
2019-01-07 9:29 ` Tvrtko Ursulin
2019-01-07 9:29 ` Tvrtko Ursulin
2019-01-07 9:13 ` [PATCH 1/2] drm/i915: Prevent a race " Chris Wilson
2019-01-07 9:13 ` Chris Wilson
2019-01-07 9:24 ` Tvrtko Ursulin
2019-01-07 9:24 ` Tvrtko Ursulin
2019-01-07 9:27 ` ✓ Fi.CI.BAT: success for series starting with [1/2] " Patchwork
2019-01-07 10:44 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-01-07 10:58 ` Chris Wilson
2019-02-07 13:38 ` [PATCH 1/2] " Joonas Lahtinen
2019-02-07 13:38 ` Joonas Lahtinen
2019-02-08 0:03 ` Adam Zabrocki
2019-02-08 0:03 ` Adam Zabrocki
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.