Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: [PATCH 5/5] drm/xe/pf: Adjust scheduling priority based on policy change
Date: Thu, 24 Oct 2024 01:11:52 +0200	[thread overview]
Message-ID: <20241023231152.1815-6-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20241023231152.1815-1-michal.wajdeczko@intel.com>

Local values of scheduling priorities need to be adjusted when
changing the schedule_if_idle policy as those are related.

Disabling schedule_if_idle policy forces the low priority, and
enabling schedule_if_idle policy forces the normal priority.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_sriov_pf_policy.c | 25 +++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

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 fae5be5a2a11..c49983ceac39 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_policy.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_policy.c
@@ -135,14 +135,33 @@ static int pf_update_policy_u32(struct xe_gt *gt, u16 key, u32 *policy, u32 valu
 	return 0;
 }
 
+static void pf_bulk_reset_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.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));
 
-	return pf_update_policy_bool(gt, GUC_KLV_VGT_POLICY_SCHED_IF_IDLE_KEY,
-				     &gt->sriov.pf.policy.guc.sched_if_idle,
-				     enable);
+	err = pf_update_policy_bool(gt, GUC_KLV_VGT_POLICY_SCHED_IF_IDLE_KEY,
+				    &gt->sriov.pf.policy.guc.sched_if_idle,
+				    enable);
+
+	if (!err)
+		pf_bulk_reset_priority(gt, enable ? GUC_SCHED_PRIORITY_NORMAL :
+				       GUC_SCHED_PRIORITY_LOW);
+	return err;
 }
 
 static int pf_reprovision_sched_if_idle(struct xe_gt *gt)
-- 
2.43.0


  parent reply	other threads:[~2024-10-23 23:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23 23:11 [PATCH 0/5] PF: Add support for VF scheduling priority Michal Wajdeczko
2024-10-23 23:11 ` [PATCH 1/5] drm/xe/guc: Add VF_CFG_SCHED_PRIORITY_KEY KLV definition Michal Wajdeczko
2024-10-28 15:34   ` Laguna, Lukasz
2024-10-23 23:11 ` [PATCH 2/5] drm/xe/guc: Add VF_CFG_SCHED_PRIORITY to KLV helper Michal Wajdeczko
2024-10-23 23:11 ` [PATCH 3/5] drm/xe/pf: Add functions to configure VF scheduling priority Michal Wajdeczko
2024-10-23 23:11 ` [PATCH 4/5] drm/xe/pf: Allow to control scheduling priority using debugfs Michal Wajdeczko
2024-10-23 23:11 ` Michal Wajdeczko [this message]
2024-10-24 15:30 ` ✓ CI.Patch_applied: success for PF: Add support for VF scheduling priority Patchwork
2024-10-24 15:30 ` ✓ CI.checkpatch: " Patchwork
2024-10-24 15:31 ` ✓ CI.KUnit: " Patchwork
2024-10-24 15:43 ` ✓ CI.Build: " Patchwork
2024-10-24 15:45 ` ✓ CI.Hooks: " Patchwork
2024-10-24 15:46 ` ✓ CI.checksparse: " Patchwork
2024-10-24 16:12 ` ✗ CI.BAT: failure " Patchwork
2024-10-25 18:37 ` ✗ CI.FULL: " Patchwork
2024-10-28 15:51 ` [PATCH 0/5] " Laguna, Lukasz

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=20241023231152.1815-6-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /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