Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Bai, Zongyao" <zongyao.bai@intel.com>
To: <sashiko-reviews@lists.linux.dev>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v5 4/4] drm/xe/forcewake: enable configurable delayed forcewake release
Date: Thu, 13 Aug 2026 16:14:08 -0700	[thread overview]
Message-ID: <f6d8a075-1561-43b8-8386-8f4bd4fcee13@intel.com> (raw)
In-Reply-To: <20260813001804.CF26C1F000E9@smtp.kernel.org>


On 8/12/2026 5:18 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] The function `query_engine_cycles` mixes goto-based error handling with scope-based cleanup macros.
> --
>
> --- Patch [4]: [PATCH v5 4/4] drm/xe/forcewake: enable configurable delayed forcewake release ---
> commit 7d3e5746e331fb4da88407a96b40b25e06abf763
> Author: Zongyao Bai <zongyao.bai@intel.com>
>
> drm/xe/forcewake: enable configurable delayed forcewake release
>
> This commit introduces a configurable delayed forcewake release for
> engine-cycle queries to avoid repeated wake and ACK cycles during bursts.
> It adds a configfs attribute to control the hold interval before releasing
> an idle forcewake domain.
>
>> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
>> --- a/drivers/gpu/drm/xe/xe_query.c
>> +++ b/drivers/gpu/drm/xe/xe_query.c
>> @@ -168,7 +168,7 @@ query_engine_cycles(struct xe_device *xe,
>>   
>>   	fw_domain = xe_hw_engine_to_fw_domain(hwe);
>>   
>> -	xe_with_force_wake(fw_ref, gt_to_fw(gt), fw_domain) {
>> +	xe_with_force_wake_delay(fw_ref, gt_to_fw(gt), fw_domain) {
>>   		if (!xe_force_wake_ref_has_domain(fw_ref.domains, fw_domain)) {
>>   			err = -EIO;
>>   			goto out;
> [Severity: Low]
> Does this code mix goto-based error handling with scope-based cleanup macros?
>
> According to the cleanup subsystem guidelines, the expectation is that usage of
> goto and cleanup helpers is never mixed in the same function.
>
> The function query_engine_cycles() uses goto out; for manual drm_dev_exit()
> cleanup while simultaneously using the xe_with_force_wake_delay() macro, which
> internally uses the scope-based CLASS() cleanup macro. While jumping out of the
> loop block correctly invokes the scope destructor here without causing a
> double-free or resource leak, it violates the subsystem structural guidelines
> against mixing these cleanup styles.

Yes, I agree this is code style issue,
this function contains both a goto out and the 
xe_with_force_wake_delay() scope macro.
And this issue is introduced by path [PATCH v5 1/4], but not in this patch.

It may need split query_engine_cycles to two to avoid goto.
Since this appears to be more of a coding style preference,
I'd like to wait for consensus from other reviewers before updating it.


  reply	other threads:[~2026-08-13 23:14 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01 21:38 [PATCH] drm/xe/forcewake: add delayed-release optimization Zongyao Bai
2026-06-01 22:37 ` ✓ CI.KUnit: success for " Patchwork
2026-06-01 23:15 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-02  8:13 ` ✓ Xe.CI.FULL: " Patchwork
2026-06-11  1:03 ` [PATCH v2] " Zongyao Bai
2026-06-11 11:59   ` Maarten Lankhorst
2026-06-18 21:18     ` Bai, Zongyao
2026-06-11  1:13 ` ✓ CI.KUnit: success for drm/xe/forcewake: add delayed-release optimization (rev2) Patchwork
2026-06-11  1:58 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-11  3:09 ` [PATCH] drm/xe/forcewake: add delayed-release optimization Matthew Brost
2026-06-11  3:15   ` Matthew Brost
2026-06-25  1:37     ` Bai, Zongyao
2026-06-11 11:29 ` ✓ Xe.CI.FULL: success for drm/xe/forcewake: add delayed-release optimization (rev2) Patchwork
2026-06-25  8:19 ` [PATCH v3] drm/xe/forcewake: add delayed-release optimization Zongyao Bai
2026-06-25  8:51 ` ✓ CI.KUnit: success for drm/xe/forcewake: add delayed-release optimization (rev3) Patchwork
2026-06-25  9:26 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-06-25 10:55 ` ✗ Xe.CI.FULL: " Patchwork
2026-07-20 22:13 ` [PATCH v4] drm/xe/forcewake: add delayed-release optimization Zongyao Bai
2026-07-21 22:43   ` Matthew Brost
2026-07-20 22:18 ` ✗ CI.checkpatch: warning for drm/xe/forcewake: add delayed-release optimization (rev4) Patchwork
2026-07-20 22:20 ` ✓ CI.KUnit: success " Patchwork
2026-07-20 22:54 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-21  5:00 ` ✓ Xe.CI.FULL: " Patchwork
2026-08-13  0:06 ` [PATCH v5 0/4] drm/xe/forcewake: add delayed-release optimization Zongyao Bai
2026-08-13  0:06   ` [PATCH v5 1/4] drm/xe/forcewake: synchronize engine-cycle access with unplug Zongyao Bai
2026-08-13  0:21     ` sashiko-bot
2026-08-13 20:48       ` Bai, Zongyao
2026-08-19 18:29     ` Yao, Jia
2026-09-03 16:20     ` Rodrigo Vivi
2026-09-03 18:29       ` Bai, Zongyao
2026-08-13  0:06   ` [PATCH v5 2/4] drm/xe/forcewake: add delayed-release state machine Zongyao Bai
2026-08-13  0:23     ` sashiko-bot
2026-08-13 21:28       ` Bai, Zongyao
2026-09-03 16:12         ` Rodrigo Vivi
2026-09-04  0:25           ` Bai, Zongyao
2026-08-20 23:07     ` Yao, Jia
2026-08-13  0:06   ` [PATCH v5 3/4] drm/xe/forcewake: flush delayed release at power boundaries Zongyao Bai
2026-08-13  0:23     ` sashiko-bot
2026-08-13 22:06       ` Bai, Zongyao
2026-08-20 23:07     ` Yao, Jia
2026-08-13  0:06   ` [PATCH v5 4/4] drm/xe/forcewake: enable configurable delayed forcewake release Zongyao Bai
2026-08-13  0:18     ` sashiko-bot
2026-08-13 23:14       ` Bai, Zongyao [this message]
2026-08-19 18:05     ` Yao, Jia
2026-09-03 18:59   ` [PATCH v5 0/4] drm/xe/forcewake: add delayed-release optimization Umesh Nerlige Ramappa
2026-09-03 23:19     ` Bai, Zongyao
2026-09-03 23:56       ` Umesh Nerlige Ramappa
2026-08-13  0:13 ` ✗ CI.checkpatch: warning for drm/xe/forcewake: add delayed-release optimization (rev5) Patchwork
2026-08-13  0:15 ` ✓ CI.KUnit: success " Patchwork

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=f6d8a075-1561-43b8-8386-8f4bd4fcee13@intel.com \
    --to=zongyao.bai@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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