diff mbox series

nouveau: Fix migrate_to_ram() for faulting page

Message ID 20221019122934.866205-1-apopple@nvidia.com (mailing list archive)
State New
Headers show
Series nouveau: Fix migrate_to_ram() for faulting page | expand

Commit Message

Alistair Popple Oct. 19, 2022, 12:29 p.m. UTC
Commit 16ce101db85d ("mm/memory.c: fix race when faulting a device private
page") changed the migrate_to_ram() callback to take a reference on the
device page to ensure it can't be freed while handling the fault.
Unfortunately the corresponding update to Nouveau to accommodate this
change was inadvertently dropped from that patch causing GPU to CPU
migration to fail so add it here.

Signed-off-by: Alistair Popple <apopple@nvidia.com>
Fixes: 16ce101db85d ("mm/memory.c: fix race when faulting a device private page")
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Ben Skeggs <bskeggs@redhat.com>

---

Hi Andrew/Ben, apologies I must have accidentally dropped this small hunk
when rebasing prior to sending v2 of the original series. Without this
migration from GPU to CPU won't work in Nouveau so hopefully one of you can
take this for v6.1-rcX. Thanks.
---
 drivers/gpu/drm/nouveau/nouveau_dmem.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Lyude Paul Oct. 21, 2022, 7:53 p.m. UTC | #1
On Wed, 2022-10-19 at 23:29 +1100, Alistair Popple wrote:
> Commit 16ce101db85d ("mm/memory.c: fix race when faulting a device private
> page") changed the migrate_to_ram() callback to take a reference on the
> device page to ensure it can't be freed while handling the fault.
> Unfortunately the corresponding update to Nouveau to accommodate this
> change was inadvertently dropped from that patch causing GPU to CPU
> migration to fail so add it here.
> 
> Signed-off-by: Alistair Popple <apopple@nvidia.com>
> Fixes: 16ce101db85d ("mm/memory.c: fix race when faulting a device private page")
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: Ralph Campbell <rcampbell@nvidia.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> 
> ---
> 
> Hi Andrew/Ben, apologies I must have accidentally dropped this small hunk
> when rebasing prior to sending v2 of the original series. Without this
> migration from GPU to CPU won't work in Nouveau so hopefully one of you can
> take this for v6.1-rcX. Thanks.

Hi!

Reviewed-by: Lyude Paul <lyude@redhat.com>

I will push this to drm-misc-next in just a moment, thanks for the patch!

> ---
>  drivers/gpu/drm/nouveau/nouveau_dmem.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> index 5fe209107246..20fe53815b20 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> @@ -176,6 +176,7 @@ static vm_fault_t nouveau_dmem_migrate_to_ram(struct vm_fault *vmf)
>  		.src		= &src,
>  		.dst		= &dst,
>  		.pgmap_owner	= drm->dev,
> +		.fault_page	= vmf->page,
>  		.flags		= MIGRATE_VMA_SELECT_DEVICE_PRIVATE,
>  	};
>
Andrew Morton Oct. 21, 2022, 8:49 p.m. UTC | #2
On Fri, 21 Oct 2022 15:53:19 -0400 Lyude Paul <lyude@redhat.com> wrote:

> > Hi Andrew/Ben, apologies I must have accidentally dropped this small hunk
> > when rebasing prior to sending v2 of the original series. Without this
> > migration from GPU to CPU won't work in Nouveau so hopefully one of you can
> > take this for v6.1-rcX. Thanks.
> 
> Hi!
> 
> Reviewed-by: Lyude Paul <lyude@redhat.com>
> 
> I will push this to drm-misc-next in just a moment, thanks for the patch!

Linus merged it but minutes ago.
Lyude Paul Oct. 21, 2022, 9:10 p.m. UTC | #3
On Fri, 2022-10-21 at 13:49 -0700, Andrew Morton wrote:
> On Fri, 21 Oct 2022 15:53:19 -0400 Lyude Paul <lyude@redhat.com> wrote:
> 
> > > Hi Andrew/Ben, apologies I must have accidentally dropped this small hunk
> > > when rebasing prior to sending v2 of the original series. Without this
> > > migration from GPU to CPU won't work in Nouveau so hopefully one of you can
> > > take this for v6.1-rcX. Thanks.
> > 
> > Hi!
> > 
> > Reviewed-by: Lyude Paul <lyude@redhat.com>
> > 
> > I will push this to drm-misc-next in just a moment, thanks for the patch!
> 
> Linus merged it but minutes ago.

Agh, sorry about that - I already pushed this over an hour ago

>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c
index 5fe209107246..20fe53815b20 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
@@ -176,6 +176,7 @@  static vm_fault_t nouveau_dmem_migrate_to_ram(struct vm_fault *vmf)
 		.src		= &src,
 		.dst		= &dst,
 		.pgmap_owner	= drm->dev,
+		.fault_page	= vmf->page,
 		.flags		= MIGRATE_VMA_SELECT_DEVICE_PRIVATE,
 	};