Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Subject: Re: [PATCH v3 2/7] drm/xe: Incase of action add failure, remove sysfs only once
Date: Fri, 12 Apr 2024 20:25:34 +0530	[thread overview]
Message-ID: <43232546-5496-4d26-bd74-c5f0c69688dd@intel.com> (raw)
In-Reply-To: <87edba4pa3.fsf@intel.com>


On 12-04-2024 20:11, Jani Nikula wrote:
> On Fri, 12 Apr 2024, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
>> Oh... nit on commit message "Incase" is not a proper word. Same on other
>> places in this series. Please use "In case" when re-spinning this series.
> Or just "remove sysfs only once on action add failure" or something.
Noted.
>
>> Lucas De Marchi
>>
>> On Fri, Apr 12, 2024 at 01:32:40PM +0530, Himal Prasad Ghimiray wrote:
>>> The drmm_add_action_or_reset function automatically invokes the action
>>> (sysfs removal) in the event of a failure; therefore, there's no
>>> necessity to call it within the return check.
>>>
>>> Modify the return type of xe_gt_ccs_mode_sysfs_init to int, allowing the
>>> caller to pass errors up the call chain. Should sysfs creation or
>>> drmm_add_action_or_reset fail, error propagation will prompt a driver
>>> load abort.
>>>
>>> Fixes: f3bc5bb4d53d ("drm/xe: Allow userspace to configure CCS mode")
>>> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>> Cc: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
>>> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
>>> ---
>>> drivers/gpu/drm/xe/xe_gt.c          |  5 ++++-
>>> drivers/gpu/drm/xe/xe_gt_ccs_mode.c | 17 +++++++----------
>>> drivers/gpu/drm/xe/xe_gt_ccs_mode.h |  2 +-
>>> 3 files changed, 12 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
>>> index 2421a8d34324..dca0e9fb3315 100644
>>> --- a/drivers/gpu/drm/xe/xe_gt.c
>>> +++ b/drivers/gpu/drm/xe/xe_gt.c
>>> @@ -379,7 +379,9 @@ static int gt_fw_domain_init(struct xe_gt *gt)
>>> 			 err);
>>>
>>> 	/* Initialize CCS mode sysfs after early initialization of HW engines */
>>> -	xe_gt_ccs_mode_sysfs_init(gt);
>>> +	err = xe_gt_ccs_mode_sysfs_init(gt);
>>> +	if (err)
>>> +		goto err_gt_sysfs_create;
>>>
>>> 	/*
>>> 	 * Stash hardware-reported version.  Since this register does not exist
>>> @@ -395,6 +397,7 @@ static int gt_fw_domain_init(struct xe_gt *gt)
>>>
>>> err_force_wake:
>>> 	dump_pat_on_error(gt);
>>> +err_gt_sysfs_create:
>>> 	xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
>>> err_hw_fence_irq:
>>> 	for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i)
>>> diff --git a/drivers/gpu/drm/xe/xe_gt_ccs_mode.c b/drivers/gpu/drm/xe/xe_gt_ccs_mode.c
>>> index 529fc286cd06..67a5bd71770d 100644
>>> --- a/drivers/gpu/drm/xe/xe_gt_ccs_mode.c
>>> +++ b/drivers/gpu/drm/xe/xe_gt_ccs_mode.c
>>> @@ -167,25 +167,22 @@ static void xe_gt_ccs_mode_sysfs_fini(struct drm_device *drm, void *arg)
>>>   * and it is expected that there are no open drm clients while doing so.
>>>   * The number of available compute slices is exposed to user through a per-gt
>>>   * 'num_cslices' sysfs interface.
>>> + *
>>> + * Returns: Returns error value for failure and 0 for success.
>>>   */
>>> -void xe_gt_ccs_mode_sysfs_init(struct xe_gt *gt)
>>> +int xe_gt_ccs_mode_sysfs_init(struct xe_gt *gt)
>>> {
>>> 	struct xe_device *xe = gt_to_xe(gt);
>>> 	int err;
>>>
>>> 	if (!xe_gt_ccs_mode_enabled(gt))
>>> -		return;
>>> +		return 0;
>>>
>>> 	err = sysfs_create_files(gt->sysfs, gt_ccs_mode_attrs);
>>> 	if (err) {
>>> -		drm_warn(&xe->drm, "Sysfs creation for ccs_mode failed err: %d\n", err);
>>> -		return;
>>> +		drm_err(&xe->drm, "Sysfs creation for ccs_mode failed err: %d\n", err);
>>> +		return err;
>>> 	}
>>>
>>> -	err = drmm_add_action_or_reset(&xe->drm, xe_gt_ccs_mode_sysfs_fini, gt);
>>> -	if (err) {
>>> -		sysfs_remove_files(gt->sysfs, gt_ccs_mode_attrs);
>>> -		drm_warn(&xe->drm, "%s: drmm_add_action_or_reset failed, err: %d\n",
>>> -			 __func__, err);
>>> -	}
>>> +	return drmm_add_action_or_reset(&xe->drm, xe_gt_ccs_mode_sysfs_fini, gt);
>>> }
>>> diff --git a/drivers/gpu/drm/xe/xe_gt_ccs_mode.h b/drivers/gpu/drm/xe/xe_gt_ccs_mode.h
>>> index f39975aaaab0..f8779852cf0d 100644
>>> --- a/drivers/gpu/drm/xe/xe_gt_ccs_mode.h
>>> +++ b/drivers/gpu/drm/xe/xe_gt_ccs_mode.h
>>> @@ -12,7 +12,7 @@
>>> #include "xe_platform_types.h"
>>>
>>> void xe_gt_apply_ccs_mode(struct xe_gt *gt);
>>> -void xe_gt_ccs_mode_sysfs_init(struct xe_gt *gt);
>>> +int xe_gt_ccs_mode_sysfs_init(struct xe_gt *gt);
>>>
>>> static inline bool xe_gt_ccs_mode_enabled(const struct xe_gt *gt)
>>> {
>>> -- 
>>> 2.25.1
>>>

  reply	other threads:[~2024-04-12 14:55 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12  8:02 [PATCH 0/4] Cleanup and fixes in drmm_add_action_or_reset usage Himal Prasad Ghimiray
2024-04-12  8:02 ` [PATCH v3 1/7] drm/xe: Simplify function return using drmm_add_action_or_reset() Himal Prasad Ghimiray
2024-04-12 12:52   ` Lucas De Marchi
2024-04-12 14:54     ` Ghimiray, Himal Prasad
2024-04-12  8:02 ` [PATCH v3 2/7] drm/xe: Incase of action add failure, remove sysfs only once Himal Prasad Ghimiray
2024-04-12 13:09   ` Lucas De Marchi
2024-04-12 13:13   ` Lucas De Marchi
2024-04-12 14:41     ` Jani Nikula
2024-04-12 14:55       ` Ghimiray, Himal Prasad [this message]
2024-04-12  8:02 ` [PATCH v3 3/7] drm/xe: Incase of action add failure, free_gsc_pkt " Himal Prasad Ghimiray
2024-04-12 13:14   ` Lucas De Marchi
2024-04-12 15:38     ` Ghimiray, Himal Prasad
2024-04-12  8:02 ` [PATCH v3 4/7] drm/xe: Return NULL incase of drmm_add_action_or_reset failure Himal Prasad Ghimiray
2024-04-12  8:02 ` [PATCH v3 5/7] drm/xe/gt: Abort driver load for sysfs creation failure Himal Prasad Ghimiray
2024-04-12 13:30   ` Lucas De Marchi
2024-04-12 15:38     ` Ghimiray, Himal Prasad
2024-04-12  8:02 ` [PATCH v3 6/7] drm/xe/tile: " Himal Prasad Ghimiray
2024-04-12 13:32   ` Lucas De Marchi
2024-04-12 15:39     ` Ghimiray, Himal Prasad
2024-04-12  8:02 ` [PATCH v3 7/7] drm/xe/pm: Capture errors and handle them Himal Prasad Ghimiray
2024-04-12 13:42   ` Lucas De Marchi
2024-04-12 16:31     ` Ghimiray, Himal Prasad
2024-04-12 16:58       ` Lucas De Marchi
2024-04-12 17:07         ` Ghimiray, Himal Prasad
2024-04-12  8:15 ` ✓ CI.Patch_applied: success for Cleanup and fixes in drmm_add_action_or_reset usage (rev3) Patchwork
2024-04-12  8:15 ` ✓ CI.checkpatch: " Patchwork
2024-04-12  8:17 ` ✓ CI.KUnit: " Patchwork
2024-04-12  8:31 ` ✓ CI.Build: " Patchwork
2024-04-12  8:34 ` ✓ CI.Hooks: " Patchwork
2024-04-12  8:35 ` ✓ CI.checksparse: " Patchwork
2024-04-12  8:58 ` ✓ CI.BAT: " Patchwork
2024-04-12 12:13 ` ✗ 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=43232546-5496-4d26-bd74-c5f0c69688dd@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=niranjana.vishwanathapura@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