Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Michael J. Ruhl" <michael.j.ruhl@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v7 12/20] drm/xe/vsec: Support EAGAIN return value
Date: Wed, 09 Sep 2026 16:01:17 +0000	[thread overview]
Message-ID: <20260909160118.17CDF1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260909154739.1515514-34-michael.j.ruhl@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [Medium] xe_hwmon_energy_get() incorrectly masks the -EAGAIN error by returning 0, which corrupts power calculations and permanently hides sysfs attributes.
--

commit 99e578f62cb6212c825a10a5de5875717c46d4a9
Author: Michael J. Ruhl <michael.j.ruhl@intel.com>

drm/xe/vsec: Support EAGAIN return value

This commit updates call locations of xe_pmt_telem_read() to explicitly
ignore the -EAGAIN return value and prevent it from logging warnings.

[ ... ]

> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> index 5284cab6703d8..ecd52a04175d0 100644
> --- a/drivers/gpu/drm/xe/xe_hwmon.c
> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
> @@ -522,7 +522,9 @@ xe_hwmon_energy_get(struct xe_hwmon *hwmon, int channel, long *energy)
>  					xe_mmio_read32(mmio, PUNIT_TELEMETRY_GUID),
>  					&pmt_val, BMG_ENERGY_STATUS_PMT_OFFSET,	sizeof(pmt_val));
>  		if (ret != sizeof(pmt_val)) {
> -			drm_warn(&hwmon->xe->drm, "energy read from pmt failed, ret %d\n", ret);
> +			if (ret != -EAGAIN)
> +				drm_warn(&hwmon->xe->drm, "energy read from pmt failed, ret %d\n",
> +					 ret);

[Severity: Medium]
This isn't a bug introduced by this patch, but since we are modifying the
error handling here, does swallowing -EAGAIN break sysfs attribute
registration and runtime energy reporting?

During device initialization, xe_hwmon_register() evaluates sysfs attribute
visibility by calling xe_hwmon_energy_get():

xe_hwmon_energy_is_visible() {
    ...
    if (hwmon->xe->info.platform == XE_BATTLEMAGE) {
        xe_hwmon_energy_get(hwmon, channel, &energy);
        return energy ? 0444 : 0;
    }
    ...
}

Because xe_vsec_init() (which sets PMT base_offset) is called after
xe_hwmon_register() in xe_device.c, the PMT read deterministically returns
-EAGAIN during probe.

By swallowing the error here and resetting the output to 0:

>  			*energy = 0;
>  			return;
>  		}

The visibility check sees energy=0 and permanently hides the sysfs attributes
(e.g., energy1_input) for Battlemage GPUs.

Additionally, if -EAGAIN occurs during a later runtime read in
xe_hwmon_energy_read(), returning 0 microjoules instead of propagating the
error code corrupts power monitoring tools that compute power from this
monotonic accumulator.

Could we change xe_hwmon_energy_get() to return an error code instead of
void so callers can distinguish between an actual 0 value and a failure?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260909154739.1515514-22-michael.j.ruhl@intel.com?part=12

  reply	other threads:[~2026-09-09 16:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09 15:47 [PATCH v7 00/20] Crescent Island PMT support Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 01/20] platform/x86/intel/pmt: complete pcidev to device update Michael J. Ruhl
2026-09-09 16:01   ` sashiko-bot
2026-09-09 15:47 ` [PATCH v7 02/20] platform/x86/intel/pmt: refactor rmw with a return value Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 03/20] platform/x86/intel/pmt: refactor rc " Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 04/20] platform/x86/intel/pmt: Add register access callbacks Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 05/20] platform/x86/intel/pmt: Do not remap when using callbacks Michael J. Ruhl
2026-09-09 16:00   ` sashiko-bot
2026-09-09 15:47 ` [PATCH v7 06/20] drm/xe/vsec: Do not register BMG PMT for VF Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 07/20] drm/xe/vsec: Correct locking order Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 08/20] drm/xe/vsec: Use correct pm state get Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 09/20] drm/xe/vsec: Add DOC text for VSEC Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 10/20] drm/xe/vsec: Support possible hotplug exit Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 11/20] drm/xe/vsec: Refactor BattleMage PMT defines Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 12/20] drm/xe/vsec: Support EAGAIN return value Michael J. Ruhl
2026-09-09 16:01   ` sashiko-bot [this message]
2026-09-11 20:01     ` Ruhl, Michael J
2026-09-09 15:47 ` [PATCH v7 13/20] drm/xe/vsec: Add base_offset to allow for more flexibilty Michael J. Ruhl
2026-09-09 16:02   ` sashiko-bot
2026-09-11 20:03     ` Ruhl, Michael J
2026-09-09 15:47 ` [PATCH v7 14/20] drm/xe/vsec: Support Crescent Island PMT Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 15/20] drm/xe/vsec: Crescent Island PMT decode Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 16/20] drm/xe/vsec: Crescent Island PMT callbacks Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 17/20] drm/xe/vsec: Support late bind fw information Michael J. Ruhl
2026-09-09 16:08   ` sashiko-bot
2026-09-09 15:47 ` [PATCH v7 18/20] drm/xe/vsec: Add PMT GUID internal access Michael J. Ruhl
2026-09-10 18:55   ` Poosa, Karthik
2026-09-09 15:47 ` [PATCH v7 19/20] drm/xe/vsec: Update PMT " Michael J. Ruhl
2026-09-09 15:47 ` [PATCH v7 20/20] drm/xe/vsec: Refactor platform check Michael J. Ruhl
2026-09-09 15:56 ` ✗ CI.checkpatch: warning for Crescent Island PMT support (rev9) Patchwork
2026-09-09 15:57 ` ✗ CI.KUnit: 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=20260909160118.17CDF1F00A3A@smtp.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