From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>,
intel-xe@lists.freedesktop.org
Cc: Badal Nilawar <badal.nilawar@intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>,
Nirmoy Das <nirmoy.das@intel.com>
Subject: Re: [PATCH v5 02/23] drm/xe: Modify xe_force_wake_put to handle _get returned mask
Date: Wed, 25 Sep 2024 16:03:12 +0200 [thread overview]
Message-ID: <e9a4259b-0e24-483d-822b-6bb2478075e0@intel.com> (raw)
In-Reply-To: <20240924121641.1045763-3-himal.prasad.ghimiray@intel.com>
On 24.09.2024 14:16, 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 xe_wakeref_t.
>
> 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
>
> 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>
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> ---
> drivers/gpu/drm/xe/xe_force_wake.c | 21 ++++++++++++++++-----
> drivers/gpu/drm/xe/xe_force_wake.h | 2 +-
> 2 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_force_wake.c b/drivers/gpu/drm/xe/xe_force_wake.c
> index d190aa93be90..c805214bc348 100644
> --- a/drivers/gpu/drm/xe/xe_force_wake.c
> +++ b/drivers/gpu/drm/xe/xe_force_wake.c
> @@ -197,26 +197,37 @@ 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 domains_mask)
it seems that in whole series you're using "fw_ref" as var name to hold
return value from the xe_force_wake_get() so maybe the same name should
be used here for the parameter instead "domain_mask" ?
> {
> 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;
in patch 23/23 (which personally I would squash into this one) you're
changing return type to void, so keeping the local var named "ret" is
questionable
>
> + /*
> + * Avoid unnecessary lock and unlock when the function is called
> + * in error path of individual domains.
> + */
> + if (!domains_mask)
> + return 0;
> +
> spin_lock_irqsave(&fw->lock, flags);
> - for_each_fw_domain_masked(domain, domains, fw, tmp) {
> + for_each_fw_domain_masked(domain, domains_mask, 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
> + ret |= BIT(domain->id);
> }
> - fw->awake_domains &= ~sleep;
> spin_unlock_irqrestore(&fw->lock, flags);
>
> + xe_gt_WARN(gt, ret, "domain%s %#x failed to acknowledgment sleep\n",
> + str_plural(hweight_long(ret)), ret);
> return ret;
> }
> diff --git a/drivers/gpu/drm/xe/xe_force_wake.h b/drivers/gpu/drm/xe/xe_force_wake.h
> index 6c1ade39139b..731a9a5a29a4 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 domains_mask);
>
> static inline int
> xe_force_wake_ref(struct xe_force_wake *fw,
next prev parent reply other threads:[~2024-09-25 14:03 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 12:16 [PATCH v5 00/23] Fix xe_force_wake_get() failure handling Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 01/23] drm/xe: Error handling in xe_force_wake_get() Himal Prasad Ghimiray
2024-09-24 17:27 ` Nilawar, Badal
2024-09-25 6:21 ` Ghimiray, Himal Prasad
2024-09-25 12:01 ` Michal Wajdeczko
2024-09-25 16:36 ` Ghimiray, Himal Prasad
2024-09-25 17:20 ` Michal Wajdeczko
2024-09-25 18:14 ` Ghimiray, Himal Prasad
2024-09-26 11:03 ` Michal Wajdeczko
2024-09-26 11:43 ` Ghimiray, Himal Prasad
2024-09-24 12:16 ` [PATCH v5 02/23] drm/xe: Modify xe_force_wake_put to handle _get returned mask Himal Prasad Ghimiray
2024-09-25 10:27 ` Nilawar, Badal
2024-09-25 14:03 ` Michal Wajdeczko [this message]
2024-09-25 16:44 ` Ghimiray, Himal Prasad
2024-09-24 12:16 ` [PATCH v5 03/23] drm/xe/device: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 04/23] drm/xe/hdcp: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 05/23] drm/xe/gsc: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 06/23] drm/xe/gt: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 07/23] drm/xe/xe_gt_idle: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 08/23] drm/xe/devcoredump: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 09/23] drm/xe/tests/mocs: Update xe_force_wake_get() return handling Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 10/23] drm/xe/mocs: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 11/23] drm/xe/xe_drm_client: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 12/23] drm/xe/xe_gt_debugfs: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 13/23] drm/xe/guc: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 14/23] drm/xe/huc: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 15/23] drm/xe/oa: Handle force_wake_get failure in xe_oa_stream_init() Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 16/23] drm/xe/pat: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 17/23] drm/xe/gt_tlb_invalidation_ggtt: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 18/23] drm/xe/xe_reg_sr: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 19/23] drm/xe/query: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 20/23] drm/xe/vram: " Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 21/23] drm/xe: forcewake debugfs open fails on xe_forcewake_get failure Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 22/23] drm/xe: Ensure __must_check for xe_force_wake_get() return Himal Prasad Ghimiray
2024-09-24 12:16 ` [PATCH v5 23/23] drm/xe: Change return type to void for xe_force_wake_put Himal Prasad Ghimiray
2024-09-25 10:30 ` Nilawar, Badal
2024-09-25 14:07 ` Michal Wajdeczko
2024-09-25 16:46 ` Ghimiray, Himal Prasad
2024-09-26 1:04 ` ✓ CI.Patch_applied: success for Fix xe_force_wake_get() failure handling (rev5) Patchwork
2024-09-26 1:04 ` ✓ CI.checkpatch: " Patchwork
2024-09-26 1:05 ` ✓ CI.KUnit: " Patchwork
2024-09-26 1:17 ` ✓ CI.Build: " Patchwork
2024-09-26 1:19 ` ✓ CI.Hooks: " Patchwork
2024-09-26 1:20 ` ✓ CI.checksparse: " Patchwork
2024-09-26 1:42 ` ✓ CI.BAT: " Patchwork
2024-09-26 8:17 ` ✗ CI.FULL: failure " 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=e9a4259b-0e24-483d-822b-6bb2478075e0@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=badal.nilawar@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox