All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: vfree() no longer ignores the low bits of the address
@ 2016-08-18  9:01 Chris Wilson
  2016-08-18  9:44 ` ✗ Ro.CI.BAT: failure for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chris Wilson @ 2016-08-18  9:01 UTC (permalink / raw)
  To: intel-gfx

Since vfree() now likes to WARN when passed a none page-aligned pointer,
we need to discard the low bits to comply with it.

Fixes: d31d7cb1460c ("drm/i915: Support for creating write combined type vmaps")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h |  5 +++++
 drivers/gpu/drm/i915/i915_gem.c | 11 +++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 35caa9b2f36a..cc1e72dbf18e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3896,6 +3896,11 @@ static inline bool __i915_request_irq_complete(struct drm_i915_gem_request *req)
 void i915_memcpy_init_early(struct drm_i915_private *dev_priv);
 bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len);
 
+#define ptr_mask_bits(ptr) ({						\
+	unsigned long __v = (unsigned long)(ptr);			\
+	(typeof(ptr))(__v & PAGE_MASK);					\
+})
+
 #define ptr_unpack_bits(ptr, bits) ({					\
 	unsigned long __v = (unsigned long)(ptr);			\
 	(bits) = __v & ~PAGE_MASK;					\
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a8d0f70c22f9..cffa57b14246 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2094,11 +2094,14 @@ i915_gem_object_put_pages(struct drm_i915_gem_object *obj)
 	list_del(&obj->global_list);
 
 	if (obj->mapping) {
-		/* low bits are ignored by is_vmalloc_addr and kmap_to_page */
-		if (is_vmalloc_addr(obj->mapping))
-			vunmap(obj->mapping);
+		void *ptr;
+
+		ptr = ptr_mask_bits(obj->mapping);
+		if (is_vmalloc_addr(ptr))
+			vunmap(ptr);
 		else
-			kunmap(kmap_to_page(obj->mapping));
+			kunmap(kmap_to_page(ptr));
+
 		obj->mapping = NULL;
 	}
 
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* ✗ Ro.CI.BAT: failure for drm/i915: vfree() no longer ignores the low bits of the address
  2016-08-18  9:01 [PATCH] drm/i915: vfree() no longer ignores the low bits of the address Chris Wilson
@ 2016-08-18  9:44 ` Patchwork
  2016-08-18  9:45 ` [PATCH] " Tvrtko Ursulin
  2016-08-18 10:36 ` Joonas Lahtinen
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2016-08-18  9:44 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: vfree() no longer ignores the low bits of the address
URL   : https://patchwork.freedesktop.org/series/11260/
State : failure

== Summary ==

Series 11260v1 drm/i915: vfree() no longer ignores the low bits of the address
http://patchwork.freedesktop.org/api/1.0/series/11260/revisions/1/mbox

Test drv_module_reload_basic:
                pass       -> SKIP       (ro-bdw-i7-5557U)
Test kms_cursor_legacy:
        Subgroup basic-flip-vs-cursor-legacy:
                fail       -> PASS       (ro-byt-n2820)
                fail       -> PASS       (ro-bdw-i5-5250u)
                pass       -> FAIL       (ro-skl3-i5-6260u)
        Subgroup basic-flip-vs-cursor-varying-size:
                pass       -> FAIL       (ro-byt-n2820)
                pass       -> FAIL       (ro-bdw-i5-5250u)
Test kms_force_connector_basic:
        Subgroup force-connector-state:
                pass       -> SKIP       (ro-ilk1-i5-650)
        Subgroup force-edid:
                pass       -> SKIP       (ro-ilk1-i5-650)
        Subgroup prune-stale-modes:
                pass       -> SKIP       (ro-ilk1-i5-650)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> SKIP       (ro-bdw-i7-5557U)

fi-kbl-qkkr      total:244  pass:185  dwarn:29  dfail:0   fail:3   skip:27 
fi-skl-i7-6700k  total:244  pass:208  dwarn:4   dfail:2   fail:2   skip:28 
fi-snb-i7-2600   total:244  pass:202  dwarn:0   dfail:0   fail:0   skip:42 
ro-bdw-i5-5250u  total:240  pass:219  dwarn:1   dfail:0   fail:1   skip:19 
ro-bdw-i7-5557U  total:240  pass:219  dwarn:1   dfail:0   fail:0   skip:20 
ro-bdw-i7-5600u  total:240  pass:207  dwarn:0   dfail:0   fail:1   skip:32 
ro-bsw-n3050     total:240  pass:197  dwarn:0   dfail:0   fail:1   skip:42 
ro-byt-n2820     total:240  pass:198  dwarn:0   dfail:0   fail:2   skip:40 
ro-hsw-i3-4010u  total:240  pass:214  dwarn:0   dfail:0   fail:0   skip:26 
ro-hsw-i7-4770r  total:240  pass:185  dwarn:0   dfail:0   fail:0   skip:55 
ro-ilk1-i5-650   total:235  pass:171  dwarn:0   dfail:0   fail:1   skip:63 
ro-ivb-i7-3770   total:240  pass:205  dwarn:0   dfail:0   fail:0   skip:35 
ro-ivb2-i7-3770  total:240  pass:209  dwarn:0   dfail:0   fail:0   skip:31 
ro-skl3-i5-6260u total:240  pass:222  dwarn:0   dfail:0   fail:4   skip:14 

