lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f319e839d4f51c626e36aed6c6e89539a4bde7ee.camel@imgtec.com>
Date:   Tue, 28 Nov 2023 10:34:05 +0000
From:   Donald Robson <Donald.Robson@...tec.com>
To:     "daniel@...ll.ch" <daniel@...ll.ch>,
        Frank Binns <Frank.Binns@...tec.com>,
        Matt Coster <Matt.Coster@...tec.com>,
        "mripard@...nel.org" <mripard@...nel.org>,
        "airlied@...il.com" <airlied@...il.com>,
        "dakr@...hat.com" <dakr@...hat.com>,
        Sarah Walker <Sarah.Walker@...tec.com>
CC:     "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [EXTERNAL] [PATCH drm-misc-next 1/5] drm/imagination: vm: prevent
 duplicate drm_gpuvm_bo instances

Hi Danilo,

Thanks for reviewing this file again and thanks for clarifying the use of these functions.

Reviewed-by: Donald Robson <donald.robson@...tec.com>

On Sat, 2023-11-25 at 00:36 +0100, Danilo Krummrich wrote:
> *** CAUTION: This email originates from a source not known to Imagination Technologies. Think before you click a link or open an attachment ***
> 
> Use drm_gpuvm_bo_obtain() instead of drm_gpuvm_bo_create(). The latter
> should only be used in conjunction with drm_gpuvm_bo_obtain_prealloc().
> 
> drm_gpuvm_bo_obtain() re-uses existing instances of a given VM and BO
> combination, whereas drm_gpuvm_bo_create() would always create a new
> instance of struct drm_gpuvm_bo and hence leave us with duplicates.
> 
> Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
> Signed-off-by: Danilo Krummrich <dakr@...hat.com>
> ---
>  drivers/gpu/drm/imagination/pvr_vm.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagination/pvr_vm.c
> index 3ad1366294b9..09d481c575b0 100644
> --- a/drivers/gpu/drm/imagination/pvr_vm.c
> +++ b/drivers/gpu/drm/imagination/pvr_vm.c
> @@ -224,6 +224,7 @@ pvr_vm_bind_op_map_init(struct pvr_vm_bind_op *bind_op,
>  			struct pvr_gem_object *pvr_obj, u64 offset,
>  			u64 device_addr, u64 size)
>  {
> +	struct drm_gem_object *obj = gem_from_pvr_gem(pvr_obj);
>  	const bool is_user = vm_ctx == vm_ctx->pvr_dev->kernel_vm_ctx;
>  	const u64 pvr_obj_size = pvr_gem_object_size(pvr_obj);
>  	struct sg_table *sgt;
> @@ -245,10 +246,11 @@ pvr_vm_bind_op_map_init(struct pvr_vm_bind_op *bind_op,
>  
>  	bind_op->type = PVR_VM_BIND_TYPE_MAP;
>  
> -	bind_op->gpuvm_bo = drm_gpuvm_bo_create(&vm_ctx->gpuvm_mgr,
> -						gem_from_pvr_gem(pvr_obj));
> -	if (!bind_op->gpuvm_bo)
> -		return -ENOMEM;
> +	dma_resv_lock(obj->resv, NULL);
> +	bind_op->gpuvm_bo = drm_gpuvm_bo_obtain(&vm_ctx->gpuvm_mgr, obj);
> +	dma_resv_unlock(obj->resv);
> +	if (IS_ERR(bind_op->gpuvm_bo))
> +		return PTR_ERR(bind_op->gpuvm_bo);
>  
>  	bind_op->new_va = kzalloc(sizeof(*bind_op->new_va), GFP_KERNEL);
>  	bind_op->prev_va = kzalloc(sizeof(*bind_op->prev_va), GFP_KERNEL);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