From: sashiko-bot@kernel.org
To: "Nareshkumar Gollakoti" <naresh.kumar.g@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/xe: Expose CRI maximum memory frequency and bandwidth in sysfs
Date: Wed, 18 Nov 2026 07:44:44 +0000 [thread overview]
Message-ID: <sashiko-outbox-220342@kernel.org> (raw)
In-Reply-To: <20261118072506.4159301-4-naresh.kumar.g@intel.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] drm/xe: CFI violation in cri_max_freq_show() and max_bw_show()
callbacks
- [Medium] drm/xe: missing skip_pcode check in memory_groups() exposes 0
on VFs
- [Low] drm/xe: commit message names attribute max_bw_Mbps instead of
max_bw
--
commit f3ff798042aa8ab90bca8ef642079ca40acf46ed
Author: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
drm/xe: Expose CRI maximum memory frequency and bandwidth in sysfs
This commit exposes the maximum achievable memory frequency and bandwidth
reported by firmware on Crescent Island as read-only sysfs attributes under
tile#/memory/ and documents them in the Xe sysfs ABI.
> Expose the maximum achievable memory frequency and bandwidth reported
> by PCODE MEMORY_CONFIG as read-only tile#/memory/max_freq (MHz) and
> tile#/memory/max_bw_Mbps (Mbps) on Crescent Island.
[Severity: Low]
This isn't a bug, but the commit message refers to tile#/memory/max_bw_Mbps
while the code and ABI documentation name the attribute tile#/memory/max_bw.
> diff --git a/drivers/gpu/drm/xe/xe_vram_config.c b/drivers/gpu/drm/xe/xe_vram_config.c
> index 31a3405c39abd..4b8661b8597ac 100644
> --- a/drivers/gpu/drm/xe/xe_vram_config.c
> +++ b/drivers/gpu/drm/xe/xe_vram_config.c
[ ... ]
> @@ -84,11 +90,81 @@ static const struct attribute_group freq_group_attrs = {
> .attrs = freq_attrs,
> };
>
> +static const struct attribute_group *pvc_memory_groups[] = {
> + &freq_group_attrs,
> + NULL
> +};
> +
> +static int memory_config_read(struct device *dev, u32 subcmd, u32 *val)
> +{
> + struct xe_tile *tile = dev_to_tile(dev);
> +
> + guard(xe_pm_runtime)(tile_to_xe(tile));
> +
> + return xe_pcode_read(tile, PCODE_MBOX(PCODE_MEMORY_CONFIG, subcmd, 0),
> + val, NULL);
> +}
> +
> +static ssize_t cri_max_freq_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + u32 val = 0;
> + int err;
> +
> + err = memory_config_read(dev, MEMORY_CONFIG_SUBCOMMAND_READ_MAX_FREQUENCY, &val);
> + if (err)
> + return err;
> +
> + return sysfs_emit(buf, "%u\n", val);
> +}
> +
> +static struct device_attribute dev_attr_cri_max_freq =
> + __ATTR(max_freq, 0444, cri_max_freq_show, NULL);
> +
> +static ssize_t max_bw_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + u32 val = 0;
> + int err;
> +
> + err = memory_config_read(dev, MEMORY_CONFIG_SUBCOMMAND_READ_MAX_BANDWIDTH, &val);
> + if (err)
> + return err;
> +
> + return sysfs_emit(buf, "%u\n", val);
> +}
> +static DEVICE_ATTR_RO(max_bw);
[Severity: High]
Will reading max_freq or max_bw trigger a control flow integrity failure on
kernels built with clang CFI?
xe_vram_config_sysfs_init() attaches cri_memory_groups to the bare kobject
returned by kobject_create_and_add("memory", tile->sysfs), whose ktype uses
kobj_sysfs_ops. When userspace reads either file, kobj_attr_show() casts the
attribute to struct kobj_attribute and calls ->show() with signature
(struct kobject *, struct kobj_attribute *, char *), which mismatches the
struct device_attribute callback signature used here and traps under clang
CFI, as previously fixed in other Xe sysfs files by 4ea512714c42 ("drm/xe:
Fix CFI violation when accessing sysfs files").
Defining these attributes as struct kobj_attribute and passing struct kobject
* to memory_config_read() (using kobj_to_tile(kobj->parent)) avoids the
type mismatch.
> +
> +static struct attribute *cri_memory_attrs[] = {
> + &dev_attr_cri_max_freq.attr,
> + &dev_attr_max_bw.attr,
> + NULL
> +};
> +
> +static const struct attribute_group cri_memory_group_attrs = {
> + .attrs = cri_memory_attrs,
> +};
> +
> +static const struct attribute_group *cri_memory_groups[] = {
> + &cri_memory_group_attrs,
> + NULL
> +};
> +
> +static const struct attribute_group **memory_groups(struct xe_device *xe)
> +{
> + if (xe->info.platform == XE_PVC)
> + return pvc_memory_groups;
> + if (xe->info.platform == XE_CRESCENTISLAND)
> + return cri_memory_groups;
> + return NULL;
> +}
[Severity: Medium]
Should memory_groups() return NULL when xe->info.skip_pcode is set, such as
on Crescent Island SR-IOV virtual functions?
vf_update_device_info() sets xe->info.skip_pcode = 1 on virtual functions,
and xe_tile_init_noalloc() still initializes tile sysfs. When skip_pcode is
set, pcode_mailbox_rw() returns 0 without updating the output value, so
reading max_freq and max_bw on a virtual function silently succeeds and
reports 0.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118072506.4159301-1-naresh.kumar.g@intel.com?part=3
next prev parent reply other threads:[~2026-11-18 7:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 7:25 [PATCH 0/3] drm/xe: Expose CRI memory capability limits via sysfs Nareshkumar Gollakoti
2026-11-18 7:25 ` [PATCH 1/3] drm/xe/pcode: Add MEMORY_CONFIG mailbox definitions Nareshkumar Gollakoti
2026-11-18 7:25 ` [PATCH 2/3] drm/xe: Rename xe_vram_freq to xe_vram_config Nareshkumar Gollakoti
2026-11-18 7:25 ` [PATCH 3/3] drm/xe: Expose CRI maximum memory frequency and bandwidth in sysfs Nareshkumar Gollakoti
2026-11-18 7:44 ` sashiko-bot [this message]
2026-11-18 7:35 ` ✗ CI.checkpatch: warning for drm/xe: Expose CRI memory capability limits via sysfs (rev2) Patchwork
2026-11-18 7:37 ` ✓ CI.KUnit: success " Patchwork
2026-11-18 8:11 ` ✓ Xe.CI.BAT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2026-11-18 6:22 [PATCH 1/3] drm/xe/pcode: Add MEMORY_CONFIG mailbox definitions Nareshkumar Gollakoti
2026-11-18 6:22 ` [PATCH 3/3] drm/xe: Expose CRI maximum memory frequency and bandwidth in sysfs Nareshkumar Gollakoti
2026-11-18 6:44 ` sashiko-bot
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-220342@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=naresh.kumar.g@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