From: "Nilawar, Badal" <badal.nilawar@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <ashutosh.dixit@intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Francois Dugast <francois.dugast@intel.com>,
Matthew Auld <matthew.auld@intel.com>,
Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>,
Karthik Poosa <karthik.poosa@intel.com>
Subject: Re: [PATCH v3 13/13] drm/xe/hwmon: Stop ignoring errors on probe
Date: Mon, 10 Feb 2025 22:24:23 +0530 [thread overview]
Message-ID: <815cc1a9-14ee-48cc-856d-694bdf7bdd1b@intel.com> (raw)
In-Reply-To: <uuvuoxdimp4iqy6m3o7q67z4ruh7nfmhsnxenbhjd4h7dlhbak@epph57yfuqxn>
On 10-02-2025 20:45, Lucas De Marchi wrote:
> On Mon, Feb 10, 2025 at 11:01:15AM +0530, Nilawar, Badal wrote:
>> Hi Lucas,
>>
>> On 08-02-2025 03:49, Lucas De Marchi wrote:
>>> Not registering hwmon because it's not available (SRIOV_VF and DGFX) is
>>> different from failing the initialization. Handle the errors
>>> appropriately.
>>>
>>> Cc: Badal Nilawar <badal.nilawar@intel.com>
>>> Cc: Karthik Poosa <karthik.poosa@intel.com>
>>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>>> ---
>>> drivers/gpu/drm/xe/xe_device.c | 4 +++-
>>> drivers/gpu/drm/xe/xe_hwmon.c | 31 ++++++++++++++++---------------
>>> drivers/gpu/drm/xe/xe_hwmon.h | 4 ++--
>>> 3 files changed, 21 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/xe/xe_device.c
>>> b/drivers/gpu/drm/xe/xe_device.c
>>> index 002e066f5f288..2e6f42d1b1d01 100644
>>> --- a/drivers/gpu/drm/xe/xe_device.c
>>> +++ b/drivers/gpu/drm/xe/xe_device.c
>>> @@ -889,7 +889,9 @@ int xe_device_probe(struct xe_device *xe)
>>> xe_debugfs_register(xe);
>>> - xe_hwmon_register(xe);
>>> + err = xe_hwmon_register(xe);
>>> + if (err)
>>> + goto err_unregister_display;
>>> for_each_gt(gt, xe, id)
>>> xe_gt_sanitize_freq(gt);
>>> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c
>>> b/drivers/gpu/drm/xe/xe_hwmon.c
>>> index 7f327e3342123..48d80ffdf7bb9 100644
>>> --- a/drivers/gpu/drm/xe/xe_hwmon.c
>>> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
>>> @@ -839,10 +839,9 @@ static const struct hwmon_chip_info
>>> hwmon_chip_info = {
>>> };
>>> static void
>>> -xe_hwmon_get_preregistration_info(struct xe_device *xe)
>>> +xe_hwmon_get_preregistration_info(struct xe_hwmon *hwmon)
>>> {
>>> - struct xe_mmio *mmio = xe_root_tile_mmio(xe);
>>> - struct xe_hwmon *hwmon = xe->hwmon;
>>> + struct xe_mmio *mmio = xe_root_tile_mmio(hwmon->xe);
>>> long energy;
>>> u64 val_sku_unit = 0;
>>> int channel;
>>> @@ -876,33 +875,34 @@ static void xe_hwmon_mutex_destroy(void *arg)
>>> mutex_destroy(&hwmon->hwmon_lock);
>>> }
>>> -void xe_hwmon_register(struct xe_device *xe)
>>> +int xe_hwmon_register(struct xe_device *xe)
>>> {
>>> struct device *dev = xe->drm.dev;
>>> struct xe_hwmon *hwmon;
>>> + int ret;
>>> /* hwmon is available only for dGfx */
>>> if (!IS_DGFX(xe))
>>> - return;
>>> + return 0;
>>> /* hwmon is not available on VFs */
>>> if (IS_SRIOV_VF(xe))
>>> - return;
>>> + return 0;
>>> hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL);
>>> if (!hwmon)
>>> - return;
>>> -
>>> - xe->hwmon = hwmon;
>>> + return -ENOMEM;
>>> mutex_init(&hwmon->hwmon_lock);
>>> - if (devm_add_action_or_reset(dev, xe_hwmon_mutex_destroy, hwmon))
>>> - return;
>>> + ret = devm_add_action_or_reset(dev, xe_hwmon_mutex_destroy,
>>> hwmon);
>>> + if (ret)
>>> + return ret;
>>> /* There's only one instance of hwmon per device */
>>> hwmon->xe = xe;
>>> + xe->hwmon = hwmon;
>>> - xe_hwmon_get_preregistration_info(xe);
>>> + xe_hwmon_get_preregistration_info(hwmon);
>>> drm_dbg(&xe->drm, "Register xe hwmon interface\n");
>>> @@ -910,11 +910,12 @@ void xe_hwmon_register(struct xe_device *xe)
>>> hwmon->hwmon_dev = devm_hwmon_device_register_with_info(dev,
>>> "xe", hwmon,
>>> &hwmon_chip_info,
>>> hwmon_groups);
>>> -
>>> if (IS_ERR(hwmon->hwmon_dev)) {
>>> - drm_warn(&xe->drm, "Failed to register xe hwmon (%pe)\n",
>>> hwmon->hwmon_dev);
>>> + drm_err(&xe->drm, "Failed to register xe hwmon (%pe)\n",
>>> hwmon->hwmon_dev);
>>> xe->hwmon = NULL;
>>> - return;
>>> + return PTR_ERR(hwmon->hwmon_dev);
>>
>> Hwmon is not part of drm subsystem so we didn't tie hwmon
>> registration failure with xe probe.
>
> We don't want a half-initialized driver. We never did. The problem is
> that we added integration with other subsystems and brought this
> initialization-style from i915. We are just hiding bugs.
Fine, I agree with you.
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Regards,
Badal Nilawar
>
> Lucas De Marchi
>
>
>>
>> Regards,
>> Badal
>>
>>> }
>>> +
>>> + return 0;
>>> }
>>> diff --git a/drivers/gpu/drm/xe/xe_hwmon.h
>>> b/drivers/gpu/drm/xe/xe_hwmon.h
>>> index c42a1de2cd7a2..d02c1bfe8c0a0 100644
>>> --- a/drivers/gpu/drm/xe/xe_hwmon.h
>>> +++ b/drivers/gpu/drm/xe/xe_hwmon.h
>>> @@ -11,9 +11,9 @@
>>> struct xe_device;
>>> #if IS_REACHABLE(CONFIG_HWMON)
>>> -void xe_hwmon_register(struct xe_device *xe);
>>> +int xe_hwmon_register(struct xe_device *xe);
>>> #else
>>> -static inline void xe_hwmon_register(struct xe_device *xe) { };
>>> +static inline int xe_hwmon_register(struct xe_device *xe) { return
>>> 0; };
>>> #endif
>>> #endif /* _XE_HWMON_H_ */
next prev parent reply other threads:[~2025-02-10 16:55 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 22:19 [PATCH v3 00/13] Cleanup error handling on probe Lucas De Marchi
2025-02-07 22:19 ` [PATCH v3 01/13] drm/xe: Fix xe_display_fini() calls Lucas De Marchi
2025-02-10 17:56 ` Ghimiray, Himal Prasad
2025-02-10 19:08 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 02/13] drm/xe: Fix error handling in xe_irq_install() Lucas De Marchi
2025-02-10 17:58 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 03/13] drm/xe: Fix xe_tile_init_noalloc() error propagation Lucas De Marchi
2025-02-10 5:52 ` Upadhyay, Tejas
2025-02-10 17:59 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 04/13] drm/xe: Stop ignoring errors from xe_ttm_stolen_mgr_init() Lucas De Marchi
2025-02-10 18:05 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 05/13] drm/xe: Remove leftover pxp comment Lucas De Marchi
2025-02-07 22:19 ` [PATCH v3 06/13] drm/xe: Add callback support for driver remove Lucas De Marchi
2025-02-10 17:41 ` Rodrigo Vivi
2025-02-12 5:45 ` Lucas De Marchi
2025-02-07 22:19 ` [PATCH v3 07/13] drm/xe: Cleanup unwind of gt initialization Lucas De Marchi
2025-02-10 18:54 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 08/13] drm/xe: Cleanup extra calls to xe_hw_fence_irq_finish() Lucas De Marchi
2025-02-10 18:56 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 09/13] drm/xe/oa: Move fini to xe_oa Lucas De Marchi
2025-02-07 22:19 ` [PATCH v3 10/13] drm/xe: Move drm_dev_unplug() out of display function Lucas De Marchi
2025-02-10 5:44 ` Upadhyay, Tejas
2025-02-07 22:19 ` [PATCH v3 11/13] drm/xe/oa: Handle errors in xe_oa_register() Lucas De Marchi
2025-02-07 22:19 ` [PATCH v3 12/13] drm/xe/pmu: Fail probe if xe_pmu_register() fails Lucas De Marchi
2025-02-10 11:17 ` Upadhyay, Tejas
2025-02-10 19:00 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 13/13] drm/xe/hwmon: Stop ignoring errors on probe Lucas De Marchi
2025-02-07 22:31 ` Raag Jadav
2025-02-10 5:31 ` Nilawar, Badal
2025-02-10 15:15 ` Lucas De Marchi
2025-02-10 16:54 ` Nilawar, Badal [this message]
2025-02-07 23:42 ` ✓ CI.Patch_applied: success for Cleanup error handling on probe (rev3) Patchwork
2025-02-07 23:42 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-07 23:43 ` ✓ CI.KUnit: success " Patchwork
2025-02-08 0:00 ` ✓ CI.Build: " Patchwork
2025-02-08 0:02 ` ✓ CI.Hooks: " Patchwork
2025-02-08 0:03 ` ✓ CI.checksparse: " Patchwork
2025-02-10 6:05 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-10 6:55 ` ✗ Xe.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=815cc1a9-14ee-48cc-856d-694bdf7bdd1b@intel.com \
--to=badal.nilawar@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=karthik.poosa@intel.com \
--cc=lucas.demarchi@intel.com \
--cc=matthew.auld@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.