mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Donald Robson <Donald.Robson@imgtec.com>
To: "daniel@ffwll.ch" <daniel@ffwll.ch>,
	Frank Binns <Frank.Binns@imgtec.com>,
	Matt Coster <Matt.Coster@imgtec.com>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"dakr@redhat.com" <dakr@redhat.com>,
	Sarah Walker <Sarah.Walker@imgtec.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [EXTERNAL] [PATCH drm-misc-next 5/5] drm/imagination: vm: make use of GPUVM's drm_exec helper
Date: Tue, 28 Nov 2023 10:47:19 +0000	[thread overview]
Message-ID: <3582c630ee753db6ef1370612e69f36287536912.camel@imgtec.com> (raw)
In-Reply-To: <20231124233650.152653-6-dakr@redhat.com>

Hi Danilo,

Apologies - I guess I should have submitted a patch to handle zero fences in your
locking functions with the final patch series.

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 ***
> 
> Make use of GPUVM's drm_exec helper functions preventing direct access
> to GPUVM internal data structures, such as the external object list.
> 
> This is especially important to ensure following the locking rules
> around the GPUVM external object list.
> 
> Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
> Signed-off-by: Danilo Krummrich <dakr@redhat.com>
> ---
>  drivers/gpu/drm/imagination/pvr_vm.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagination/pvr_vm.c
> index e0d74d9a6190..3f7888f5cc53 100644
> --- a/drivers/gpu/drm/imagination/pvr_vm.c
> +++ b/drivers/gpu/drm/imagination/pvr_vm.c
> @@ -337,27 +337,21 @@ static int
>  pvr_vm_bind_op_lock_resvs(struct drm_exec *exec, struct pvr_vm_bind_op *bind_op)
>  {
>  	drm_exec_until_all_locked(exec) {
> -		struct drm_gem_object *r_obj = &bind_op->vm_ctx->dummy_gem;
>  		struct drm_gpuvm *gpuvm = &bind_op->vm_ctx->gpuvm_mgr;
>  		struct pvr_gem_object *pvr_obj = bind_op->pvr_obj;
> -		struct drm_gpuvm_bo *gpuvm_bo;
>  
>  		/* Acquire lock on the vm_context's reserve object. */
> -		int err = drm_exec_lock_obj(exec, r_obj);
> +		int err = drm_gpuvm_prepare_vm(gpuvm, exec, 0);
>  
>  		drm_exec_retry_on_contention(exec);
>  		if (err)
>  			return err;
>  
>  		/* Acquire lock on all BOs in the context. */
> -		list_for_each_entry(gpuvm_bo, &gpuvm->extobj.list,
> -				    list.entry.extobj) {
> -			err = drm_exec_lock_obj(exec, gpuvm_bo->obj);
> -
> -			drm_exec_retry_on_contention(exec);
> -			if (err)
> -				return err;
> -		}
> +		err = drm_gpuvm_prepare_objects(gpuvm, exec, 0);
> +		drm_exec_retry_on_contention(exec);
> +		if (err)
> +			return err;

Before I discovered the problem when not reserving fences, I was trying to use
drm_gpuvm_exec_lock() with vm_exec->extra.fn() for the part below.  Is there
a reason not to do that now?

Many thanks,
Donald

>  
>  		/* Unmap operations don't have an object to lock. */
>  		if (!pvr_obj)

  reply	other threads:[~2023-11-28 10:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 23:36 [PATCH drm-misc-next 0/5] PowerVR VM fixes Danilo Krummrich
2023-11-24 23:36 ` [PATCH drm-misc-next 1/5] drm/imagination: vm: prevent duplicate drm_gpuvm_bo instances Danilo Krummrich
2023-11-28 10:34   ` [EXTERNAL] " Donald Robson
2023-11-28 13:00   ` (subset) " Maxime Ripard
2023-11-24 23:36 ` [PATCH drm-misc-next 2/5] drm/imagination: vm: check for drm_gpuvm_range_valid() Danilo Krummrich
2023-11-28 10:34   ` [EXTERNAL] " Donald Robson
2023-11-28 13:00   ` (subset) " Maxime Ripard
2023-11-24 23:36 ` [PATCH drm-misc-next 3/5] drm/imagination: vm: fix drm_gpuvm reference count Danilo Krummrich
2023-11-28 10:36   ` Donald Robson
2023-11-28 13:01   ` (subset) " Maxime Ripard
2023-11-24 23:36 ` [PATCH drm-misc-next 4/5] drm/gpuvm: fall back to drm_exec_lock_obj() Danilo Krummrich
2023-11-24 23:40   ` Danilo Krummrich
2023-11-27 13:52     ` Christian König
2023-11-27 17:50       ` Danilo Krummrich
2023-11-24 23:36 ` [PATCH drm-misc-next 5/5] drm/imagination: vm: make use of GPUVM's drm_exec helper Danilo Krummrich
2023-11-28 10:47   ` Donald Robson [this message]
2023-11-28 19:02     ` [EXTERNAL] " Danilo Krummrich
2023-11-27 10:53 ` [PATCH drm-misc-next 0/5] PowerVR VM fixes Frank Binns

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=3582c630ee753db6ef1370612e69f36287536912.camel@imgtec.com \
    --to=donald.robson@imgtec.com \
    --cc=Frank.Binns@imgtec.com \
    --cc=Matt.Coster@imgtec.com \
    --cc=Sarah.Walker@imgtec.com \
    --cc=airlied@gmail.com \
    --cc=dakr@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.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

all inboxes | Powered by JetHome®