diff mbox series

drm/i915/selftests: do not try misaligned_pin test on unmappable memory

Message ID 20220825145211.22941-1-andrzej.hajda@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/selftests: do not try misaligned_pin test on unmappable memory | expand

Commit Message

Andrzej Hajda Aug. 25, 2022, 2:52 p.m. UTC
In case of Small BAR configurations stolen local memory can be unmappable.
Trying to test it causes -ENOSPC error from _i915_gem_object_stolen_init.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6565
Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Matthew Auld Aug. 25, 2022, 3:13 p.m. UTC | #1
On 25/08/2022 15:52, Andrzej Hajda wrote:
> In case of Small BAR configurations stolen local memory can be unmappable.
> Trying to test it causes -ENOSPC error from _i915_gem_object_stolen_init.
> 
> Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6565
> Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>

Ah right. That failure makes perfect sense now :)

> ---
>   drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> index fb5e6196347925..667c4c004bdbcf 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> @@ -1164,6 +1164,10 @@ static int misaligned_pin(struct i915_address_space *vm,
>   		if (hole_size < 3 * min_alignment)
>   			continue;
>   
> +		/* avoid -ENOSPC on unmappable memory */
> +		if (!mr->io_size)
> +			continue;

We could also pass I915_BO_ALLOC_GPU_ONLY when calling 
i915_gem_object_create_region(), since nothing actually needs to CPU 
access that memory, and then we still get coverage here for stolen? What 
do you think?

> +
>   		/* we can't test < 4k alignment due to flags being encoded in lower bits */
>   		if (min_alignment != I915_GTT_PAGE_SIZE_4K) {
>   			err = misaligned_case(vm, mr, addr + (min_alignment / 2), size, flags);
Andrzej Hajda Aug. 25, 2022, 3:21 p.m. UTC | #2
On 25.08.2022 17:13, Matthew Auld wrote:
> On 25/08/2022 15:52, Andrzej Hajda wrote:
>> In case of Small BAR configurations stolen local memory can be 
>> unmappable.
>> Trying to test it causes -ENOSPC error from 
>> _i915_gem_object_stolen_init.
>>
>> Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6565
>> Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
>
> Ah right. That failure makes perfect sense now :)
>
>> ---
>>   drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c 
>> b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
>> index fb5e6196347925..667c4c004bdbcf 100644
>> --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
>> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
>> @@ -1164,6 +1164,10 @@ static int misaligned_pin(struct 
>> i915_address_space *vm,
>>           if (hole_size < 3 * min_alignment)
>>               continue;
>>   +        /* avoid -ENOSPC on unmappable memory */
>> +        if (!mr->io_size)
>> +            continue;
>
> We could also pass I915_BO_ALLOC_GPU_ONLY when calling 
> i915_gem_object_create_region(), since nothing actually needs to CPU 
> access that memory, and then we still get coverage here for stolen? 
> What do you think?

I agree, I've just tested it successfully.

Regards
Andrzej


>
>> +
>>           /* we can't test < 4k alignment due to flags being encoded 
>> in lower bits */
>>           if (min_alignment != I915_GTT_PAGE_SIZE_4K) {
>>               err = misaligned_case(vm, mr, addr + (min_alignment / 
>> 2), size, flags);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index fb5e6196347925..667c4c004bdbcf 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -1164,6 +1164,10 @@  static int misaligned_pin(struct i915_address_space *vm,
 		if (hole_size < 3 * min_alignment)
 			continue;
 
+		/* avoid -ENOSPC on unmappable memory */
+		if (!mr->io_size)
+			continue;
+
 		/* we can't test < 4k alignment due to flags being encoded in lower bits */
 		if (min_alignment != I915_GTT_PAGE_SIZE_4K) {
 			err = misaligned_case(vm, mr, addr + (min_alignment / 2), size, flags);