Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Dugast <francois.dugast@intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	himal.prasad.ghimiray@intel.com,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH 1/2] drm/pagemap Fix error paths in drm_pagemap_migrate_to_devmem
Date: Wed, 7 Jan 2026 21:40:20 +0100	[thread overview]
Message-ID: <aV7EtNZ6RHyZZplW@fdugast-desk> (raw)
In-Reply-To: <20260107182716.2236607-2-matthew.brost@intel.com>

On Wed, Jan 07, 2026 at 10:27:15AM -0800, Matthew Brost wrote:
> Avoid unlocking and putting device pages unless they were successfully
> locked, and do not calculate migrated_pages on error paths.
> 
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Fixes: 75af93b3f5d0 ("drm/pagemap, drm/xe: Support destination migration over interconnect")
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>

Reviewed-by: Francois Dugast <francois.dugast@intel.com>

> ---
>  drivers/gpu/drm/drm_pagemap.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c
> index ba099aa7c52f..aa43a8475100 100644
> --- a/drivers/gpu/drm/drm_pagemap.c
> +++ b/drivers/gpu/drm/drm_pagemap.c
> @@ -582,7 +582,7 @@ 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_finalize;
> +		goto err_aborted_migration;
>  
>  	own_pages = 0;
>  
> @@ -621,8 +621,10 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation,
>  		err = drm_pagemap_migrate_range(devmem_allocation, migrate.src, migrate.dst,
>  						pages, pagemap_addr, &last, &cur,
>  						mdetails);
> -		if (err)
> +		if (err) {
> +			npages = i + 1;
>  			goto err_finalize;
> +		}
>  	}
>  	cur.start = npages;
>  	cur.ops = NULL; /* Force migration */
> @@ -646,7 +648,7 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation,
>  err_aborted_migration:
>  	migrate_vma_pages(&migrate);
>  
> -	for (i = 0; i < npages;) {
> +	for (i = 0; !err && i < npages;) {
>  		struct page *page = migrate_pfn_to_page(migrate.src[i]);
>  		unsigned long nr_pages = page ? NR_PAGES(folio_order(page_folio(page))) : 1;
>  
> -- 
> 2.34.1
> 

  reply	other threads:[~2026-01-07 20:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-07 18:27 [PATCH 0/2] Fix a couple drm_pagemap issues with multi-GPU Matthew Brost
2026-01-07 18:27 ` [PATCH 1/2] drm/pagemap Fix error paths in drm_pagemap_migrate_to_devmem Matthew Brost
2026-01-07 20:40   ` Francois Dugast [this message]
2026-01-07 18:27 ` [PATCH 2/2] drm/pagemap: Disable device-to-device migration Matthew Brost
2026-01-07 20:05   ` Francois Dugast
2026-01-07 18:42 ` ✓ CI.KUnit: success for Fix a couple drm_pagemap issues with multi-GPU Patchwork
2026-01-07 19:18 ` ✓ Xe.CI.BAT: " Patchwork
2026-01-07 21:53 ` ✗ 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=aV7EtNZ6RHyZZplW@fdugast-desk \
    --to=francois.dugast@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@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