diff mbox series

drm/i915/selftests: Unwind hugepages to drop wakeref on error

Message ID 20230113120053.29618-1-nirmoy.das@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/selftests: Unwind hugepages to drop wakeref on error | expand

Commit Message

Nirmoy Das Jan. 13, 2023, noon UTC
From: Chris Wilson <chris.p.wilson@linux.intel.com>

Make sure that upon error after we have acquired the wakeref we do
release it again.

Fixes: 027c38b4121e ("drm/i915/selftests: Grab the runtime pm in shrink_thp")
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Chris Wilson <chris.p.wilson@linux.intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
Cc: <stable@vger.kernel.org> # v6.0+
---
 drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Andi Shyti Jan. 16, 2023, 6:49 p.m. UTC | #1
Hi Nirmoy,

On Fri, Jan 13, 2023 at 01:00:53PM +0100, Nirmoy Das wrote:
> From: Chris Wilson <chris.p.wilson@linux.intel.com>
> 
> Make sure that upon error after we have acquired the wakeref we do
> release it again.
> 
> Fixes: 027c38b4121e ("drm/i915/selftests: Grab the runtime pm in shrink_thp")
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
> Signed-off-by: Chris Wilson <chris.p.wilson@linux.intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
> Cc: <stable@vger.kernel.org> # v6.0+
> ---
>  drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> index c281b0ec9e05..295d6f2cc4ff 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> @@ -1855,7 +1855,7 @@ static int igt_shrink_thp(void *arg)
>  			I915_SHRINK_ACTIVE);
>  	i915_vma_unpin(vma);
>  	if (err)
> -		goto out_put;
> +		goto out_wf;
>  
>  	/*
>  	 * Now that the pages are *unpinned* shrinking should invoke
> @@ -1871,7 +1871,7 @@ static int igt_shrink_thp(void *arg)
>  		pr_err("unexpected pages mismatch, should_swap=%s\n",
>  		       str_yes_no(should_swap));
>  		err = -EINVAL;
> -		goto out_put;
> +		goto out_wf;
>  	}

aren't we missing here one out_put -> out_wf change?

This one:

@@ -1878,7 +1878,7 @@ static int igt_shrink_thp(void *arg)
                pr_err("unexpected residual page-size bits, should_swap=%s\n",
                       str_yes_no(should_swap));
                err = -EINVAL;
-               goto out_put;
+               goto out_wf;
        }
 
        err = i915_vma_pin(vma, 0, 0, flags);

Andi

>  
>  	if (should_swap == (obj->mm.page_sizes.sg || obj->mm.page_sizes.phys)) {
> @@ -1883,7 +1883,7 @@ static int igt_shrink_thp(void *arg)
>  
>  	err = i915_vma_pin(vma, 0, 0, flags);
>  	if (err)
> -		goto out_put;
> +		goto out_wf;
>  
>  	while (n--) {
>  		err = cpu_check(obj, n, 0xdeadbeaf);
> -- 
> 2.39.0
Nirmoy Das Jan. 17, 2023, 8:57 a.m. UTC | #2
On 1/16/2023 7:49 PM, Andi Shyti wrote:
> Hi Nirmoy,
>
> On Fri, Jan 13, 2023 at 01:00:53PM +0100, Nirmoy Das wrote:
>> From: Chris Wilson <chris.p.wilson@linux.intel.com>
>>
>> Make sure that upon error after we have acquired the wakeref we do
>> release it again.
>>
>> Fixes: 027c38b4121e ("drm/i915/selftests: Grab the runtime pm in shrink_thp")
>> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
>> Signed-off-by: Chris Wilson <chris.p.wilson@linux.intel.com>
>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>> Cc: <stable@vger.kernel.org> # v6.0+
>> ---
>>   drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>> index c281b0ec9e05..295d6f2cc4ff 100644
>> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
>> @@ -1855,7 +1855,7 @@ static int igt_shrink_thp(void *arg)
>>   			I915_SHRINK_ACTIVE);
>>   	i915_vma_unpin(vma);
>>   	if (err)
>> -		goto out_put;
>> +		goto out_wf;
>>   
>>   	/*
>>   	 * Now that the pages are *unpinned* shrinking should invoke
>> @@ -1871,7 +1871,7 @@ static int igt_shrink_thp(void *arg)
>>   		pr_err("unexpected pages mismatch, should_swap=%s\n",
>>   		       str_yes_no(should_swap));
>>   		err = -EINVAL;
>> -		goto out_put;
>> +		goto out_wf;
>>   	}
> aren't we missing here one out_put -> out_wf change?
>
> This one:
>
> @@ -1878,7 +1878,7 @@ static int igt_shrink_thp(void *arg)
>                  pr_err("unexpected residual page-size bits, should_swap=%s\n",
>                         str_yes_no(should_swap));
>                  err = -EINVAL;
> -               goto out_put;
> +               goto out_wf;


Thanks for catching this. Yes, we need this too. I will resend.


Nirmoy

>          }
>   
>          err = i915_vma_pin(vma, 0, 0, flags);
>
> Andi
>
>>   
>>   	if (should_swap == (obj->mm.page_sizes.sg || obj->mm.page_sizes.phys)) {
>> @@ -1883,7 +1883,7 @@ static int igt_shrink_thp(void *arg)
>>   
>>   	err = i915_vma_pin(vma, 0, 0, flags);
>>   	if (err)
>> -		goto out_put;
>> +		goto out_wf;
>>   
>>   	while (n--) {
>>   		err = cpu_check(obj, n, 0xdeadbeaf);
>> -- 
>> 2.39.0
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
index c281b0ec9e05..295d6f2cc4ff 100644
--- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
+++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
@@ -1855,7 +1855,7 @@  static int igt_shrink_thp(void *arg)
 			I915_SHRINK_ACTIVE);
 	i915_vma_unpin(vma);
 	if (err)
-		goto out_put;
+		goto out_wf;
 
 	/*
 	 * Now that the pages are *unpinned* shrinking should invoke
@@ -1871,7 +1871,7 @@  static int igt_shrink_thp(void *arg)
 		pr_err("unexpected pages mismatch, should_swap=%s\n",
 		       str_yes_no(should_swap));
 		err = -EINVAL;
-		goto out_put;
+		goto out_wf;
 	}
 
 	if (should_swap == (obj->mm.page_sizes.sg || obj->mm.page_sizes.phys)) {
@@ -1883,7 +1883,7 @@  static int igt_shrink_thp(void *arg)
 
 	err = i915_vma_pin(vma, 0, 0, flags);
 	if (err)
-		goto out_put;
+		goto out_wf;
 
 	while (n--) {
 		err = cpu_check(obj, n, 0xdeadbeaf);