Re: [PATCH v2 03/13] drm/xe/pf: Force new VFs prorities only once

[email protected]
Newsgroups org.freedesktop.lists.intel-xe
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incorrect `num_vfs` argument passed to `pf_config_bulk_set_u32_done()` causes an out-of-bounds log message for VF bounds.
--

--- Patch [3]: [PATCH v2 03/13] drm/xe/pf: Force new VFs prorities only once ---
commit d9a195ee96c85a89ef1ab7a22febed668f958fe6
Author: Michal Wajdeczko <[email protected]>
Subject: drm/xe/pf: Force new VFs prorities only once

This commit defers forcing VF scheduling priority changes until after the
initial change of the SCHED_IF_IDLE policy, preventing overwrites of
individual per-VF priorities. It also moves the priority change code to the
_config component for proper isolation.

> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> index 658e9b048751d..c74745642a925 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

[ ... ]

> +void xe_gt_sriov_pf_config_force_sched_priority_locked(struct xe_gt *gt, u32 priority)
> +{
> +	unsigned int total_vfs = 1 + xe_gt_sriov_pf_get_totalvfs(gt);
> +	struct xe_gt_sriov_config *config;
> +	unsigned int n;
> +
> +	xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
> +	lockdep_assert_held(xe_gt_sriov_pf_master_mutex(gt));
> +
> +	for (n = 0; n < total_vfs; n++) {
> +		config = pf_pick_vf_config(gt, VFID(n));
> +		config->sched_priority = priority;
> +	}
> +
> +	pf_config_bulk_set_u32_done(gt, PFID, 1 + total_vfs, priority,

[Severity: Low]
Does this pass an incorrect bound for the log message?

The variable total_vfs is already initialized as
1 + xe_gt_sriov_pf_get_totalvfs(gt). Adding 1 again here makes the passed
value 2 + xe_gt_sriov_pf_get_totalvfs(gt), which results in an out-of-bounds
log message indicating settings were applied to an incorrect range of VFs.

> +				    pf_get_sched_priority, "scheduling priority",
> +				    sched_priority_unit, n, 0);
> +}
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.