From: John Harrison <john.c.harrison@intel.com>
To: "Ceraolo Spurio, Daniele" <daniele.ceraolospurio@intel.com>,
<Intel-GFX@Lists.FreeDesktop.Org>
Cc: DRI-Devel@Lists.FreeDesktop.Org
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915/guc: Improve clean up of busyness stats worker
Date: Fri, 17 Feb 2023 12:13:12 -0800 [thread overview]
Message-ID: <e2629520-3738-38b5-c1e9-53dc035ee1c6@intel.com> (raw)
In-Reply-To: <44ddb672-5265-7a1b-47d5-758b0e456043@intel.com>
On 1/24/2023 16:55, Ceraolo Spurio, Daniele wrote:
> On 1/11/2023 5:54 PM, John.C.Harrison@Intel.com wrote:
>> From: John Harrison <John.C.Harrison@Intel.com>
>>
>> The stats worker thread management was mis-matched between
>> enable/disable call sites. Fix those up. Also, abstract the cancel
>> code into a helper function rather than replicating in multiple places.
>>
>> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
>> ---
>> .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 22 ++++++++++++-------
>> 1 file changed, 14 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
>> b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
>> index b436dd7f12e42..982364777d0c6 100644
>> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
>> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
>> @@ -1435,19 +1435,25 @@ static void guc_init_engine_stats(struct
>> intel_guc *guc)
>> {
>> struct intel_gt *gt = guc_to_gt(guc);
>> intel_wakeref_t wakeref;
>> + int ret;
>> mod_delayed_work(system_highpri_wq, &guc->timestamp.work,
>> guc->timestamp.ping_delay);
>> - with_intel_runtime_pm(>->i915->runtime_pm, wakeref) {
>> - int ret = guc_action_enable_usage_stats(guc);
>> + with_intel_runtime_pm(>->i915->runtime_pm, wakeref)
>> + ret = guc_action_enable_usage_stats(guc);
>> - if (ret)
>> - drm_err(>->i915->drm,
>> - "Failed to enable usage stats: %d!\n", ret);
>> + if (ret) {
>> + cancel_delayed_work_sync(&guc->timestamp.work);
>
> Wouldn't it be easier to just call mod_delayed_work after the H2G if
> ret==0, instead of having it before and cancelling if we get a failure?
>
>> + drm_err(>->i915->drm, "Failed to enable usage stats:
>> %d!\n", ret);
>> }
>> }
>> +static void guc_park_engine_stats(struct intel_guc *guc)
>> +{
>> + cancel_delayed_work_sync(&guc->timestamp.work);
>> +}
>> +
>
> Now you're asymmetric with the park/unpark, because on the park side
> you have this wrapper, while on the unpark side you directly call
> mod_delayed_work.
The point is that submission disable needs to also cancel the worker.
But calling the actual busyness park function seems excessive - no need
to do all the updating if we are about to reset the GuC or unload the
driver.
Thinking about it more, calling this park_engine_stats is actually wrong
given that engine stats and busyness are the same thing, so basically we
would have two functions with the same name where one is a subset of the
other. Is it simpler (and safe?) to just call the full busyness unpark
from submission_disable? Or is it better to have a
cancel/enable_busyness_worker() pair for all instances of turning the
worker on or off?
John.
>
> Daniele
>
>> void intel_guc_busyness_park(struct intel_gt *gt)
>> {
>> struct intel_guc *guc = >->uc.guc;
>> @@ -1460,7 +1466,7 @@ void intel_guc_busyness_park(struct intel_gt *gt)
>> * and causes an unclaimed register access warning. Cancel the
>> worker
>> * synchronously here.
>> */
>> - cancel_delayed_work_sync(&guc->timestamp.work);
>> + guc_park_engine_stats(guc);
>> /*
>> * Before parking, we should sample engine busyness stats if we
>> need to.
>> @@ -4409,11 +4415,11 @@ void intel_guc_submission_enable(struct
>> intel_guc *guc)
>> guc_init_global_schedule_policy(guc);
>> }
>> +/* Note: By the time we're here, GuC may have already been reset */
>> void intel_guc_submission_disable(struct intel_guc *guc)
>> {
>> struct intel_gt *gt = guc_to_gt(guc);
>> -
>> - /* Note: By the time we're here, GuC may have already been reset */
>> + guc_park_engine_stats(guc);
>> /* Disable and route to host */
>> if (GRAPHICS_VER(gt->i915) >= 12)
>
next prev parent reply other threads:[~2023-02-17 20:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 1:54 [Intel-gfx] [PATCH 0/2] Clean up some GuC related failure paths John.C.Harrison
2023-01-12 1:54 ` [Intel-gfx] [PATCH 1/2] drm/i915/guc: Improve clean up of busyness stats worker John.C.Harrison
2023-01-25 0:55 ` Ceraolo Spurio, Daniele
2023-02-17 20:13 ` John Harrison [this message]
2023-01-12 1:54 ` [Intel-gfx] [PATCH 2/2] drm/i915/guc: Fix missing return code checks in submission init John.C.Harrison
2023-01-25 1:01 ` Ceraolo Spurio, Daniele
2023-02-17 20:40 ` John Harrison
2023-01-12 2:16 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for Clean up some GuC related failure paths Patchwork
2023-01-12 2:33 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-01-12 4:02 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=e2629520-3738-38b5-c1e9-53dc035ee1c6@intel.com \
--to=john.c.harrison@intel.com \
--cc=DRI-Devel@Lists.FreeDesktop.Org \
--cc=Intel-GFX@Lists.FreeDesktop.Org \
--cc=daniele.ceraolospurio@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