Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Matthew Brost <matthew.brost@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH 3/3] drm/xe: Use Xe ordered workqueue for rebind worker
Date: Fri, 09 Jun 2023 23:22:59 +0200	[thread overview]
Message-ID: <5d37019e7b99c6f0fa052229a825d8dc9a7448e7.camel@linux.intel.com> (raw)
In-Reply-To: <20230609182627.143150-4-matthew.brost@intel.com>

On Fri, 2023-06-09 at 11:26 -0700, Matthew Brost wrote:
> A mix of the system unbound wq and Xe ordered wq was used for the
> rebind, only use the Xe ordered wq. This will ensure only 1 rebind is
> occuring at a time providing a somewhat clunky work around for short
> comings in TTM wrt to memory contention. Once the TTM memory
> contention
> is resolved we should be able to use a dedicated non-ordered
> workqueue.
> 
> Also add helper to queue rebind worker to avoid using wrong workqueue
> going forward.

Should probably add a mutex as well to protect against competing !LR
execbufs. But let's do a follow-up if needed.

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>


> 
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_preempt_fence.c | 2 +-
>  drivers/gpu/drm/xe/xe_vm.c            | 3 +--
>  drivers/gpu/drm/xe/xe_vm.h            | 6 ++++++
>  3 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_preempt_fence.c
> b/drivers/gpu/drm/xe/xe_preempt_fence.c
> index 78ad8c209873..219eefeb90ff 100644
> --- a/drivers/gpu/drm/xe/xe_preempt_fence.c
> +++ b/drivers/gpu/drm/xe/xe_preempt_fence.c
> @@ -25,7 +25,7 @@ static void preempt_fence_work_func(struct
> work_struct *w)
>         dma_fence_signal(&pfence->base);
>         dma_fence_end_signalling(cookie);
>  
> -       queue_work(system_unbound_wq, &e->vm->preempt.rebind_work);
> +       xe_vm_queue_rebind_worker(e->vm);
>  
>         xe_engine_put(e);
>  }
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 1966a583b761..208e2f0bf41d 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -3103,8 +3103,7 @@ int xe_vm_bind_ioctl(struct drm_device *dev,
> void *data, struct drm_file *file)
>  
>                         /* Rebinds may have been blocked, give worker
> a kick */
>                         if (xe_vm_in_compute_mode(vm))
> -                               queue_work(vm->xe->ordered_wq,
> -                                          &vm->preempt.rebind_work);
> +                               xe_vm_queue_rebind_worker(vm);
>                 }
>  
>                 goto put_engine;
> diff --git a/drivers/gpu/drm/xe/xe_vm.h b/drivers/gpu/drm/xe/xe_vm.h
> index 858207a20017..6086c455a51d 100644
> --- a/drivers/gpu/drm/xe/xe_vm.h
> +++ b/drivers/gpu/drm/xe/xe_vm.h
> @@ -134,6 +134,12 @@ int xe_vma_userptr_pin_pages(struct xe_vma
> *vma);
>  
>  int xe_vma_userptr_check_repin(struct xe_vma *vma);
>  
> +static inline void xe_vm_queue_rebind_worker(struct xe_vm *vm)
> +{
> +       XE_WARN_ON(!xe_vm_in_compute_mode(vm));
> +       queue_work(vm->xe->ordered_wq, &vm->preempt.rebind_work);
> +}
> +
>  /*
>   * XE_ONSTACK_TV is used to size the tv_onstack array that is input
>   * to xe_vm_lock_dma_resv() and xe_vm_unlock_dma_resv().


  parent reply	other threads:[~2023-06-09 21:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 18:26 [Intel-xe] [PATCH 0/3] A rebind fixes Matthew Brost
2023-06-09 18:26 ` [Intel-xe] [PATCH 1/3] drm/xe: Handle unmapped userptr in analyze VM Matthew Brost
2023-06-09 18:36   ` Souza, Jose
2023-06-09 21:18   ` Thomas Hellström
2023-06-09 18:26 ` [Intel-xe] [PATCH 2/3] drm/xe: Ban a VM if rebind worker hits an error Matthew Brost
2023-06-09 18:34   ` Souza, Jose
2023-06-09 18:42     ` Souza, Jose
2023-06-09 20:16       ` Matthew Brost
2023-06-09 20:15     ` Matthew Brost
2023-06-09 21:10   ` Thomas Hellström
2023-06-12 15:47     ` Matthew Brost
2023-06-13 17:11       ` Thomas Hellström
2023-06-09 18:26 ` [Intel-xe] [PATCH 3/3] drm/xe: Use Xe ordered workqueue for rebind worker Matthew Brost
2023-06-09 18:35   ` Souza, Jose
2023-06-09 21:22   ` Thomas Hellström [this message]
2023-06-09 18:28 ` [Intel-xe] ✓ CI.Patch_applied: success for A rebind fixes Patchwork
2023-06-09 18:28 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-06-09 18:30 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-06-09 18:34 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-06-09 18:34 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-06-09 18:35 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-06-09 19:10 ` [Intel-xe] ○ CI.BAT: info " Patchwork

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=5d37019e7b99c6f0fa052229a825d8dc9a7448e7.camel@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    /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