Nouveau Archive mirror
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@redhat.com>
To: Dave Airlie <airlied@gmail.com>,
	dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org
Cc: Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH] nouveau/uvmm: fix addr/range calcs for remap operations
Date: Thu, 28 Mar 2024 18:07:57 +0100	[thread overview]
Message-ID: <b55be4df-9541-4bbd-8b9e-26f6b48a3dd8@redhat.com> (raw)
In-Reply-To: <20240328024317.2041851-1-airlied@gmail.com>

On 3/28/24 03:43, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> dEQP-VK.sparse_resources.image_rebind.2d_array.r64i.128_128_8
> was causing a remap operation like the below.
> 
> op_remap: prev: 0000003fffed0000 00000000000f0000 00000000a5abd18a 0000000000000000
> op_remap: next:
> op_remap: unmap: 0000003fffed0000 0000000000100000 0
> op_map: map: 0000003ffffc0000 0000000000010000 000000005b1ba33c 00000000000e0000
> 
> This was resulting in an unmap operation from 0x3fffed0000+0xf0000, 0x100000
> which was corrupting the pagetables and oopsing the kernel.

Good catch, thanks for looking into that.

> 
> Fixes the prev + unmap range calcs to use start/end and map back to addr/range.

I like how using start/end instead fixes the issue and keeps it simple.

> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI")
> Cc: Danilo Krummrich <dakr@redhat.com>

Applied the patch to drm-misc-fixes.

> ---
>   drivers/gpu/drm/nouveau/nouveau_uvmm.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
> index 9675ef25b16d..87bce1a9d073 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
> @@ -813,15 +813,15 @@ op_remap(struct drm_gpuva_op_remap *r,
>   	struct drm_gpuva_op_unmap *u = r->unmap;
>   	struct nouveau_uvma *uvma = uvma_from_va(u->va);
>   	u64 addr = uvma->va.va.addr;
> -	u64 range = uvma->va.va.range;
> +	u64 end = uvma->va.va.addr + uvma->va.va.range;
>   
>   	if (r->prev)
>   		addr = r->prev->va.addr + r->prev->va.range;
>   
>   	if (r->next)
> -		range = r->next->va.addr - addr;
> +		end = r->next->va.addr;
>   
> -	op_unmap_range(u, addr, range);
> +	op_unmap_range(u, addr, end - addr);
>   }
>   
>   static int


      reply	other threads:[~2024-03-28 17:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28  2:43 [PATCH] nouveau/uvmm: fix addr/range calcs for remap operations Dave Airlie
2024-03-28 17:07 ` Danilo Krummrich [this message]

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=b55be4df-9541-4bbd-8b9e-26f6b48a3dd8@redhat.com \
    --to=dakr@redhat.com \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=nouveau@lists.freedesktop.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).