drm/i915: limit PPGTT size to 2GB in 32-bit platforms
Subsystems (2)
PATCH 1/1 drm/i915: limit PPGTT size to 2GB in 32-bit platforms
We already set this limit for the GGTT.
This is a temporary patch until a full replacement of size_t variables (inadequate in 32-bit kernel) is in place.
Regression from:
commit a4e0bedca678c81eea4cd79a4bd502335639f73a Author: Michel Thierry <[email protected]> Date: Wed Apr 8 12:13:35 2015 +0100 drm/i915: Use complete address space in true PPGTT
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/i915_gem_gtt.c +8 -0
@@ -951,7 +951,15 @@ static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt)gen8_initialize_pd (&ppgtt->base, ppgtt->scratch_pd); ppgtt->base.start =0 ; + +#ifdef CONFIG_X86_32 +/* Limit 32b platforms to GGTT size (2GB) */ +struct drm_i915_private *dev_priv = ppgtt->base.dev->dev_private; + + ppgtt->base.total = dev_priv->gtt.base.total; +#else ppgtt->base.total =1ULL <<32 ; +#endif ppgtt->base.cleanup = gen8_ppgtt_cleanup; ppgtt->base.allocate_va_range = gen8_alloc_va_range; ppgtt->base.insert_entries = gen8_ppgtt_insert_entries;
Signature · 6 lines
2.4.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 24 lines · Michel Thierry
We already set this limit for the GGTT.
This is a temporary patch until a full replacement of
size_tvariables (inadequate in 32-bit kernel) is in place.Regression from:
commit a4e0bedca678c81eea4cd79a4bd502335639f73a Author: Michel Thierry <[email protected]> Date: Wed Apr 8 12:13:35 2015 +0100 drm/i915: Use complete address space in true PPGTTSuggested-by Daniel Vetter <[email protected]>Cc Mika Kuoppala <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 956
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +3
-0@@ -951,7 +951,15 @@ static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt)gen8_initialize_pd (&ppgtt->base, ppgtt->scratch_pd); ppgtt->base.start =0 ; + +#ifdef CONFIG_X86_32 +/* Limit 32b platforms to GGTT size (2GB) */
Forgot the comment about why the limit is inplace and when it can be lifted. Remember comments are for *why* not *what*.
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 957
Quoted 1 line
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-0+struct drm_i915_private *dev_priv = ppgtt->base.dev->dev_private;
Fancy new fangled C.
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 959
Quoted 1 line
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-0+ ppgtt->base.total = dev_priv->gtt.base.total;
ppgtt->base.total = to_i915(ppgtt->base.dev)->gtt.base.total;
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 962
Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0+#else ppgtt->base.total =1ULL <<32 ; +#endif
Better yet would be:
ppgtt->base.total = 1ULL << 32;
if (IS_ENABLED(CONFIG_X86_32)) {
/* While we have a proliferation of size_t variables
* we cannot represent the full ppgtt size on 32bit,
* so limit it to the same size as the GGTT (currently
* 2GiB).
*/
ppgtt->base.total = to_i915(ppgtt->base.dev)->gtt.base.total;
}However, I am afraid that it will become obsolete but be forgotten to be removed.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 54 lines · Chris Wilson
Quoted 24 lines · Michel Thierry
We already set this limit for the GGTT.
This is a temporary patch until a full replacement of
size_tvariables (inadequate in 32-bit kernel) is in place.Regression from:
commit a4e0bedca678c81eea4cd79a4bd502335639f73a Author: Michel Thierry <[email protected]> Date: Wed Apr 8 12:13:35 2015 +0100 drm/i915: Use complete address space in true PPGTTSuggested-by Daniel Vetter <[email protected]>Cc Mika Kuoppala <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 956
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +3
-0@@ -951,7 +951,15 @@ static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt)gen8_initialize_pd (&ppgtt->base, ppgtt->scratch_pd); ppgtt->base.start =0 ; + +#ifdef CONFIG_X86_32 +/* Limit 32b platforms to GGTT size (2GB) */ Forgot the comment about why the limit is inplace and when it can be lifted. Remember comments are for *why* not *what*.
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 957
Quoted 1 line
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-0+struct drm_i915_private *dev_priv = ppgtt->base.dev->dev_private;Fancy new fangled C.
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 959
Quoted 1 line
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-0+ ppgtt->base.total = dev_priv->gtt.base.total;ppgtt->base.total = to_i915(ppgtt->base.dev)->gtt.base.total;drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 962
Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0+#else ppgtt->base.total =1ULL <<32 ; +#endif Better yet would be:
ppgtt->base.total = 1ULL << 32; if (IS_ENABLED(CONFIG_X86_32)) { /* While we have a proliferation of size_t variables * we cannot represent the full ppgtt size on 32bit, * so limit it to the same size as the GGTT (currently * 2GiB). */ ppgtt->base.total = to_i915(ppgtt->base.dev)->gtt.base.total; }
Quoted 2 lines
However, I am afraid that it will become obsolete but be forgotten to be removed.
Yes, this is just for 4.2, Mika started working on a patch to replace the size_t variables. I'll update this with your changes.
Thanks,
Quoted 2 lines
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/i915: limit PPGTT size to 2GB in 32-bit platforms
In reply to Michel ThierryAnd prevent overflow warning during compilation. We already set this limit for the GGTT.
This is a temporary patch until a full replacement of size_t variables (inadequate in 32-bit kernel) is in place.
Regression from:
commit a4e0bedca678c81eea4cd79a4bd502335639f73a Author: Michel Thierry <[email protected]> Date: Wed Apr 8 12:13:35 2015 +0100 drm/i915: Use complete address space in true PPGTT
v2: Prettify code and explain why this is needed. (Chris)
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +10 -1
@@ -951,7 +951,16 @@ static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt)gen8_initialize_pd (&ppgtt->base, ppgtt->scratch_pd); ppgtt->base.start =0 ; - ppgtt->base.total =1ULL <<32 ; +#ifdef CONFIG_X86_32 +/* While we have a proliferation of size_t variables +* we cannot represent the full ppgtt size on 32bit, +* so limit it to the same size as the GGTT (currently +* 2GiB). +*/ + ppgtt->base.total =to_i915 (ppgtt->base.dev)->gtt.base.total; +#else + ppgtt->base.total =1ULL <<32 ; +#endif ppgtt->base.cleanup = gen8_ppgtt_cleanup; ppgtt->base.allocate_va_range = gen8_alloc_va_range; ppgtt->base.insert_entries = gen8_ppgtt_insert_entries;
Signature · 6 lines
2.4.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 28 lines · Michel Thierry
And prevent overflow warning during compilation. We already set this limit for the GGTT.
This is a temporary patch until a full replacement of
size_tvariables (inadequate in 32-bit kernel) is in place.Regression from:
commit a4e0bedca678c81eea4cd79a4bd502335639f73a Author: Michel Thierry <[email protected]> Date: Wed Apr 8 12:13:35 2015 +0100 drm/i915: Use complete address space in true PPGTTv2: Prettify code and explain why this is needed. (Chris)
Suggested-by Daniel Vetter <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 954
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-1@@ -951,7 +951,16 @@ static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt)gen8_initialize_pd (&ppgtt->base, ppgtt->scratch_pd); ppgtt->base.start =0 ; - ppgtt->base.total =1ULL <<32 ; +#ifdef CONFIG_X86_32
FWIW, this is somewhat frowned upon (which is why Chris was using IS_ENABLED(). It's documented in Documentation/CodingStyle, Chapter 20.
Within code, where possible, use the IS_ENABLED macro to convert a Kconfig symbol into a C boolean expression, and use it in a normal C conditional:
if (IS_ENABLED(CONFIG_SOMETHING)) {
...
} The compiler will constant-fold the conditional away, and include or exclude the block of code just as with an #ifdef, so this will not add any runtime overhead. However, this approach still allows the C compiler to see the code inside the block, and check it for correctness (syntax, types, symbol references, etc). Thus, you still have to use an #ifdef if the code inside the block references symbols that will not exist if the condition is not met.
Signature · 5 lines
Damien _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 33 lines · Michel Thierry
And prevent overflow warning during compilation. We already set this limit for the GGTT.
This is a temporary patch until a full replacement of
size_tvariables (inadequate in 32-bit kernel) is in place.Regression from:
commit a4e0bedca678c81eea4cd79a4bd502335639f73a Author: Michel Thierry <[email protected]> Date: Wed Apr 8 12:13:35 2015 +0100 drm/i915: Use complete address space in true PPGTTv2: Prettify code and explain why this is needed. (Chris)
Suggested-by Daniel Vetter <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-1@@ -951,7 +951,16 @@ static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt)gen8_initialize_pd (&ppgtt->base, ppgtt->scratch_pd); ppgtt->base.start =0 ; - ppgtt->base.total =1ULL <<32 ;
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 964
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +10
-0+#ifdef CONFIG_X86_32 +/* While we have a proliferation of size_t variables +* we cannot represent the full ppgtt size on 32bit, +* so limit it to the same size as the GGTT (currently +* 2GiB). +*/ + ppgtt->base.total =to_i915 (ppgtt->base.dev)->gtt.base.total; +#else + ppgtt->base.total =1ULL <<32 ; +#endif
You missed the point of having it always compiled. Part of that is that the compiler warning here is important.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 31 lines · Chris Wilson
Quoted 30 lines · Michel Thierry
And prevent overflow warning during compilation. We already set this limit for the GGTT.
This is a temporary patch until a full replacement of
size_tvariables (inadequate in 32-bit kernel) is in place.Regression from:
commit a4e0bedca678c81eea4cd79a4bd502335639f73a Author: Michel Thierry <[email protected]> Date: Wed Apr 8 12:13:35 2015 +0100 drm/i915: Use complete address space in true PPGTTv2: Prettify code and explain why this is needed. (Chris)
Suggested-by Daniel Vetter <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -951,7 +951,16 @@ static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt)gen8_initialize_pd (&ppgtt->base, ppgtt->scratch_pd);
Quoted 15 lines
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 963
Quoted 12 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +10
-1ppgtt->base.start =0 ; - ppgtt->base.total =1ULL <<32 ; +#ifdef CONFIG_X86_32 +/* While we have a proliferation of size_t variables +* we cannot represent the full ppgtt size on 32bit, +* so limit it to the same size as the GGTT (currently +* 2GiB). +*/ + ppgtt->base.total =to_i915 (ppgtt->base.dev)->gtt.base.total; +#else + ppgtt->base.total =1ULL <<32 ; +#endif You missed the point of having it always compiled. Part of that is that the compiler warning here is important.
-Chris
I was under the impression that Daniel wanted to get rid of the warning too, that's why I didn't use IS_ENABLED().
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 46 lines · Michel Thierry
Quoted 37 lines · Chris Wilson
Quoted 36 lines · Michel Thierry
And prevent overflow warning during compilation. We already set this limit for the GGTT.
This is a temporary patch until a full replacement of
size_tvariables (inadequate in 32-bit kernel) is in place.Regression from:
commit a4e0bedca678c81eea4cd79a4bd502335639f73a Author: Michel Thierry <[email protected]> Date: Wed Apr 8 12:13:35 2015 +0100 drm/i915: Use complete address space in true PPGTTv2: Prettify code and explain why this is needed. (Chris)
Suggested-by Daniel Vetter <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_gem_gtt.c +5
-1@@ -951,7 +951,16 @@ static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt)gen8_initialize_pd (&ppgtt->base, ppgtt->scratch_pd); ppgtt->base.start =0 ; - ppgtt->base.total =1ULL <<32 ; +#ifdef CONFIG_X86_32 +/* While we have a proliferation of size_t variables +* we cannot represent the full ppgtt size on 32bit, +* so limit it to the same size as the GGTT (currently +* 2GiB). Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) · line 963
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +5
-0+*/ + ppgtt->base.total =to_i915 (ppgtt->base.dev)->gtt.base.total; +#else + ppgtt->base.total =1ULL <<32 ; +#endif You missed the point of having it always compiled. Part of that is that the compiler warning here is important.
-Chris
Quoted 2 lines
I was under the impression that Daniel wanted to get rid of the warning too, that's why I didn't use
IS_ENABLED().
It's bad form to have the #ifdef inside code, and in this case the warning is good - it is a clear indicator that we have a large hole in the code that I don't just want to sweep under the carpet. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 1/1 drm/i915: limit PPGTT size to 2GB in 32-bit platforms
In reply to Michel ThierryWe already set this limit for the GGTT.
This is a temporary patch until a full replacement of size_t variables (inadequate in 32-bit kernel) is in place.
Regression from:
commit a4e0bedca678c81eea4cd79a4bd502335639f73a Author: Michel Thierry <[email protected]> Date: Wed Apr 8 12:13:35 2015 +0100 drm/i915: Use complete address space in true PPGTT
v2: Prettify code and explain why this is needed. (Chris)
v3: Don't hide the compilation warning in 32-bit. (Chris)
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_gem_gtt.c +7 -0
@@ -952,6 +952,13 @@ static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) ppgtt->base.start =0 ; ppgtt->base.total =1ULL <<32 ; +if (IS_ENABLED (CONFIG_X86_32 )) +/* While we have a proliferation of size_t variables +* we cannot represent the full ppgtt size on 32bit, +* so limit it to the same size as the GGTT (currently +* 2GiB). +*/ + ppgtt->base.total =to_i915 (ppgtt->base.dev)->gtt.base.total; ppgtt->base.cleanup = gen8_ppgtt_cleanup; ppgtt->base.allocate_va_range = gen8_alloc_va_range; ppgtt->base.insert_entries = gen8_ppgtt_insert_entries;
Signature · 6 lines
2.4.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter
AppliedQuoted 12 lines · Michel Thierry
We already set this limit for the GGTT.
This is a temporary patch until a full replacement of
size_tvariables (inadequate in 32-bit kernel) is in place.Regression from:
commit a4e0bedca678c81eea4cd79a4bd502335639f73a Author: Michel Thierry <[email protected]> Date: Wed Apr 8 12:13:35 2015 +0100 drm/i915: Use complete address space in true PPGTT
Quoted 7 lines
v2: Prettify code and explain why this is needed. (Chris)
v3: Don't hide the compilation warning in 32-bit. (Chris)Suggested-by Daniel Vetter <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Michel Thierry <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Quoted 29 lines
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/i915/i915_gem_gtt.c +7
-0@@ -952,6 +952,13 @@ static int gen8_ppgtt_init(struct i915_hw_ppgtt *ppgtt) ppgtt->base.start =0 ; ppgtt->base.total =1ULL <<32 ; +if (IS_ENABLED (CONFIG_X86_32 )) +/* While we have a proliferation of size_t variables +* we cannot represent the full ppgtt size on 32bit, +* so limit it to the same size as the GGTT (currently +* 2GiB). +*/ + ppgtt->base.total =to_i915 (ppgtt->base.dev)->gtt.base.total; ppgtt->base.cleanup = gen8_ppgtt_cleanup; ppgtt->base.allocate_va_range = gen8_alloc_va_range; ppgtt->base.insert_entries = gen8_ppgtt_insert_entries;Signature · 6 lines
2.4.0 _______________________________________________ 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