Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	<apoorva.singh@intel.com>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe: Check return values of functions in xe_gt_shutdown()
Date: Mon, 30 Sep 2024 12:51:28 +0530	[thread overview]
Message-ID: <609359e0-8b88-4ec7-9cea-33faf2625918@intel.com> (raw)
In-Reply-To: <9744a79e-17cc-4830-ac48-0b783d99ed8f@intel.com>



On 26-09-2024 16:49, Ghimiray, Himal Prasad wrote:
> 
> 
> On 26-09-2024 16:41, Maarten Lankhorst wrote:
>> Hey,
>>
>> Den 2024-09-26 kl. 13:00, skrev apoorva.singh@intel.com:
>>> From: Apoorva Singh <apoorva.singh@intel.com>
>>>
>>> Check the return values of the functions xe_force_wake_get()
>>> and xe_force_wake_put() to prevent mistakenly treating them as
>>> void returns.
>>>
>>> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
>>> Signed-off-by: Apoorva Singh <apoorva.singh@intel.com>
>>> Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
>>> ---
>>>   drivers/gpu/drm/xe/xe_gt.c | 7 +++++--
>>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
>>> index 274737417b0f..317640554310 100644
>>> --- a/drivers/gpu/drm/xe/xe_gt.c
>>> +++ b/drivers/gpu/drm/xe/xe_gt.c
>>> @@ -890,9 +890,12 @@ int xe_gt_suspend(struct xe_gt *gt)
>>>   void xe_gt_shutdown(struct xe_gt *gt)
>>>   {
>>> -    xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
>>> +    int err;

Nit. Add blank line before merge.

>>> +    err = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
>>> +    xe_gt_WARN(gt, err, "Acknowledgment for domain awake timedout");
>>>       do_gt_reset(gt);
>>> -    xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
>>> +    err = xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
>>> +    xe_gt_WARN(gt, err, "Acknowledgment for domain sleep timedout");
>>>   }
>>
>> There's absolutely nothing we can do with xe_force_wake_put, the only 
>> thing you can do here is:
>>
>> int ret = xe_force_wake_get(..);
>> do_gt_reset;
>> if (!ret)
>> xe_force_wake_put
> 
> This is wrong in current scenario. force_wake_get() fails but it still 
> increases refcount. So xe_force_wake_put needs to be called here to 
> decrease the refcount. I am already working on solving the problem in 
> entire driver.
> 
> https://lore.kernel.org/intel-xe/20240924121641.1045763-1- 
> himal.prasad.ghimiray@intel.com/T/#t
> 
>>
>> Also no point in complaining, the hardware may already be hosed. :)
>>
>> I believe that xe_force_wake_put should return void, there's nothing 
>> we can do except log the error here.
> 
> Agreed. Above series covers same too.
> 
>>
>> Cheers,
>> Maarten
> 


  reply	other threads:[~2024-09-30  7:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26 11:00 [PATCH] drm/xe: Check return values of functions in xe_gt_shutdown() apoorva.singh
2024-09-26 11:11 ` Maarten Lankhorst
2024-09-26 11:19   ` Ghimiray, Himal Prasad
2024-09-30  7:21     ` Ghimiray, Himal Prasad [this message]
2024-09-26 18:25 ` ✓ CI.Patch_applied: success for drm/xe: Check return values of functions in xe_gt_shutdown() (rev3) Patchwork
2024-09-26 18:25 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-26 18:26 ` ✓ CI.KUnit: success " Patchwork
2024-09-26 18:38 ` ✓ CI.Build: " Patchwork
2024-09-26 18:40 ` ✓ CI.Hooks: " Patchwork
2024-09-26 18:42 ` ✓ CI.checksparse: " Patchwork
2024-09-26 19:07 ` ✓ CI.BAT: " Patchwork
2024-09-27 19:12 ` ✗ CI.FULL: failure " Patchwork
2024-09-30 21:26 ` [PATCH] drm/xe: Check return values of functions in xe_gt_shutdown() Matt Roper
  -- strict thread matches above, loose matches on Subject: below --
2024-09-23 11:06 apoorva.singh
2024-09-23 11:57 ` Jani Nikula
2024-09-26  6:48   ` Ghimiray, Himal Prasad
2024-09-20 10:53 apoorva.singh
2024-09-23  5:09 ` Ghimiray, Himal Prasad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=609359e0-8b88-4ec7-9cea-33faf2625918@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=apoorva.singh@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox