[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241107085923.06707a10@collabora.com>
Date: Thu, 7 Nov 2024 08:59:23 +0100
From: Boris Brezillon <boris.brezillon@...labora.com>
To: Liviu Dudau <liviu.dudau@....com>
Cc: Steven Price <steven.price@....com>, Maarten Lankhorst
<maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, Jann Horn <jannh@...gle.com>
Subject: Re: [PATCH v2] drm/panthor: Lock XArray when getting entries for
the VM
On Wed, 6 Nov 2024 18:58:06 +0000
Liviu Dudau <liviu.dudau@....com> wrote:
> Similar to cac075706f29 ("drm/panthor: Fix race when converting
> group handle to group object") we need to use the XArray's internal
> locking when retrieving a vm pointer from there.
>
> v2: Removed part of the patch that was trying to protect fetching
> the heap pointer from XArray, as that operation is protected by
> the @pool->lock.
>
> Fixes: 647810ec2476 ("drm/panthor: Add the MMU/VM logical block")
> Reported-by: Jann Horn <jannh@...gle.com>
> Cc: Boris Brezillon <boris.brezillon@...labora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@...labora.com>
> Cc: Steven Price <steven.price@....com>
> Signed-off-by: Liviu Dudau <liviu.dudau@....com>
> ---
> drivers/gpu/drm/panthor/panthor_mmu.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> index 8ca85526491e6..46b84a557d9cc 100644
> --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> @@ -1580,7 +1580,9 @@ panthor_vm_pool_get_vm(struct panthor_vm_pool *pool, u32 handle)
> {
> struct panthor_vm *vm;
>
> + xa_lock(&pool->xa);
> vm = panthor_vm_get(xa_load(&pool->xa, handle));
> + xa_unlock(&pool->xa);
>
> return vm;
> }
Powered by blists - more mailing lists