From: sashiko-bot@kernel.org
To: "Michael J. Ruhl" <michael.j.ruhl@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v20 08/19] drm/xe/vsec: Support possible hotplug exit
Date: Fri, 20 Nov 2026 02:30:12 +0000 [thread overview]
Message-ID: <sashiko-outbox-224365@kernel.org> (raw)
In-Reply-To: <20261120021929.473553-29-michael.j.ruhl@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe/vsec: xe_pmt_telem_read() returns count instead of
-ENODEV on hotplug
--
commit 1b48141a6517afa4b3ba9a47a80f8aa9db62a6e9
Author: Michael J. Ruhl <michael.j.ruhl@intel.com>
drm/xe/vsec: Support possible hotplug exit
This commit adds drm_dev_enter() and drm_dev_exit() around the device
access in xe_pmt_telem_read() to guard against hotplug removal.
> diff --git a/drivers/gpu/drm/xe/xe_vsec.c b/drivers/gpu/drm/xe/xe_vsec.c
> index 082b25b017db6..6a28e58959be9 100644
> --- a/drivers/gpu/drm/xe/xe_vsec.c
> +++ b/drivers/gpu/drm/xe/xe_vsec.c
[ ... ]
> @@ -159,7 +161,12 @@ static int xe_guid_decode(u32 guid, int *index, u32 *offset)
> * @user_offset: a user offset relative to the beginning of the data to read
> * @count: bytes to read
> *
> + * This is a callback API. I.e this can be accessed external to the XE driver
> + * (PMT driver scope). Because of this, DRM hotplug needs to be verified
> + * (drm_dev_enter()).
> + *
> * Return:
> + * * -ENODEV device is not available (hotplug)
> * * -ENODATA for incorrect power state
> * * -EINVAL for unsupported PMT feature
> * * count number of bytes read on success
> @@ -172,13 +179,19 @@ int xe_pmt_telem_read(struct device *dev, u32 guid, u64 *data, loff_t user_offse
> u32 cap_type = FIELD_GET(GUID_CAP_TYPE, guid);
> u32 mem_region;
> u32 offset;
> - int ret;
> + int ret = 0;
> + int idx;
>
> xe_assert(xe, !IS_SRIOV_VF(xe));
>
> + if (!drm_dev_enter(&xe->drm, &idx)) {
> + memset(data, 0, count);
> + return count;
> + }
[Severity: Medium]
Should this return -ENODEV instead of zeroing data and returning count when
drm_dev_enter() fails, as documented in the Return section above?
Returning count reports a successful read of all zeroes, so callers such as
xe_hwmon_energy_get() that check ret != sizeof(pmt_val) treat the zeroed
buffer as a valid hardware reading and underflow the 32-bit unsigned delta
(reg_val - ei->reg_val_prev) when updating ei->accum_energy.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120021929.473553-21-michael.j.ruhl@intel.com?part=8
next prev parent reply other threads:[~2026-11-20 2:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 2:19 [PATCH v20 00/19] Crescent Island PMT support Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 01/19] platform/x86/intel/pmt: Introduce a callback for discovery data Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 02/19] platform/x86/intel/pmt: Use the pre-populated header info for crashlog Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 03/19] drm/xe/vsec: VSEC requires soc-remapper Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 04/19] drm/xe/vsec: Do not register BMG PMT for VF Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 05/19] drm/xe/vsec: Correct locking order Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 06/19] drm/xe/vsec: Use correct pm state get Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 07/19] drm/xe/vsec: Add DOC text for VSEC Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 08/19] drm/xe/vsec: Support possible hotplug exit Michael J. Ruhl
2026-11-20 2:30 ` sashiko-bot [this message]
2026-11-20 2:19 ` [PATCH v20 09/19] drm/xe/vsec: Refactor BattleMage PMT defines Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 10/19] drm/xe/vsec: Update VSEC probe order Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 11/19] drm/xe/vsec: Add base_offset to allow for more flexibilty Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 12/19] drm/xe/vsec: Support Crescent Island PMT Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 13/19] drm/xe/vsec: Crescent Island PMT decode Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 14/19] drm/xe/vsec: Crescent Island PMT callbacks Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 15/19] drm/xe/vsec: Support late bind fw information Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 16/19] drm/xe/vsec: Add PMT GUID internal access Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 17/19] drm/xe/vsec: Update PMT " Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 18/19] drm/xe/vsec: Refactor platform check Michael J. Ruhl
2026-11-20 2:19 ` [PATCH v20 19/19] drm/xe/vsec: Support survivability mode for CRI Michael J. Ruhl
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=sashiko-outbox-224365@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=michael.j.ruhl@intel.com \
--cc=sashiko-reviews@lists.linux.dev \
/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