Results at /archive/results/CI_IGT_test/RO_Patchwork_1921/

e45fdef drm-intel-nightly: 2016y-08m-17d-13h-26m-04s UTC integration manifest
88cfe05 drm/i915: vfree() no longer ignores the low bits of the address

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: vfree() no longer ignores the low bits of the address
  2016-08-18  9:01 [PATCH] drm/i915: vfree() no longer ignores the low bits of the address Chris Wilson
  2016-08-18  9:44 ` ✗ Ro.CI.BAT: failure for " Patchwork
@ 2016-08-18  9:45 ` Tvrtko Ursulin
  2016-08-18 10:36 ` Joonas Lahtinen
  2 siblings, 0 replies; 4+ messages in thread
From: Tvrtko Ursulin @ 2016-08-18  9:45 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx


On 18/08/16 10:01, Chris Wilson wrote:
> Since vfree() now likes to WARN when passed a none page-aligned pointer,
> we need to discard the low bits to comply with it.
>
> Fixes: d31d7cb1460c ("drm/i915: Support for creating write combined type vmaps")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_drv.h |  5 +++++
>   drivers/gpu/drm/i915/i915_gem.c | 11 +++++++----
>   2 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 35caa9b2f36a..cc1e72dbf18e 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3896,6 +3896,11 @@ static inline bool __i915_request_irq_complete(struct drm_i915_gem_request *req)
>   void i915_memcpy_init_early(struct drm_i915_private *dev_priv);
>   bool i915_memcpy_from_wc(void *dst, const void *src, unsigned long len);
>
> +#define ptr_mask_bits(ptr) ({						\
> +	unsigned long __v = (unsigned long)(ptr);			\
> +	(typeof(ptr))(__v & PAGE_MASK);					\
> +})
> +
>   #define ptr_unpack_bits(ptr, bits) ({					\
>   	unsigned long __v = (unsigned long)(ptr);			\
>   	(bits) = __v & ~PAGE_MASK;					\
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index a8d0f70c22f9..cffa57b14246 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2094,11 +2094,14 @@ i915_gem_object_put_pages(struct drm_i915_gem_object *obj)
>   	list_del(&obj->global_list);
>
>   	if (obj->mapping) {
> -		/* low bits are ignored by is_vmalloc_addr and kmap_to_page */
> -		if (is_vmalloc_addr(obj->mapping))
> -			vunmap(obj->mapping);
> +		void *ptr;
> +
> +		ptr = ptr_mask_bits(obj->mapping);
> +		if (is_vmalloc_addr(ptr))
> +			vunmap(ptr);
>   		else
> -			kunmap(kmap_to_page(obj->mapping));
> +			kunmap(kmap_to_page(ptr));
> +
>   		obj->mapping = NULL;
>   	}
>
>

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: vfree() no longer ignores the low bits of the address
  2016-08-18  9:01 [PATCH] drm/i915: vfree() no longer ignores the low bits of the address Chris Wilson
  2016-08-18  9:44 ` ✗ Ro.CI.BAT: failure for " Patchwork
  2016-08-18  9:45 ` [PATCH] " Tvrtko Ursulin
@ 2016-08-18 10:36 ` Joonas Lahtinen
  2 siblings, 0 replies; 4+ messages in thread
From: Joonas Lahtinen @ 2016-08-18 10:36 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On to, 2016-08-18 at 10:01 +0100, Chris Wilson wrote:
> Since vfree() now likes to WARN when passed a none page-aligned pointer,
> we need to discard the low bits to comply with it.
> 
> Fixes: d31d7cb1460c ("drm/i915: Support for creating write combined type vmaps")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-18 10:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-18  9:01 [PATCH] drm/i915: vfree() no longer ignores the low bits of the address Chris Wilson
2016-08-18  9:44 ` ✗ Ro.CI.BAT: failure for " Patchwork
2016-08-18  9:45 ` [PATCH] " Tvrtko Ursulin
2016-08-18 10:36 ` Joonas Lahtinen

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.