From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Matthew Brost <matthew.brost@intel.com>,
<intel-xe@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>
Cc: Sashiko <sashiko-bot@kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH v2] drm/pagemap: Clear driver-provided PFNs from migration PFN array
Date: Wed, 22 Jul 2026 11:02:49 +0530 [thread overview]
Message-ID: <0098bedf-a884-48ec-a8fa-0b484b05b4b8@intel.com> (raw)
In-Reply-To: <20260721204353.1082632-1-matthew.brost@intel.com>
On 22-07-2026 02:13, Matthew Brost wrote:
> DRM pagemap overloads the migration PFN array to store driver-provided
> PFNs before calling migrate_vma_*() to finalize the migration. If an
> error occurs during the incremental copy phase, the migration PFN
> entries are reverted to their original state. After reverting the
> device-folio mutations, clear any remaining driver-provided PFNs to
> avoid confusing the migrate_vma_*() helpers.
>
> Also clear any driver-provided PFNs if populate_devmem_pfn() fails, as
> a precaution against stale entries being interpreted as migration PFNs.
>
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Fixes: 3902846af36b ("drm/pagemap Fix error paths in drm_pagemap_migrate_to_devmem")
> Fixes: ec265e1f1cfc ("drm/pagemap: Support source migration over interconnect")
> Cc: stable@vger.kernel.org
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
>
> ---
> v2:
> - Be paranoid and also clear driver-provided on populate_devmem_pfn()
> failure (Sashiko)
> ---
> drivers/gpu/drm/drm_pagemap.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c
> index 15c78eca180b..892b325fa99b 100644
> --- a/drivers/gpu/drm/drm_pagemap.c
> +++ b/drivers/gpu/drm/drm_pagemap.c
> @@ -727,8 +727,10 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation,
> }
>
> err = ops->populate_devmem_pfn(devmem_allocation, npages, migrate.dst);
> - if (err)
> - goto err_aborted_migration;
> + if (err) {
> + npages = 0;
> + goto err_finalize;
> + }
>
> own_pages = 0;
>
> @@ -807,8 +809,11 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation,
> msecs_to_jiffies(mdetails->timeslice_ms);
>
> err_finalize:
> - if (err)
> + if (err) {
> drm_pagemap_migration_unlock_put_pages(npages, migrate.dst);
> + for (i = npages; i < npages_in_range(start, end); ++i)
> + migrate.dst[i] = 0;
> + }
> err_aborted_migration:
> migrate_vma_pages(&migrate);
>
next prev parent reply other threads:[~2026-07-22 5:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 20:43 [PATCH v2] drm/pagemap: Clear driver-provided PFNs from migration PFN array Matthew Brost
2026-07-21 21:20 ` ✗ CI.checkpatch: warning for drm/pagemap: Clear driver-provided PFNs from migration PFN array (rev2) Patchwork
2026-07-21 21:21 ` ✓ CI.KUnit: success " Patchwork
2026-07-21 22:16 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-22 5:32 ` Ghimiray, Himal Prasad [this message]
2026-07-22 10:09 ` ✓ Xe.CI.FULL: " 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=0098bedf-a884-48ec-a8fa-0b484b05b4b8@intel.com \
--to=himal.prasad.ghimiray@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=sashiko-bot@kernel.org \
--cc=stable@vger.kernel.org \
/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