From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Dani Liberman <dliberman@habana.ai>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH] drm/xe: use variable instead of multiple function calls
Date: Tue, 31 Oct 2023 08:13:47 +0200 [thread overview]
Message-ID: <ZUCbG8nOWUZ0e1w3@intel.com> (raw)
In-Reply-To: <20231030193850.560629-1-dliberman@habana.ai>
On Mon, Oct 30, 2023 at 09:38:50PM +0200, Dani Liberman wrote:
> Also changed to positive logic which is more readable.
Please write proper commit messages.
>
> Signed-off-by: Dani Liberman <dliberman@habana.ai>
> ---
> drivers/gpu/drm/xe/xe_exec.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
> index 28e84a0bbeb0..2de6c2c05078 100644
> --- a/drivers/gpu/drm/xe/xe_exec.c
> +++ b/drivers/gpu/drm/xe/xe_exec.c
> @@ -145,7 +145,7 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> struct xe_sched_job *job;
> struct dma_fence *rebind_fence;
> struct xe_vm *vm;
> - bool write_locked;
> + bool write_locked, vm_with_dma_fences;
> ktime_t end = 0;
> int err = 0;
>
> @@ -196,8 +196,9 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> }
> }
>
> + vm_with_dma_fences = !xe_vm_no_dma_fences(vm);
> retry:
> - if (!xe_vm_no_dma_fences(vm) && xe_vm_userptr_check_repin(vm)) {
> + if (vm_with_dma_fences && xe_vm_userptr_check_repin(vm)) {
> err = down_write_killable(&vm->lock);
> write_locked = true;
> } else {
> @@ -279,7 +280,7 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> }
>
> /* Wait behind munmap style rebinds */
> - if (!xe_vm_no_dma_fences(vm)) {
> + if (vm_with_dma_fences) {
> err = drm_sched_job_add_resv_dependencies(&job->drm,
> &vm->resv,
> DMA_RESV_USAGE_KERNEL);
> @@ -292,7 +293,7 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> if (err)
> goto err_put_job;
>
> - if (!xe_vm_no_dma_fences(vm)) {
> + if (vm_with_dma_fences) {
> err = down_read_interruptible(&vm->userptr.notifier_lock);
> if (err)
> goto err_put_job;
> @@ -307,7 +308,7 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> * the job and let the DRM scheduler / backend clean up the job.
> */
> xe_sched_job_arm(job);
> - if (!xe_vm_no_dma_fences(vm)) {
> + if (vm_with_dma_fences) {
> /* Block userptr invalidations / BO eviction */
> dma_resv_add_fence(&vm->resv,
> &job->drm.s_fence->finished,
> @@ -330,14 +331,14 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> xe_sched_job_push(job);
> xe_vm_reactivate_rebind(vm);
>
> - if (!err && !xe_vm_no_dma_fences(vm)) {
> + if (!err && vm_with_dma_fences) {
> spin_lock(&xe->ttm.lru_lock);
> ttm_lru_bulk_move_tail(&vm->lru_bulk_move);
> spin_unlock(&xe->ttm.lru_lock);
> }
>
> err_repin:
> - if (!xe_vm_no_dma_fences(vm))
> + if (vm_with_dma_fences)
> up_read(&vm->userptr.notifier_lock);
> err_put_job:
> if (err)
> --
> 2.34.1
--
Ville Syrjälä
Intel
prev parent reply other threads:[~2023-10-31 6:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-30 19:38 [Intel-xe] [PATCH] drm/xe: use variable instead of multiple function calls Dani Liberman
2023-10-31 0:55 ` Matthew Brost
2023-10-31 6:13 ` Ville Syrjälä [this message]
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=ZUCbG8nOWUZ0e1w3@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dliberman@habana.ai \
--cc=intel-xe@lists.freedesktop.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 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.