drm/i915/gen8: page directories rework allocation
Subsystems (2)
Hi Michel,
The patch 69876bed7e00: "drm/i915/gen8: page directories rework allocation" from Apr 8, 2015, has the following issue:
drivers/gpu/drm/i915/i915_gem_gtt.c:760 warn: too many zeroes
drivers/gpu/drm/i915/i915_gem_gtt.c
746 static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt,
747 struct i915_page_directory_pointer *pdp,
748 uint64_t start,
749 uint64_t length,
750 unsigned long *new_pds)
751 {
752 struct drm_device *dev = ppgtt->base.dev;
753 struct i915_page_directory *pd;
754 uint64_t temp;
755 uint32_t pdpe;
756
757 WARN_ON(!bitmap_empty(new_pds, GEN8_LEGACY_PDPES));
758
759 /* FIXME: PPGTT container_of won't work for 64b */
760 WARN_ON((start + length) > 0x800000000ULL);
^This last zero was not intended.
761
762 gen8_for_each_pdpe(pd, pdp, start, length, temp, pdpe) {
763 if (pd)
764 continue;
765
766 pd = alloc_pd_single(dev);
767 if (IS_ERR(pd))
768 goto unwind_out;
769
770 gen8_initialize_pd(&ppgtt->base, pd);
771 pdp->page_directory[pdpe] = pd;
772 set_bit(pdpe, new_pds);
773 }
774
775 return 0;
776
777 unwind_out:
778 for_each_set_bit(pdpe, new_pds, GEN8_LEGACY_PDPES)
779 unmap_and_free_pd(pdp->page_directory[pdpe], dev);
780
781 return -ENOMEM;
782 }regards,
dan carpenter
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 25 lines · Dan Carpenter
Hi Michel,
The patch
69876bed7e00: "drm/i915/gen8: page directories rework allocation" from Apr 8, 2015, has the following issue:drivers/gpu/drm/i915/i915_gem_gtt.c:760 warn: too many zeroes
drivers/gpu/drm/i915/i915_gem_gtt.c
746 static int gen8_ppgtt_alloc_page_directories(structi915_hw_ppgtt*ppgtt,747 struct i915_page_directory_pointer *pdp, 748 uint64_t start, 749 uint64_t length, 750 unsigned long *new_pds) 751 { 752 struct drm_device *dev = ppgtt->base.dev; 753 struct i915_page_directory *pd; 754 uint64_t temp; 755 uint32_t pdpe; 756 757 WARN_ON(!bitmap_empty(new_pds, GEN8_LEGACY_PDPES)); 758 759 /* FIXME: PPGTT container_of won't work for 64b */ 760 WARN_ON((start + length) > 0x800000000ULL); ^
Quoted 1 line
This last zero was not intended.
Wouldn't (1ULL << 31) be clearer?
And shouldn't it be >= not > ?
Or perhaps,
/* FIXME: upper bound must not overflow 31 bits */ WARN_ON((start + length) & (~0ULL << 31));
Pick whichever you think is most comprehensible and least typo-prone!
.Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/i915: Fix 32b overflow check in gen8_ppgtt_alloc_page_directories
In reply to Dan CarpenterThe patch 69876bed7e008f5fe01538a2d47c09f2862129d0: "drm/i915/gen8:
page directories rework allocation" added an overflow warning, but the mask had an extra 0. Use typo-prone option suggested by Dave instead.
This check will be unnecessary after gen8_alloc_va_range handles more than 4 PDPs (48b addressing).
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -2
@@ -756,8 +756,8 @@ static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt,WARN_ON (!bitmap_empty (new_pds,GEN8_LEGACY_PDPES )); -/* FIXME: PPGTT container_of won't work for 64b */ -WARN_ON ((start + length) >0x800000000ULL ); +/* FIXME: upper bound must not overflow 31 bits */ +WARN_ON ((start + length) & (~0ULL <<31 ));gen8_for_each_pdpe (pd, pdp, start, length, temp, pdpe) {if (pd)
Signature · 6 lines
2.1.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Fix 32b overflow check in gen8_ppgtt_alloc_page_directories
Quoted 19 lines · Michel Thierry
The patch
69876bed7e008f5fe01538a2d47c09f2862129d0: "drm/i915/gen8:
page directories rework allocation" added an overflow warning, but the mask had an extra 0. Use typo-prone option suggested by Dave instead.This check will be unnecessary after
gen8_alloc_va_rangehandles more than 4 PDPs (48b addressing).Reported-by Dan Carpenter <[email protected]>Cc Dave Gordon <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt, · line 760
Quoted 7 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-2@@ -756,8 +756,8 @@ static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt,WARN_ON (!bitmap_empty (new_pds,GEN8_LEGACY_PDPES )); -/* FIXME: PPGTT container_of won't work for 64b */ -WARN_ON ((start + length) >0x800000000ULL ); +/* FIXME: upper bound must not overflow 31 bits */ +WARN_ON ((start + length) & (~0ULL <<31 ));
Why is it 31 and not 32?
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0gen8_for_each_pdpe (pd, pdp, start, length, temp, pdpe) {if (pd)Signature · 6 lines
2.1.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Fix 32b overflow check in gen8_ppgtt_alloc_page_directories
Quoted 21 lines · Ville Syrjälä
Quoted 20 lines · Michel Thierry
The patch
69876bed7e008f5fe01538a2d47c09f2862129d0: "drm/i915/gen8:
page directories rework allocation" added an overflow warning, but the mask had an extra 0. Use typo-prone option suggested by Dave instead.This check will be unnecessary after
gen8_alloc_va_rangehandles more than 4 PDPs (48b addressing).Reported-by Dan Carpenter <[email protected]>Cc Dave Gordon <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -756,8 +756,8 @@ static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt,
Quoted 9 lines
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt, · line 760
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-2WARN_ON (!bitmap_empty (new_pds,GEN8_LEGACY_PDPES )); -/* FIXME: PPGTT container_of won't work for 64b */ -WARN_ON ((start + length) >0x800000000ULL ); +/* FIXME: upper bound must not overflow 31 bits */ +WARN_ON ((start + length) & (~0ULL <<31 ));Why is it 31 and not 32?
Right, the check really should be (start + length) >= 0x100000000ULL.
Quoted 11 lines
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0
-1gen8_for_each_pdpe (pd, pdp, start, length, temp, pdpe) {if (pd) --2.1.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Fix 32b overflow check in gen8_ppgtt_alloc_page_directories
Quoted 26 lines · Michel Thierry
Quoted 25 lines · Ville Syrjälä
Quoted 24 lines · Michel Thierry
The patch
69876bed7e008f5fe01538a2d47c09f2862129d0: "drm/i915/gen8:
page directories rework allocation" added an overflow warning, but the mask had an extra 0. Use typo-prone option suggested by Dave instead.This check will be unnecessary after
gen8_alloc_va_rangehandles more than 4 PDPs (48b addressing).Reported-by Dan Carpenter <[email protected]>Cc Dave Gordon <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -756,8 +756,8 @@ static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt, WARN_ON(!bitmap_empty(new_pds, GEN8_LEGACY_PDPES));
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt, · line 760
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-2-/* FIXME: PPGTT container_of won't work for 64b */ -WARN_ON ((start + length) >0x800000000ULL ); +/* FIXME: upper bound must not overflow 31 bits */ +WARN_ON ((start + length) & (~0ULL <<31 ));Why is it 31 and not 32?
Right, the check really should be (start + length) >=
0x100000000ULL.
Something with '32' in it might be more obvious and save anyone having to count the zeroes ... and a comment that also mentioned the limit:
/* FIXME: for now, upper bound must fit in 32 bits */ WARN_ON((start + length) >= (1ULL << 32)) WARN_ON((start + length) & (~0ULL << 32)) WARN_ON((start + length) >> 32) != 0)
.Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Fix 32b overflow check in gen8_ppgtt_alloc_page_directories
Quoted 36 lines · Dave Gordon
Quoted 26 lines · Michel Thierry
Quoted 25 lines · Ville Syrjälä
Quoted 24 lines · Michel Thierry
The patch
69876bed7e008f5fe01538a2d47c09f2862129d0: "drm/i915/gen8:
page directories rework allocation" added an overflow warning, but the mask had an extra 0. Use typo-prone option suggested by Dave instead.This check will be unnecessary after
gen8_alloc_va_rangehandles more than 4 PDPs (48b addressing).Reported-by Dan Carpenter <[email protected]>Cc Dave Gordon <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -756,8 +756,8 @@ static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt, WARN_ON(!bitmap_empty(new_pds, GEN8_LEGACY_PDPES));Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt, · line 760
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-2-/* FIXME: PPGTT container_of won't work for 64b */ -WARN_ON ((start + length) >0x800000000ULL ); +/* FIXME: upper bound must not overflow 31 bits */ +WARN_ON ((start + length) & (~0ULL <<31 ));Why is it 31 and not 32?
Right, the check really should be (start + length) >=
0x100000000ULL.
Quoted 8 lines
Something with '32' in it might be more obvious and save anyone having to count the zeroes ... and a comment that also mentioned the limit:
/* FIXME: for now, upper bound must fit in 32 bits */ WARN_ON((start + length) >= (1ULL << 32)) WARN_ON((start + length) & (~0ULL << 32)) WARN_ON((start + length) >> 32) != 0)
Yes, I was planning to just replace _31_ with _32_ and avoid all those zeroes...
Quoted 3 lines
.Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Fix 32b overflow check in gen8_ppgtt_alloc_page_directories
In reply to Dave GordonQuoted 34 lines · Dave Gordon
Quoted 33 lines · Michel Thierry
Quoted 31 lines · Ville Syrjälä
Quoted 20 lines · Michel Thierry
The patch
69876bed7e008f5fe01538a2d47c09f2862129d0: "drm/i915/gen8:
page directories rework allocation" added an overflow warning, but the mask had an extra 0. Use typo-prone option suggested by Dave instead.This check will be unnecessary after
gen8_alloc_va_rangehandles more than 4 PDPs (48b addressing).Reported-by Dan Carpenter <[email protected]>Cc Dave Gordon <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0drivers/gpu/drm/i915/i915_gem_gtt.c static int · line 761
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-2@@ -756,8 +756,8 @@ static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt, WARN_ON(!bitmap_empty(new_pds, GEN8_LEGACY_PDPES)); -/* FIXME: PPGTT container_of won't work for 64b */ -WARN_ON ((start + length) >0x800000000ULL ); +/* FIXME: upper bound must not overflow 31 bits */ +WARN_ON ((start + length) & (~0ULL <<31 ));Why is it 31 and not 32?
Quoted 8 lines
Quoted 1 line
Right, the check really should be (start + length) >=
0x100000000ULL.Something with '32' in it might be more obvious and save anyone having to count the zeroes ... and a comment that also mentioned the limit:
/* FIXME: for now, upper bound must fit in 32 bits */ WARN_ON((start + length) >= (1ULL << 32))
This would match the '1ULL<<32' used in the ppgtt init.
Quoted 4 lines
WARN_ON((start + length) & (~0ULL << 32)) WARN_ON((start + length) >> 32) != 0).Dave.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/i915: Fix 32b overflow check in gen8_ppgtt_alloc_page_directories
In reply to Dan CarpenterThe patch 69876bed7e008f5fe01538a2d47c09f2862129d0: "drm/i915/gen8:
page directories rework allocation" added an overflow warning, but the mask had an extra 0. Use typo-prone option suggested by Dave instead, to check for (start + length) >= 0x100000000ULL.
This check will be unnecessary after gen8_alloc_va_range handles more than 4 PDPs (48b addressing).
v2: Really check for 32b overflow (Ville)
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -2
@@ -756,8 +756,8 @@ static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt,WARN_ON (!bitmap_empty (new_pds,GEN8_LEGACY_PDPES )); -/* FIXME: PPGTT container_of won't work for 64b */ -WARN_ON ((start + length) >0x800000000ULL ); +/* FIXME: upper bound must not overflow 32 bits */ +WARN_ON ((start + length) >= (1ULL <<32 ));gen8_for_each_pdpe (pd, pdp, start, length, temp, pdpe) {if (pd)
Signature · 6 lines
2.1.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Fix 32b overflow check in gen8_ppgtt_alloc_page_directories
In reply to Michel ThierryTask id: 6299 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV 276/276 276/276 ILK 302/302 302/302 SNB 316/316 316/316 IVB 264/264 264/264
BYT -3 227/227 224/227
BDW 318/318 318/318
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*BYT igt@gem_dummy_reloc_loop@render FAIL(1)PASS(18) TIMEOUT(1)PASS(1)
*BYT igt@gem_exec_parse@bitmasks FAIL(1)PASS(7) DMESG_WARN(1)PASS(1)
(dmesg patch applied)drm:check_crtc_state[i915]]*ERROR*mismatch_in_has_infoframe(expected#,found#)@mismatch in has_infoframe .* found WARNING:at_drivers/gpu/drm/i915/intel_display.c:#check_crtc_state[i915]()@WARNING:.* at .* check_crtc_state+0x
BYT igt@gem_pipe_control_store_loop@fresh-buffer FAIL(1)TIMEOUT(10)PASS(9) TIMEOUT(2)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2] drm/i915: Fix 32b overflow check in gen8_ppgtt_alloc_page_directories
In reply to Michel ThierryTask id: 6300 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV 276/276 276/276 ILK 302/302 302/302 SNB 316/316 316/316 IVB 264/264 264/264
BYT -3 227/227 224/227
BDW 318/318 318/318
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*BYT igt@gem_dummy_reloc_loop@render FAIL(1)PASS(18) TIMEOUT(1)PASS(1) BYT igt@gem_pipe_control_store_loop@fresh-buffer FAIL(1)TIMEOUT(10)PASS(9) TIMEOUT(1)PASS(1) *BYT igt@gem_threaded_access_tiled FAIL(1)PASS(6) DMESG_WARN(1)PASS(1)
(dmesg patch applied)drm:check_crtc_state[i915]]*ERROR*mismatch_in_has_infoframe(expected#,found#)@mismatch in has_infoframe .* found WARNING:at_drivers/gpu/drm/i915/intel_display.c:#check_crtc_state[i915]()@WARNING:.* at .* check_crtc_state+0x
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Fix 32b overflow check in gen8_ppgtt_alloc_page_directories
In reply to Michel ThierryQuoted 3 lines · Michel Thierry
The patch
69876bed7e008f5fe01538a2d47c09f2862129d0: "drm/i915/gen8:
page directories rework allocation" added an overflow warning, but the mask had an extra 0. Use typo-prone option suggested by Dave instead.
I think you mean "less typo-prone" here :)
Kind regards, David Weinehall
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter
AppliedRe: [PATCH v2] drm/i915: Fix 32b overflow check in gen8_ppgtt_alloc_page_directories
In reply to Michel ThierryQuoted 3 lines · Michel Thierry
The patch
69876bed7e008f5fe01538a2d47c09f2862129d0: "drm/i915/gen8:
page directories rework allocation" added an overflow warning, but the mask had an extra 0. Use typo-prone option suggested by Dave instead,
I inserted the "less" above while applying.
Quoted 11 lines
to check for (start + length) >=
0x100000000ULL.This check will be unnecessary after
gen8_alloc_va_rangehandles more than 4 PDPs (48b addressing).v2: Really check for 32b overflow (Ville)
Reported-by Dan Carpenter <[email protected]>Cc Dave Gordon <[email protected]>Cc Ville Syrjälä <[email protected]>Signed-off-by Michel Thierry <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Quoted 26 lines
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +2
-2@@ -756,8 +756,8 @@ static int gen8_ppgtt_alloc_page_directories(struct i915_hw_ppgtt *ppgtt,WARN_ON (!bitmap_empty (new_pds,GEN8_LEGACY_PDPES )); -/* FIXME: PPGTT container_of won't work for 64b */ -WARN_ON ((start + length) >0x800000000ULL ); +/* FIXME: upper bound must not overflow 32 bits */ +WARN_ON ((start + length) >= (1ULL <<32 ));gen8_for_each_pdpe (pd, pdp, start, length, temp, pdpe) {if (pd)Signature · 6 lines
2.1.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx