From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>,
John Harrison <John.C.Harrison@Intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [PATCH 2/2] drm/xe/guc: Don't allocate managed BO for each policy change
Date: Tue, 13 May 2025 00:00:18 +0200 [thread overview]
Message-ID: <20250512220018.172-3-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20250512220018.172-1-michal.wajdeczko@intel.com>
We shouldn't use xe_managed_bo_create_from_data() to allocate
temporary BO, as it will be released only on unload and every
change in wedge_mode policy will consume resources (including
precious GGTT). Instead just switchover to GuC buffer cache.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
drivers/gpu/drm/xe/xe_guc_ads.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_guc_ads.c b/drivers/gpu/drm/xe/xe_guc_ads.c
index 44c1fa2fe7c8..07a027755627 100644
--- a/drivers/gpu/drm/xe/xe_guc_ads.c
+++ b/drivers/gpu/drm/xe/xe_guc_ads.c
@@ -20,6 +20,7 @@
#include "xe_gt_ccs_mode.h"
#include "xe_gt_printk.h"
#include "xe_guc.h"
+#include "xe_guc_buf.h"
#include "xe_guc_capture.h"
#include "xe_guc_ct.h"
#include "xe_hw_engine.h"
@@ -994,6 +995,16 @@ static int guc_ads_action_update_policies(struct xe_guc_ads *ads, u32 policy_off
return xe_guc_ct_send(ct, action, ARRAY_SIZE(action), 0, 0);
}
+static int guc_ads_update_policies(struct xe_guc_ads *ads, const struct guc_policies *policies)
+{
+ CLASS(xe_guc_buf_from_data, buf)(&ads_to_guc(ads)->buf, policies, sizeof(*policies));
+
+ if (!xe_guc_buf_is_valid(buf))
+ return -ENOBUFS;
+
+ return guc_ads_action_update_policies(ads, xe_guc_buf_flush(buf));
+}
+
/**
* xe_guc_ads_scheduler_policy_toggle_reset - Toggle reset policy
* @ads: Additional data structures object
@@ -1005,11 +1016,8 @@ static int guc_ads_action_update_policies(struct xe_guc_ads *ads, u32 policy_off
int xe_guc_ads_scheduler_policy_toggle_reset(struct xe_guc_ads *ads)
{
struct xe_device *xe = ads_to_xe(ads);
- struct xe_gt *gt = ads_to_gt(ads);
- struct xe_tile *tile = gt_to_tile(gt);
struct guc_policies *policies;
- struct xe_bo *bo;
- int ret = 0;
+ int ret;
policies = kmalloc(sizeof(*policies), GFP_KERNEL);
if (!policies)
@@ -1023,16 +1031,7 @@ int xe_guc_ads_scheduler_policy_toggle_reset(struct xe_guc_ads *ads)
else
policies->global_flags &= ~GLOBAL_POLICY_DISABLE_ENGINE_RESET;
- bo = xe_managed_bo_create_from_data(xe, tile, policies, sizeof(struct guc_policies),
- XE_BO_FLAG_VRAM_IF_DGFX(tile) |
- XE_BO_FLAG_GGTT);
- if (IS_ERR(bo)) {
- ret = PTR_ERR(bo);
- goto out;
- }
-
- ret = guc_ads_action_update_policies(ads, xe_bo_ggtt_addr(bo));
-out:
+ ret = guc_ads_update_policies(ads, policies);
kfree(policies);
return ret;
}
--
2.47.1
next prev parent reply other threads:[~2025-05-12 22:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 22:00 [PATCH 0/2] Don't allocate managed BO for each policy change Michal Wajdeczko
2025-05-12 22:00 ` [PATCH 1/2] drm/xe/guc: Unblock GuC buffer cache for all modes Michal Wajdeczko
2025-05-12 22:11 ` Matthew Brost
2025-05-13 20:57 ` Lucas De Marchi
2025-05-12 22:32 ` Daniele Ceraolo Spurio
2025-05-12 22:00 ` Michal Wajdeczko [this message]
2025-05-12 22:12 ` [PATCH 2/2] drm/xe/guc: Don't allocate managed BO for each policy change Matthew Brost
2025-05-12 22:15 ` ✓ CI.Patch_applied: success for " Patchwork
2025-05-12 22:15 ` ✓ CI.checkpatch: " Patchwork
2025-05-12 22:16 ` ✓ CI.KUnit: " Patchwork
2025-05-12 22:26 ` ✗ CI.Build: failure " Patchwork
2025-05-13 14:24 ` ✓ CI.Patch_applied: success " Patchwork
2025-05-13 14:24 ` ✓ CI.checkpatch: " Patchwork
2025-05-13 14:25 ` ✓ CI.KUnit: " Patchwork
2025-05-13 14:35 ` ✓ CI.Build: " Patchwork
2025-05-14 18:51 ` ✓ CI.Patch_applied: success for Don't allocate managed BO for each policy change (rev2) Patchwork
2025-05-14 18:51 ` ✓ CI.checkpatch: " Patchwork
2025-05-14 18:53 ` ✓ CI.KUnit: " Patchwork
2025-05-14 19:03 ` ✓ CI.Build: " Patchwork
2025-05-14 19:06 ` ✓ CI.Hooks: " Patchwork
2025-05-14 19:07 ` ✓ CI.checksparse: " Patchwork
2025-05-14 19:59 ` ✓ Xe.CI.BAT: " Patchwork
2025-05-15 3:31 ` ✗ Xe.CI.Full: failure " Patchwork
2025-05-15 6:29 ` Michal Wajdeczko
2025-05-27 0:49 ` ✗ CI.Patch_applied: " 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=20250512220018.172-3-michal.wajdeczko@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=John.C.Harrison@Intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=rodrigo.vivi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.