From: "Nilawar, Badal" <badal.nilawar@intel.com>
To: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>,
"Michal Wajdeczko" <michal.wajdeczko@intel.com>,
<intel-xe@lists.freedesktop.org>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>,
Nirmoy Das <nirmoy.das@intel.com>
Subject: Re: [PATCH v6 04/25] drm/xe: Modify xe_force_wake_put to handle _get returned mask
Date: Fri, 4 Oct 2024 08:51:54 +0530 [thread overview]
Message-ID: <a80c24b8-018c-48ea-8df3-9827d3f65b45@intel.com> (raw)
In-Reply-To: <6dbbfd13-e579-46ff-8975-6d88516aa1c1@intel.com>
On 01-10-2024 10:41, Ghimiray, Himal Prasad wrote:
>
>
> On 01-10-2024 01:45, Michal Wajdeczko wrote:
>>
>>
>> On 30.09.2024 22:13, Michal Wajdeczko wrote:
>>>
>>>
>>> On 30.09.2024 07:31, Himal Prasad Ghimiray wrote:
>>>> Instead of calling xe_force_wake_put on all domains that were input to
>>>> xe_force_wake_get, call _put only on the domains whose reference counts
>>>> were successfully incremented by the _get call. Since the return value
>>>> of _get can be a mask that does not match any specific value in the
>>>> enum
>>>> xe_force_wake_domains, change the input parameter of _put to
>>>> unsigned int.
>>>
>>> at this point in the series xe_force_wake_get() still returns errno
>>
>> oops, scratch that, somehow missed patch 03/25
>>
>>>
>>> maybe rephrase this to something like:
>>>
>>> "Prepare xe_force_wake_put() to accept force_wake reference with
>>> refcounted domains"
>>>
>>> and also maybe it is a good time to change this function to void (or
>>> maybe even do it before this path?
>
> Changing this to void here or before this patch will break the
> compilation, since the cleanup is in subsequent patches. Therefore,
> patch 25/25 addresses changing it to void after all the cleanups.
>
>>>
>>>>
>>>> v3
>>>> - Move WARN to this patch (Badal)
>>>> - use xe_gt_WARN instead of XE_WARN (Michal)
>>>> - Stop using xe_force_wake_domains for non enum values.
>>>> - Remove kernel-doc from this patch (Badal)
>>>>
>>>> -v5
>>>> - Fix global awake_domain
>>>>
>>>> -v6
>>>> - put all initialized domains in case of FORCEWAKE_ALL.
>>>> - Modify ret variable name (Michal)
>>>> - Modify input var name (Michal)
>>>> - Modify commit message and warn (Badal)
>>>>
>>>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>>>> Cc: Badal Nilawar <badal.nilawar@intel.com>
>>>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>>> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>>>> Cc: Nirmoy Das <nirmoy.das@intel.com>
>>>> Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
>>>
>>> probably this applies to some earlier #rev, so please mark it as such
>
> Sure. Miss at my end. Will do in this patch and others.
Changes in this patch looks good to me. Please maintain my RB.
Regards,
Badal
>
>>>
>>>> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
>>>> ---
>>>> drivers/gpu/drm/xe/xe_force_wake.c | 28 +++++++++++++++++++++-------
>>>> drivers/gpu/drm/xe/xe_force_wake.h | 2 +-
>>>> 2 files changed, 22 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/xe/xe_force_wake.c b/drivers/gpu/drm/
>>>> xe/xe_force_wake.c
>>>> index 7f358e42c5d4..372ea43b0d06 100644
>>>> --- a/drivers/gpu/drm/xe/xe_force_wake.c
>>>> +++ b/drivers/gpu/drm/xe/xe_force_wake.c
>>>> @@ -211,26 +211,40 @@ unsigned int xe_force_wake_get(struct
>>>> xe_force_wake *fw,
>>>> }
>>>> int xe_force_wake_put(struct xe_force_wake *fw,
>>>> - enum xe_force_wake_domains domains)
>>>> + unsigned int fw_ref)
>>>> {
>>>> struct xe_gt *gt = fw->gt;
>>>> struct xe_force_wake_domain *domain;
>>>> - enum xe_force_wake_domains tmp, sleep = 0;
>>>> + unsigned int tmp, sleep = 0;
>>>> unsigned long flags;
>>>> - int ret = 0;
>>>> + int ack_fail = 0;
>>>> +
>>>> + /*
>>>> + * Avoid unnecessary lock and unlock when the function is called
>>>> + * in error path of individual domains.
>>>> + */
>>>> + if (!fw_ref)
>>>> + return 0;
>>>> +
>>>> + if (fw_ref == XE_FORCEWAKE_ALL)
>>>> + fw_ref = fw->initialized_domains;
>>>> spin_lock_irqsave(&fw->lock, flags);
>>>> - for_each_fw_domain_masked(domain, domains, fw, tmp) {
>>>> + for_each_fw_domain_masked(domain, fw_ref, fw, tmp) {
>>>> if (!--domain->ref) {
>>>> sleep |= BIT(domain->id);
>>>> domain_sleep(gt, domain);
>>>> }
>>>> }
>>>> for_each_fw_domain_masked(domain, sleep, fw, tmp) {
>>>> - ret |= domain_sleep_wait(gt, domain);
>>>> + if (domain_sleep_wait(gt, domain) == 0)
>>>> + fw->awake_domains &= ~BIT(domain->id);
>>>> + else
>>>> + ack_fail |= BIT(domain->id);
>>>> }
>>>> - fw->awake_domains &= ~sleep;
>>>> spin_unlock_irqrestore(&fw->lock, flags);
>>>> - return ret;
>>>> + xe_gt_WARN(gt, ack_fail, "Forcewake domain%s %#x failed to
>>>> acknowledge sleep request\n",
>>>> + str_plural(hweight_long(ack_fail)), ack_fail);
>>>> + return ack_fail;
>>>> }
>>>> diff --git a/drivers/gpu/drm/xe/xe_force_wake.h b/drivers/gpu/drm/
>>>> xe/xe_force_wake.h
>>>> index eb638128952d..b5a75544d86a 100644
>>>> --- a/drivers/gpu/drm/xe/xe_force_wake.h
>>>> +++ b/drivers/gpu/drm/xe/xe_force_wake.h
>>>> @@ -18,7 +18,7 @@ void xe_force_wake_init_engines(struct xe_gt *gt,
>>>> unsigned int xe_force_wake_get(struct xe_force_wake *fw,
>>>> enum xe_force_wake_domains domains);
>>>> int xe_force_wake_put(struct xe_force_wake *fw,
>>>> - enum xe_force_wake_domains domains);
>>>> + unsigned int fw_ref);
>>>> static inline int
>>>> xe_force_wake_ref(struct xe_force_wake *fw,
>>>
>>
>
next prev parent reply other threads:[~2024-10-04 3:22 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 5:31 [PATCH v6 00/25] Fix xe_force_wake_get() failure handling Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 01/25] drm/xe: Add member initialized_domains to xe_force_wake() Himal Prasad Ghimiray
2024-09-30 19:51 ` Michal Wajdeczko
2024-10-01 5:03 ` Ghimiray, Himal Prasad
2024-09-30 5:31 ` [PATCH v6 02/25] drm/xe/forcewake: Add a helper xe_force_wake_ref_has_domain() Himal Prasad Ghimiray
2024-09-30 20:04 ` Michal Wajdeczko
2024-10-01 5:06 ` Ghimiray, Himal Prasad
2024-09-30 5:31 ` [PATCH v6 03/25] drm/xe: Error handling in xe_force_wake_get() Himal Prasad Ghimiray
2024-10-03 12:23 ` Nilawar, Badal
2024-10-03 16:10 ` Ghimiray, Himal Prasad
2024-10-04 7:40 ` Nilawar, Badal
2024-10-07 3:14 ` Ghimiray, Himal Prasad
2024-09-30 5:31 ` [PATCH v6 04/25] drm/xe: Modify xe_force_wake_put to handle _get returned mask Himal Prasad Ghimiray
2024-09-30 20:13 ` Michal Wajdeczko
2024-09-30 20:15 ` Michal Wajdeczko
2024-10-01 5:11 ` Ghimiray, Himal Prasad
2024-10-04 3:21 ` Nilawar, Badal [this message]
2024-09-30 22:13 ` Matt Roper
2024-10-01 5:31 ` Ghimiray, Himal Prasad
2024-09-30 5:31 ` [PATCH v6 05/25] drm/xe/device: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-10-04 7:18 ` Nilawar, Badal
2024-10-07 3:40 ` Ghimiray, Himal Prasad
2024-09-30 5:31 ` [PATCH v6 06/25] drm/xe/hdcp: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 07/25] drm/xe/gsc: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 08/25] drm/xe/gt: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 09/25] drm/xe/xe_gt_idle: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 10/25] drm/xe/devcoredump: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 11/25] drm/xe/tests/mocs: Update xe_force_wake_get() return handling Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 12/25] drm/xe/mocs: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 13/25] drm/xe/xe_drm_client: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 14/25] drm/xe/xe_gt_debugfs: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 15/25] drm/xe/guc: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 16/25] drm/xe/huc: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 17/25] drm/xe/oa: Handle force_wake_get failure in xe_oa_stream_init() Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 18/25] drm/xe/pat: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 19/25] drm/xe/gt_tlb_invalidation_ggtt: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 20/25] drm/xe/xe_reg_sr: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 21/25] drm/xe/query: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 22/25] drm/xe/vram: " Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 23/25] drm/xe: forcewake debugfs open fails on xe_forcewake_get failure Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 24/25] drm/xe: Ensure __must_check for xe_force_wake_get() return Himal Prasad Ghimiray
2024-09-30 5:31 ` [PATCH v6 25/25] drm/xe: Change return type to void for xe_force_wake_put Himal Prasad Ghimiray
2024-09-30 6:02 ` ✓ CI.Patch_applied: success for Fix xe_force_wake_get() failure handling (rev6) Patchwork
2024-09-30 6:03 ` ✓ CI.checkpatch: " Patchwork
2024-09-30 6:03 ` ✗ CI.KUnit: failure " Patchwork
2024-09-30 7:35 ` Ghimiray, Himal Prasad
2024-09-30 20:55 ` ✓ CI.Patch_applied: success for Fix xe_force_wake_get() failure handling (rev7) Patchwork
2024-09-30 20:55 ` ✓ CI.checkpatch: " Patchwork
2024-09-30 20:57 ` ✓ CI.KUnit: " Patchwork
2024-09-30 21:08 ` ✓ CI.Build: " Patchwork
2024-09-30 21:10 ` ✗ CI.Hooks: failure " Patchwork
2024-09-30 21:12 ` ✓ CI.checksparse: success " Patchwork
2024-09-30 21:39 ` ✗ CI.BAT: failure " Patchwork
2024-10-01 6:20 ` ✗ CI.FULL: " 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=a80c24b8-018c-48ea-8df3-9827d3f65b45@intel.com \
--to=badal.nilawar@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=michal.wajdeczko@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.