From: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 03/13] drm/xe/pf: Force new VFs prorities only once
Date: Thu, 2 Apr 2026 12:22:40 +0200 [thread overview]
Message-ID: <20260402102240.7h7elsv254d3ey42@intel.com> (raw)
In-Reply-To: <20260330204046.567-4-michal.wajdeczko@intel.com>
Michal Wajdeczko <michal.wajdeczko@intel.com> wrote on pon [2026-mar-30 22:40:34 +0200]:
> We should force change of VFs scheduling priorities only after
> initial change of the SCHED_IF_IDLE policy. Doing that also during
> any later policy reprovisioning will overwrite changes done on the
> individual per-VF scheduling priorities (currently only for PF).
>
> While around also move priority change code to the _config component
> to maintain a proper isolation. Also document our expectation about
> the GuC version where the new meaning of the policy KLV is present.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 28 ++++++++++++++
> drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h | 1 +
> drivers/gpu/drm/xe/xe_gt_sriov_pf_policy.c | 44 ++++++++++------------
> 3 files changed, 48 insertions(+), 25 deletions(-)
>
> 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 658e9b048751..e1c028176eb8 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> @@ -2550,6 +2550,34 @@ u32 xe_gt_sriov_pf_config_get_sched_priority(struct xe_gt *gt, unsigned int vfid
> return priority;
> }
>
> +/**
> + * xe_gt_sriov_pf_config_force_sched_priority_locked() - Force update scheduling priority.
> + * @gt: the &xe_gt
> + * @priority: new scheduling priority to set
> + *
> + * This function allows to update cached values of the scheduling priorities of all
> + * VFs (and PF) as result of applying the `GUC_KLV_VGT_POLICY_SCHED_IF_IDLE`_ policy.
> + *
> + * This function can only be called on PF.
> + */
> +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)));
I will add:
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,
> + pf_get_sched_priority, "scheduling priority",
> + sched_priority_unit, n, 0);
> +}
> +
> static void pf_reset_config_sched(struct xe_gt *gt, struct xe_gt_sriov_config *config)
> {
> int i;
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h
> index 4a004ecd6140..e9314f0a9b4e 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h
> @@ -71,6 +71,7 @@ int xe_gt_sriov_pf_config_set_groups_preempt_timeouts(struct xe_gt *gt, unsigned
>
> u32 xe_gt_sriov_pf_config_get_sched_priority(struct xe_gt *gt, unsigned int vfid);
> int xe_gt_sriov_pf_config_set_sched_priority(struct xe_gt *gt, unsigned int vfid, u32 priority);
> +void xe_gt_sriov_pf_config_force_sched_priority_locked(struct xe_gt *gt, u32 priority);
>
> u32 xe_gt_sriov_pf_config_get_threshold(struct xe_gt *gt, unsigned int vfid,
> enum xe_guc_klv_threshold_index index);
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_policy.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_policy.c
> index 848e24926ecd..6ab02e96e46c 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_policy.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_policy.c
> @@ -8,6 +8,7 @@
> #include "abi/guc_actions_sriov_abi.h"
>
> #include "xe_gt.h"
> +#include "xe_gt_sriov_pf_config.h"
> #include "xe_gt_sriov_pf_helpers.h"
> #include "xe_gt_sriov_pf_policy.h"
> #include "xe_gt_sriov_printk.h"
> @@ -153,33 +154,14 @@ static int pf_update_policy_u32(struct xe_gt *gt, u16 key, u32 *policy, u32 valu
> return 0;
> }
>
> -static void pf_bulk_reset_sched_priority(struct xe_gt *gt, u32 priority)
> -{
> - unsigned int total_vfs = 1 + xe_gt_sriov_pf_get_totalvfs(gt);
> - 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++)
> - gt->sriov.pf.vfs[n].config.sched_priority = priority;
> -}
> -
> static int pf_provision_sched_if_idle(struct xe_gt *gt, bool enable)
> {
> - int err;
> -
> xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
> lockdep_assert_held(xe_gt_sriov_pf_master_mutex(gt));
>
> - err = pf_update_policy_bool(gt, GUC_KLV_VGT_POLICY_SCHED_IF_IDLE_KEY,
> - >->sriov.pf.policy.guc.sched_if_idle,
> - enable);
> -
> - if (!err)
> - pf_bulk_reset_sched_priority(gt, enable ? GUC_SCHED_PRIORITY_NORMAL :
> - GUC_SCHED_PRIORITY_LOW);
> - return err;
> + return pf_update_policy_bool(gt, GUC_KLV_VGT_POLICY_SCHED_IF_IDLE_KEY,
> + >->sriov.pf.policy.guc.sched_if_idle,
> + enable);
> }
>
> static int pf_reprovision_sched_if_idle(struct xe_gt *gt)
> @@ -209,13 +191,25 @@ static void pf_sanitize_sched_if_idle(struct xe_gt *gt)
> */
> int xe_gt_sriov_pf_policy_set_sched_if_idle(struct xe_gt *gt, bool enable)
> {
> + u32 priority;
> int err;
>
> - mutex_lock(xe_gt_sriov_pf_master_mutex(gt));
> + guard(mutex)(xe_gt_sriov_pf_master_mutex(gt));
> +
> err = pf_provision_sched_if_idle(gt, enable);
> - mutex_unlock(xe_gt_sriov_pf_master_mutex(gt));
> + if (err)
> + return err;
>
> - return err;
> + /*
> + * As of GuC 70.12 a change of this policy impacts individual configs
> + * of all VFs. See `GUC_KLV_VGT_POLICY_SCHED_IF_IDLE`_ for details.
> + */
> + xe_gt_assert(gt, GUC_FIRMWARE_VER_AT_LEAST(>->uc.guc, 70, 12));
> +
> + priority = enable ? GUC_SCHED_PRIORITY_NORMAL : GUC_SCHED_PRIORITY_LOW;
> + xe_gt_sriov_pf_config_force_sched_priority_locked(gt, priority);
> +
> + return 0;
> }
>
LGTM:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> /**
> --
> 2.47.1
>
--
next prev parent reply other threads:[~2026-04-02 10:22 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 20:40 [PATCH 00/13] drm/xe/pf: Improve EQ/PT provisioning Michal Wajdeczko
2026-03-30 20:40 ` [PATCH 01/13] drm/xe/guc: Update POLICY_SCHED_IF_IDLE documentation Michal Wajdeczko
2026-04-02 7:54 ` Piotr Piórkowski
2026-03-30 20:40 ` [PATCH 02/13] drm/xe/pf: Fix pf_get_sched_priority() function signature Michal Wajdeczko
2026-04-02 7:55 ` Piotr Piórkowski
2026-03-30 20:40 ` [PATCH 03/13] drm/xe/pf: Force new VFs prorities only once Michal Wajdeczko
2026-04-02 10:22 ` Piotr Piórkowski [this message]
2026-04-02 16:13 ` Michal Wajdeczko
2026-03-30 20:40 ` [PATCH 04/13] drm/xe/pf: Print applied policy KLVs Michal Wajdeczko
2026-04-02 10:56 ` Piotr Piórkowski
2026-03-30 20:40 ` [PATCH 05/13] drm/xe/pf: Reprovision policy settings after GT reset Michal Wajdeczko
2026-04-02 11:23 ` Piotr Piórkowski
2026-03-30 20:40 ` [PATCH 06/13] drm/xe/pf: Don't reprovision policies if already default Michal Wajdeczko
2026-04-02 11:23 ` Piotr Piórkowski
2026-03-30 20:40 ` [PATCH 07/13] drm/xe/pf: Encode scheduling priority KLV if needed Michal Wajdeczko
2026-04-02 13:18 ` Piotr Piórkowski
2026-03-30 20:40 ` [PATCH 08/13] drm/xe/pf: Check EQ/PT/PRIO when testing VF config Michal Wajdeczko
2026-04-02 13:30 ` Piotr Piórkowski
2026-03-30 20:40 ` [PATCH 09/13] drm/xe/pf: Allow to change sched_if_idle policy under lock Michal Wajdeczko
2026-04-02 13:33 ` Piotr Piórkowski
2026-03-30 20:40 ` [PATCH 10/13] drm/xe/pf: Reprovision scheduling to default when no VFs Michal Wajdeczko
2026-04-02 15:22 ` Piotr Piórkowski
2026-03-30 20:40 ` [PATCH 11/13] drm/xe/pf: Extract helper to show which VFs are provisioned Michal Wajdeczko
2026-04-02 15:40 ` Piotr Piórkowski
2026-03-30 20:40 ` [PATCH 12/13] drm/xe/pf: Extract helpers for bulk EQ/PT provisioning Michal Wajdeczko
2026-04-02 15:57 ` Piotr Piórkowski
2026-03-30 20:40 ` [PATCH 13/13] drm/xe/pf: Perform fair scheduling auto-provisioning Michal Wajdeczko
2026-04-02 16:06 ` Piotr Piórkowski
2026-03-30 21:09 ` ✓ CI.KUnit: success for drm/xe/pf: Improve EQ/PT provisioning Patchwork
2026-03-30 21:41 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-31 0:28 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-02 16:20 ` Michal Wajdeczko
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=20260402102240.7h7elsv254d3ey42@intel.com \
--to=piotr.piorkowski@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox