All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH] drm/xe: Always use xe_vm_queue_rebind_worker helper
Date: Wed, 26 Jul 2023 14:38:22 -0400	[thread overview]
Message-ID: <ZMFoHlNKMhrdT0KR@intel.com> (raw)
In-Reply-To: <20230726163721.353842-1-matthew.brost@intel.com>

On Wed, Jul 26, 2023 at 09:37:21AM -0700, Matthew Brost wrote:
> Do not queue the rebind worker directly, rather use the helper
> xe_vm_queue_rebind_worker. This ensures we use the correct work queue.

Although I believe we need to reduce the usage of the XE_WARN_ON
in favor of WARN_ON, or drm_warn, or err, or dbg, this patch makes
sense to me and any warn_on stuff should be handled in separated
fronts.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> 
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_pt.c |  3 +--
>  drivers/gpu/drm/xe/xe_vm.h | 14 +++++++-------
>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
> index d4660520ac2c..c4270e7747bf 100644
> --- a/drivers/gpu/drm/xe/xe_pt.c
> +++ b/drivers/gpu/drm/xe/xe_pt.c
> @@ -1472,8 +1472,7 @@ __xe_pt_bind_vma(struct xe_tile *tile, struct xe_vma *vma, struct xe_engine *e,
>  		}
>  		if (!rebind && last_munmap_rebind &&
>  		    xe_vm_in_compute_mode(vm))
> -			queue_work(vm->xe->ordered_wq,
> -				   &vm->preempt.rebind_work);
> +			xe_vm_queue_rebind_worker(vm);
>  	} else {
>  		kfree(rfence);
>  		kfree(ifence);
> diff --git a/drivers/gpu/drm/xe/xe_vm.h b/drivers/gpu/drm/xe/xe_vm.h
> index eaf11ac8ff51..4db777d7e375 100644
> --- a/drivers/gpu/drm/xe/xe_vm.h
> +++ b/drivers/gpu/drm/xe/xe_vm.h
> @@ -185,6 +185,12 @@ extern struct ttm_device_funcs xe_ttm_funcs;
>  
>  struct ttm_buffer_object *xe_vm_ttm_bo(struct xe_vm *vm);
>  
> +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_vm_reactivate_rebind() - Reactivate the rebind functionality on compute
>   * vms.
> @@ -198,7 +204,7 @@ static inline void xe_vm_reactivate_rebind(struct xe_vm *vm)
>  {
>  	if (xe_vm_in_compute_mode(vm) && vm->preempt.rebind_deactivated) {
>  		vm->preempt.rebind_deactivated = false;
> -		queue_work(system_unbound_wq, &vm->preempt.rebind_work);
> +		xe_vm_queue_rebind_worker(vm);
>  	}
>  }
>  
> @@ -206,12 +212,6 @@ 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().
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-07-26 18:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 16:37 [Intel-xe] [PATCH] drm/xe: Always use xe_vm_queue_rebind_worker helper Matthew Brost
2023-07-26 18:38 ` Rodrigo Vivi [this message]
2023-07-26 18:49 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-07-26 18:49 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-07-26 18:50 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-07-26 18:54 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-07-26 18:55 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-07-26 18:56 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-07-26 19:31 ` [Intel-xe] ○ CI.BAT: info " Patchwork
2023-07-26 20:02 ` [Intel-xe] [PATCH] " Nirmoy Das

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=ZMFoHlNKMhrdT0KR@intel.com \
    --to=rodrigo.vivi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.