Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
	Nirmoy Das <nirmoy.das@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe/client: Check return value of xe_force_wake_get
Date: Thu, 30 May 2024 23:22:56 +0200	[thread overview]
Message-ID: <01e1d78a-6227-46ba-a1de-b56348039579@linux.intel.com> (raw)
In-Reply-To: <fuhisr2cplvzrtm2cjjyiodzp25mysclp5v2unv4drct2bh3ul@szs5jha3l3fs>

Hi Lucas,

On 5/29/2024 6:24 PM, Lucas De Marchi wrote:
> On Wed, May 29, 2024 at 10:50:34AM GMT, Nirmoy Das wrote:
>> Hi Rodrigo,
>>
>> On 5/28/2024 7:22 PM, Rodrigo Vivi wrote:
>>> On Tue, May 28, 2024 at 12:11:32PM +0200, Nirmoy Das wrote:
>>>> xe_force_wake_get() can return error so check it's return value
>>>> before reading gpu_timestamp value.
>>>>
>>>> Fixes: 188ced1e0ff8 ("drm/xe/client: Print runtime to fdinfo")
>>>> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>>>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>>>> ---
>>>>  drivers/gpu/drm/xe/xe_drm_client.c | 6 ++++--
>>>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/xe/xe_drm_client.c 
>>>> b/drivers/gpu/drm/xe/xe_drm_client.c
>>>> index 4a19b771e3a0..0c13395ffd34 100644
>>>> --- a/drivers/gpu/drm/xe/xe_drm_client.c
>>>> +++ b/drivers/gpu/drm/xe/xe_drm_client.c
>>>> @@ -245,7 +245,7 @@ static void show_run_ticks(struct drm_printer 
>>>> *p, struct drm_file *file)
>>>>      struct xe_gt *gt;
>>>>      struct xe_hw_engine *hwe;
>>>>      struct xe_exec_queue *q;
>>>> -    u64 gpu_timestamp;
>>>> +    u64 gpu_timestamp = 0;
>>>>      xe_pm_runtime_get(xe);
>>>> @@ -264,7 +264,9 @@ static void show_run_ticks(struct drm_printer 
>>>> *p, struct drm_file *file)
>>>>          if (!hwe)
>>>>              continue;
>>>> -        xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
>>>> +        if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GT))
>>>> +            break;
>>> worth adding a debug/err msg?
>>
>> xe_force_wake_get() will throw a drm_notice on error. May be we 
>> should add a __builtin_return_address() in xe_force_wake_get() to 
>> know the caller as
>>
>> the current pattern seems to be to just return early on error ?
>
> humn... but just continuing here and returning something with a gpu
> timestamp == 0 doesn't seem something good. I think we should set hwe to
> NULL, so the function doesn't continue and just doesn't print anything
> rather than printing wrong data.


Yes, make sense to me. I will resend with setting hwe to NULL

Thanks,

Nirmoy

>
> Lucas De Marchi
>
>>
>>>
>>> but up to you:
>>>
>>> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>
>> Thanks,
>>
>> Nirmoy
>>
>>>
>>>> +
>>>>          gpu_timestamp = xe_hw_engine_read_timestamp(hwe);
>>>>          xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
>>>>          break;
>>>> -- 
>>>> 2.42.0
>>>>

  reply	other threads:[~2024-05-30 21:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28 10:11 [PATCH] drm/xe/client: Check return value of xe_force_wake_get Nirmoy Das
2024-05-28 10:32 ` ✓ CI.Patch_applied: success for " Patchwork
2024-05-28 10:32 ` ✓ CI.checkpatch: " Patchwork
2024-05-28 10:33 ` ✗ CI.KUnit: failure " Patchwork
2024-05-28 17:22 ` [PATCH] " Rodrigo Vivi
2024-05-29  8:50   ` Nirmoy Das
2024-05-29 13:37     ` Rodrigo Vivi
2024-05-29 16:24     ` Lucas De Marchi
2024-05-30 21:22       ` Nirmoy Das [this message]
2024-05-29  9:20 ` ✓ CI.Patch_applied: success for drm/xe/client: Check return value of xe_force_wake_get (rev2) Patchwork
2024-05-29  9:20 ` ✓ CI.checkpatch: " Patchwork
2024-05-29  9:21 ` ✗ CI.KUnit: failure " Patchwork
2024-05-29 10:29 ` ✓ CI.Patch_applied: success for drm/xe/client: Check return value of xe_force_wake_get (rev3) Patchwork
2024-05-29 10:29 ` ✓ CI.checkpatch: " Patchwork
2024-05-29 10:30 ` ✓ CI.KUnit: " Patchwork
2024-05-29 10:42 ` ✓ CI.Build: " Patchwork
2024-05-29 10:42 ` ✗ CI.Hooks: failure " Patchwork
2024-05-29 10:43 ` ✓ CI.checksparse: success " Patchwork
2024-05-29 11:08 ` ✓ CI.BAT: " Patchwork
2024-05-29 12:25 ` ✗ CI.FULL: failure " Patchwork
2024-05-30  8:47 ` [PATCH] drm/xe/client: Check return value of xe_force_wake_get Ghimiray, Himal Prasad
2024-05-30 21:30   ` Nirmoy Das

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=01e1d78a-6227-46ba-a1de-b56348039579@linux.intel.com \
    --to=nirmoy.das@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=nirmoy.das@intel.com \
    --cc=rodrigo.vivi@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