mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arvind Yadav <arvind.yadav@intel.com>
To: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Cc: matthew.brost@intel.com, thomas.hellstrom@linux.intel.com,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
	himal.prasad.ghimiray@intel.com
Subject: [PATCH v2 0/2] Fix invalidated inline DMA mappings in GPUSVM
Date: Fri,  4 Dec 2026 12:23:16 +0530	[thread overview]
Message-ID: <20261204065318.1785149-1-arvind.yadav@intel.com> (raw)

Invalidation during HMM can leave stale inline DMA state. This skips
DMA array allocation and makes the mapper use a DMA address as an
array pointer, causing a KASAN report in the Xe prefetch worker.

  ===================================================================
  BUG: KASAN: user-memory-access in drm_gpusvm_get_pages+0xe12/0x1380 [drm_gpusvm_helper]
  Write of size 16 at addr 000000027abfd000 by task kworker/u64:71/693678
  Workqueue: xe_prefetch_work_queue prefetch_work_func [xe]


Following Matt's suggestion, clear inline DMA state during unmap
instead of adding another retry after HMM.

Prepare Xe first by copying inline entries under notifier_lock for
page-table staging. When an invalidated userptr stages cleared PTEs,
preserve that state in tile_invalidated at commit.

Changes in v2:
- Clear inline DMA state during unmap instead of retrying after HMM
  (Matthew Brost).
- Add the Xe snapshot patch and track cleared PTEs through commit.
- Update the inline DMA helper's lifetime documentation.

Arvind Yadav (2):
  drm/xe: Snapshot inline DMA addresses before staging page tables
  drm/gpusvm: Clear inline DMA mapping state on unmap

 drivers/gpu/drm/drm_gpusvm.c     |  5 ++
 drivers/gpu/drm/xe/xe_pt.c       | 82 ++++++++++++++++++++++++++++----
 drivers/gpu/drm/xe/xe_pt_types.h |  2 +
 include/drm/drm_gpusvm.h         | 14 +++---
 4 files changed, 89 insertions(+), 14 deletions(-)

-- 
2.43.0


             reply	other threads:[~2026-12-04  6:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  6:53 Arvind Yadav [this message]
2026-12-04  6:53 ` [PATCH v2 1/2] drm/xe: Snapshot inline DMA addresses before staging page tables Arvind Yadav
2026-12-04  6:53 ` [PATCH v2 2/2] drm/gpusvm: Clear inline DMA mapping state on unmap Arvind Yadav

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=20261204065318.1785149-1-arvind.yadav@intel.com \
    --to=arvind.yadav@intel.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tzimmermann@suse.de \
    /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®