Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Satyanarayana K V P" <satyanarayana.k.v.p@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Matthew Brost" <matthew.brost@intel.com>
Subject: [PATCH v2 7/7] drm/xe/sriov: support non-contig VRAM provisioning
Date: Wed, 18 Dec 2024 12:18:45 +0000	[thread overview]
Message-ID: <20241218121837.226393-16-matthew.auld@intel.com> (raw)
In-Reply-To: <20241218121837.226393-9-matthew.auld@intel.com>

Currently we can run into issues with provisioning VRAM region, due to
requiring contig VRAM BO underneath. We sometimes see that allocation
(multiple GB) can fail even when there is enough free space.  We don't
need CPU access to the buffer in the first place, so can forgo pin_map
and therefore also the contig requirement. Keep the same behavior with
save and restore during suspend/resume (which can now be done with
blitter).  We also need the VRAM to occupy the same pages so we don't
need to re-program the LMTT, so should still remain pinned (also we
don't want something to try evict it). With that covert over to plain
pinned kernel object.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 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 65082f12f1a8..56a178aca0d4 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
@@ -1409,15 +1409,22 @@ static int pf_provision_vf_lmem(struct xe_gt *gt, unsigned int vfid, u64 size)
 		return 0;
 
 	xe_gt_assert(gt, pf_get_lmem_alignment(gt) == SZ_2M);
-	bo = xe_bo_create_pin_map(xe, tile, NULL,
-				  ALIGN(size, PAGE_SIZE),
-				  ttm_bo_type_kernel,
-				  XE_BO_FLAG_VRAM_IF_DGFX(tile) |
-				  XE_BO_FLAG_NEEDS_2M |
-				  XE_BO_FLAG_PINNED);
+	bo = xe_bo_create_locked(xe, tile, NULL,
+				 ALIGN(size, PAGE_SIZE),
+				 ttm_bo_type_kernel,
+				 XE_BO_FLAG_VRAM_IF_DGFX(tile) |
+				 XE_BO_FLAG_NEEDS_2M |
+				 XE_BO_FLAG_PINNED);
 	if (IS_ERR(bo))
 		return PTR_ERR(bo);
 
+	err = xe_bo_pin(bo);
+	xe_bo_unlock(bo);
+	if (unlikely(err)) {
+		xe_bo_put(bo);
+		return err;
+	}
+
 	config->lmem_obj = bo;
 
 	err = pf_update_vf_lmtt(xe, vfid);
-- 
2.47.1


  parent reply	other threads:[~2024-12-18 12:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 12:18 [PATCH v2 0/7] Improve SRIOV VRAM provisioning Matthew Auld
2024-12-18 12:18 ` [PATCH v2 1/7] drm/xe: use backup object for pinned save/restore Matthew Auld
2025-01-23  7:39   ` K V P, Satyanarayana
2025-01-23 15:02     ` Matthew Auld
2025-01-24  4:29       ` K V P, Satyanarayana
2024-12-18 12:18 ` [PATCH v2 2/7] drm/xe: split pinned save/restore into phases Matthew Auld
2025-01-23  7:54   ` K V P, Satyanarayana
2024-12-18 12:18 ` [PATCH v2 3/7] drm/xe: Add XE_BO_FLAG_PINNED_NORESTORE Matthew Auld
2025-01-23  7:58   ` K V P, Satyanarayana
2024-12-18 12:18 ` [PATCH v2 4/7] drm/xe: add XE_BO_FLAG_PINNED_EARLY_RESTORE Matthew Auld
2025-01-23  9:02   ` K V P, Satyanarayana
2024-12-18 12:18 ` [PATCH v2 5/7] drm/xe: unconditionally apply PINNED for pin_map() Matthew Auld
2025-01-23  9:07   ` K V P, Satyanarayana
2024-12-18 12:18 ` [PATCH v2 6/7] drm/xe: allow non-contig VRAM kernel BO Matthew Auld
2025-01-23  9:09   ` K V P, Satyanarayana
2024-12-18 12:18 ` Matthew Auld [this message]
2025-01-23  9:30   ` [PATCH v2 7/7] drm/xe/sriov: support non-contig VRAM provisioning K V P, Satyanarayana
2024-12-18 12:55 ` ✓ CI.Patch_applied: success for Improve SRIOV " Patchwork
2024-12-18 12:55 ` ✓ CI.checkpatch: " Patchwork
2024-12-18 12:56 ` ✓ CI.KUnit: " Patchwork
2024-12-18 13:14 ` ✓ CI.Build: " Patchwork
2024-12-18 13:17 ` ✓ CI.Hooks: " Patchwork
2024-12-18 13:18 ` ✓ CI.checksparse: " Patchwork
2024-12-18 13:48 ` ✓ Xe.CI.BAT: " Patchwork
2024-12-18 23:40 ` ✗ Xe.CI.Full: failure " 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=20241218121837.226393-16-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=satyanarayana.k.v.p@intel.com \
    --cc=thomas.hellstrom@linux.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