mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Deborah Brouwer <deborah.brouwer@collabora.com>
To: Danilo Krummrich <dakr@kernel.org>,
	Alice Ryhl <aliceryhl@google.com>,
	 Daniel Almeida <daniel.almeida@collabora.com>,
	 David Airlie <airlied@gmail.com>,
	Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	 Deborah Brouwer <deborah.brouwer@collabora.com>,
	sunke@kylinos.cn,  alvin.sun@linux.dev
Subject: [PATCH 1/2] drm/tyr: get preallocated gpuva before mapping starts
Date: Fri, 04 Dec 2026 16:53:42 -0700	[thread overview]
Message-ID: <20261204-b4-mark_failed-v1-1-39a5dca6d594@collabora.com> (raw)
In-Reply-To: <20261204-b4-mark_failed-v1-0-39a5dca6d594@collabora.com>

Currently, it is possible for a page table mapping to succeed, while the
call to obtain a preallocated gpuva could fail, so that an error is
returned before gpuvm is updated with the new mapping.

Avoid this scenario by obtaining the preallocated gpuva before the page
table is modified.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
---
 drivers/gpu/drm/tyr/vm.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tyr/vm.rs b/drivers/gpu/drm/tyr/vm.rs
index 323ad647ad19..e80f2cdd0fb5 100644
--- a/drivers/gpu/drm/tyr/vm.rs
+++ b/drivers/gpu/drm/tyr/vm.rs
@@ -659,6 +659,9 @@ fn sm_step_map<'op>(
             return Err(EINVAL);
         }
 
+        // Return any error here before modifying the page table.
+        let gpuva = context.preallocated_gpuva()?;
+
         let sgt = op.obj().sg_table(context.dev).inspect_err(|e| {
             dev_err!(context.dev, "Failed to get sg_table: {:?}", e);
         })?;
@@ -729,7 +732,6 @@ fn sm_step_map<'op>(
             return Err(EINVAL);
         }
 
-        let gpuva = context.preallocated_gpuva()?;
         let op = op.insert(gpuva, GpuVaData { prot });
 
         Ok(op)

-- 
2.56.0


  reply	other threads:[~2026-12-04 23:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 23:53 [PATCH 0/2] drm/tyr: unmap regions out-of-sync with gpuvm Deborah Brouwer
2026-12-04 23:53 ` Deborah Brouwer [this message]
2026-12-04 23:53 ` [PATCH 2/2] " Deborah Brouwer

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=20261204-b4-mark_failed-v1-1-39a5dca6d594@collabora.com \
    --to=deborah.brouwer@collabora.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=alvin.sun@linux.dev \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=sunke@kylinos.cn \
    /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

all inboxes | Powered by JetHome®