From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: "Jani Nikula" <jani.nikula@linux.intel.com>,
apoorva.singh@intel.com, intel-xe@lists.freedesktop.org,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH] drm/xe: Check return values of functions in xe_gt_shutdown()
Date: Thu, 26 Sep 2024 12:18:51 +0530 [thread overview]
Message-ID: <d19de6b6-2c74-48cb-898b-425b6d95226c@intel.com> (raw)
In-Reply-To: <87ikum60rs.fsf@intel.com>
On 23-09-2024 17:27, Jani Nikula wrote:
> On Mon, 23 Sep 2024, apoorva.singh@intel.com wrote:
>> 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 | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
>> index 274737417b0f..eaeaae1df198 100644
>> --- a/drivers/gpu/drm/xe/xe_gt.c
>> +++ b/drivers/gpu/drm/xe/xe_gt.c
>> @@ -890,9 +890,9 @@ 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);
>> + XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL));
>> do_gt_reset(gt);
>> - xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
>> + XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
>
> Up to the xe maintainers, but personally I very much dislike "hiding"
> functional stuff inside *WARN_ON(). It's harder to read. IMO it should
> be only for checks, and functions without side effects.
usage of XE_WARN_ON for force_wake_get/force_wake_put will be removed in
all the places. Below series covers it
https://lore.kernel.org/intel-xe/20240924121641.1045763-1-himal.prasad.ghimiray@intel.com/T/#t
@Apoorva,
If these cleanup is not of urgency lets hold on till above series gets
concluded and merged.
If this is required to be addressed urgently and current version is not
acceptable something like below will help
int err;
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);
err = xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
xe_gt_WARN(gt, err, "Acknowledgment for domain sleep timedout");
BR
Himal
>
> And while we're at it, unrelated to this patch, what's the point of
> XE_WARN_ON?
>
> It's defined to be just WARN_ON. But for multi-GPU systems you'd benefit
> from using drm_WARN_ON() with device info. But for that you'd need to
> pass drm device, and a simple redefinition doesn't even work.
>
> There are a little over 100 uses, but more seem to crop up all the time,
> and people love to cargo cult this kind of stuff. It's not too late to
> change course now, but it's a royal PITA to change this when you have 1k
> of them.
>
>
> BR,
> Jani.
>
>
>> }
>>
>> /**
>
next prev parent reply other threads:[~2024-09-26 6:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 11:06 [PATCH] drm/xe: Check return values of functions in xe_gt_shutdown() apoorva.singh
2024-09-23 11:57 ` Jani Nikula
2024-09-26 6:48 ` Ghimiray, Himal Prasad [this message]
2024-09-25 16:13 ` ✓ CI.Patch_applied: success for drm/xe: Check return values of functions in xe_gt_shutdown() (rev2) Patchwork
2024-09-25 16:13 ` ✓ CI.checkpatch: " Patchwork
2024-09-25 16:14 ` ✓ CI.KUnit: " Patchwork
2024-09-25 16:26 ` ✓ CI.Build: " Patchwork
2024-09-25 16:28 ` ✓ CI.Hooks: " Patchwork
2024-09-25 16:30 ` ✓ CI.checksparse: " Patchwork
2024-09-25 16:57 ` ✗ CI.BAT: failure " Patchwork
2024-09-25 18:26 ` ✗ CI.FULL: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
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
2024-09-30 21:26 ` Matt Roper
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=d19de6b6-2c74-48cb-898b-425b6d95226c@intel.com \
--to=himal.prasad.ghimiray@intel.com \
--cc=apoorva.singh@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=lucas.demarchi@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=thomas.hellstrom@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