Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: Tejas Upadhyay <tejas.upadhyay@intel.com>
Subject: Re: [PATCH] drm/xe: Always check force_wake_get return code
Date: Wed, 13 Mar 2024 10:35:59 -0700	[thread overview]
Message-ID: <82932c4f-7781-49c1-b3df-f41d0925237e@intel.com> (raw)
In-Reply-To: <875xxqrxi1.fsf@intel.com>



On 3/13/2024 7:56 AM, Jani Nikula wrote:
> On Wed, 13 Mar 2024, Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> wrote:
>> On 3/13/2024 1:31 AM, Jani Nikula wrote:
>>> On Tue, 12 Mar 2024, Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> wrote:
>>>> diff --git a/drivers/gpu/drm/xe/xe_gsc.c b/drivers/gpu/drm/xe/xe_gsc.c
>>>> index d9aa815a5bc2..902c52d95a8a 100644
>>>> --- a/drivers/gpu/drm/xe/xe_gsc.c
>>>> +++ b/drivers/gpu/drm/xe/xe_gsc.c
>>>> @@ -287,7 +287,7 @@ static void gsc_work(struct work_struct *work)
>>>>    	spin_unlock_irq(&gsc->lock);
>>>>    
>>>>    	xe_pm_runtime_get(xe);
>>>> -	xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC);
>>>> +	XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC));
>>> Up to the xe maintainers to decide, but I'm really not a fan of hiding
>>> functionality inside warn ons. My approach usually is, would it work if
>>> all the warns were removed? If yes, it's good. If not, maybe reconsider.
>> The code works even without the warns, they're only there so we know
>> that there was a forcewake issue if/when some other error crops up down
>> the line (which will be handled appropriately). There is nothing we can
>> do to actually handle the forcewake failure as it can only happen if the
>> HW is in a bad state.
> My point is, I personally prefer:
>
> 	ret = do_stuff():
>
> 	WARN_ON(ret);
>
> over:
>
> 	WARN_ON(do_stuff());
>
> because in the former do_stuff() stands out as something we actually
> want to do functionally, while in the latter the fact that we do
> anything at all is hidden inside the WARN_ON().
>
> I prefer WARN_ON()'s to only have stuff inside them that have no
> side-effects:
>
> 	WARN_ON(check_stuff_but_dont_do_stuff());

Got it, I do agree that it's generally cleaner that way.

>
> Again, not my call to make here, just musing on style. ;)

I actually copied what was done elsewhere in Xe with forcewake failures 
in unabortable paths and other similar checks. For consistency with 
what's already there, I'd prefer to keep it like it is.

Daniele

>
>
> BR,
> Jani.
>
>


  reply	other threads:[~2024-03-13 17:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 19:42 [PATCH] drm/xe: Always check force_wake_get return code Daniele Ceraolo Spurio
2024-03-12 19:47 ` ✓ CI.Patch_applied: success for " Patchwork
2024-03-12 19:47 ` ✓ CI.checkpatch: " Patchwork
2024-03-12 19:48 ` ✓ CI.KUnit: " Patchwork
2024-03-12 19:59 ` ✓ CI.Build: " Patchwork
2024-03-12 20:02 ` ✓ CI.Hooks: " Patchwork
2024-03-12 20:03 ` ✓ CI.checksparse: " Patchwork
2024-03-12 20:22 ` ✓ CI.BAT: " Patchwork
2024-03-12 23:07 ` [PATCH] " Matt Roper
2024-03-13  8:31 ` Jani Nikula
2024-03-13 14:24   ` Daniele Ceraolo Spurio
2024-03-13 14:56     ` Jani Nikula
2024-03-13 17:35       ` Daniele Ceraolo Spurio [this message]
2024-03-14 10:58 ` Upadhyay, Tejas
2024-03-14 13:53   ` Daniele Ceraolo Spurio
2024-03-14 14:12     ` Upadhyay, Tejas
  -- strict thread matches above, loose matches on Subject: below --
2024-06-03 11:30 Tejas Upadhyay
2024-06-03 18:56 ` Daniele Ceraolo Spurio
2024-06-03 19:39   ` Lucas De Marchi
2024-06-04 18:31     ` Rodrigo Vivi

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=82932c4f-7781-49c1-b3df-f41d0925237e@intel.com \
    --to=daniele.ceraolospurio@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=tejas.upadhyay@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