Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Matthew Auld" <matthew.auld@intel.com>
Subject: [PATCH v2 2/3] drm/xe: Pre-allocate system memory for pinned external bos in the pm notfier
Date: Thu, 18 Sep 2025 11:22:06 +0200	[thread overview]
Message-ID: <20250918092207.54472-3-thomas.hellstrom@linux.intel.com> (raw)
In-Reply-To: <20250918092207.54472-1-thomas.hellstrom@linux.intel.com>

Similarly to what we do for other pinned bos, pre-allocate
system memory for pinned external bos in the pm notifier,
where swapping is still possible.

This hasn't been needed until now when we're about to allow
pinning of exernal VRAM bos.

Cc: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/xe/xe_bo_evict.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_bo_evict.c b/drivers/gpu/drm/xe/xe_bo_evict.c
index d5dbc51e8612..1a12675b2ea9 100644
--- a/drivers/gpu/drm/xe/xe_bo_evict.c
+++ b/drivers/gpu/drm/xe/xe_bo_evict.c
@@ -73,6 +73,11 @@ int xe_bo_notifier_prepare_all_pinned(struct xe_device *xe)
 					    &xe->pinned.late.kernel_bo_present,
 					    xe_bo_notifier_prepare_pinned);
 
+	if (!ret)
+		ret = xe_bo_apply_to_pinned(xe, &xe->pinned.late.external,
+					    &xe->pinned.late.external,
+					    xe_bo_notifier_prepare_pinned);
+
 	return ret;
 }
 
@@ -93,6 +98,10 @@ void xe_bo_notifier_unprepare_all_pinned(struct xe_device *xe)
 	(void)xe_bo_apply_to_pinned(xe, &xe->pinned.late.kernel_bo_present,
 				    &xe->pinned.late.kernel_bo_present,
 				    xe_bo_notifier_unprepare_pinned);
+
+	(void)xe_bo_apply_to_pinned(xe, &xe->pinned.late.external,
+				    &xe->pinned.late.external,
+				    xe_bo_notifier_unprepare_pinned);
 }
 
 /**
-- 
2.51.0


  parent reply	other threads:[~2025-09-18  9:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18  9:22 [PATCH v2 0/3] drm/xe: Allow pinning of VRAM dma-bufs Thomas Hellström
2025-09-18  9:22 ` [PATCH v2 1/3] drm/xe: Don't copy pinned kernel bos twice on suspend Thomas Hellström
2025-09-18  9:38   ` Matthew Auld
2025-09-18  9:22 ` Thomas Hellström [this message]
2025-09-18  9:52   ` [PATCH v2 2/3] drm/xe: Pre-allocate system memory for pinned external bos in the pm notfier Matthew Auld
2025-09-18  9:22 ` [PATCH v2 3/3] drm/xe/dma-buf: Allow pinning of p2p dma-buf Thomas Hellström
2025-09-18 16:10   ` Simona Vetter
2025-09-22  9:11   ` Maarten Lankhorst
2025-09-18  9:40 ` ✓ CI.KUnit: success for drm/xe: Allow pinning of VRAM dma-bufs Patchwork
2025-09-18 10:12 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-18 17:28 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-22 12:27   ` Thomas Hellström

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=20250918092207.54472-3-thomas.hellstrom@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@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