All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
To: Jeffrey Hugo <quic_jhugo@quicinc.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 09/10] accel/ivpu: Improve buffer object debug logs
Date: Wed, 10 Jan 2024 12:08:12 +0100	[thread overview]
Message-ID: <c3b0a181-ef57-407f-af9f-60ead481dd8e@linux.intel.com> (raw)
In-Reply-To: <4814bd7d-fc5f-1252-ffd8-b60197b4d3b6@quicinc.com>


On 05.01.2024 18:03, Jeffrey Hugo wrote:
> On 1/5/2024 4:22 AM, Jacek Lawrynowicz wrote:
>> Make debug logs more readable and consistent:
>>    - don't print handle as it is not always available for all buffers
>>    - use hashed ivpu_bo ptr as main buffer identifier
>>    - remove unused fields from ivpu_bo_print_info()
>>
>> Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
>> ---
>>   drivers/accel/ivpu/ivpu_gem.c | 72 +++++++++++------------------------
>>   drivers/accel/ivpu/ivpu_gem.h |  1 -
>>   2 files changed, 23 insertions(+), 50 deletions(-)
>>
>> diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
>> index 8cb4d337552e..dd327d7eda0d 100644
>> --- a/drivers/accel/ivpu/ivpu_gem.c
>> +++ b/drivers/accel/ivpu/ivpu_gem.c
>> @@ -24,14 +24,11 @@ static const struct drm_gem_object_funcs ivpu_gem_funcs;
>>     static inline void ivpu_dbg_bo(struct ivpu_device *vdev, struct ivpu_bo *bo, const char *action)
>>   {
>> -    if (bo->ctx)
>> -        ivpu_dbg(vdev, BO, "%6s: size %zu has_pages %d dma_mapped %d handle %u ctx %d vpu_addr 0x%llx mmu_mapped %d\n",
>> -             action, ivpu_bo_size(bo), (bool)bo->base.pages, (bool)bo->base.sgt,
>> -             bo->handle, bo->ctx->id, bo->vpu_addr, bo->mmu_mapped);
>> -    else
>> -        ivpu_dbg(vdev, BO, "%6s: size %zu has_pages %d dma_mapped %d handle %u (not added to context)\n",
>> -             action, ivpu_bo_size(bo), (bool)bo->base.pages, (bool)bo->base.sgt,
>> -             bo->handle);
>> +    ivpu_dbg(vdev, BO,
>> +         "%6s: bo %8p vpu_addr %9llx size %8zu ctx %d has_pages %d dma_mapped %d mmu_mapped %d wc %d imported %d\n",
>> +         action, bo, bo->vpu_addr, ivpu_bo_size(bo), bo->ctx ? bo->ctx->id : 0,
>> +         (bool)bo->base.pages, (bool)bo->base.sgt, bo->mmu_mapped, bo->base.map_wc,
>> +         (bool)bo->base.base.import_attach);
>>   }
>>     /*
>> @@ -49,12 +46,7 @@ int __must_check ivpu_bo_pin(struct ivpu_bo *bo)
>>       mutex_lock(&bo->lock);
>>         ivpu_dbg_bo(vdev, bo, "pin");
>> -
>> -    if (!bo->ctx) {
>> -        ivpu_err(vdev, "vpu_addr not allocated for BO %d\n", bo->handle);
>> -        ret = -EINVAL;
>> -        goto unlock;
>> -    }
>> +    drm_WARN_ON(&vdev->drm, !bo->ctx);
>>         if (!bo->mmu_mapped) {
>>           struct sg_table *sgt = drm_gem_shmem_get_pages_sgt(&bo->base);
>> @@ -108,9 +100,7 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
>>   {
>>       struct ivpu_device *vdev = ivpu_bo_to_vdev(bo);
>>   -    lockdep_assert_held(&bo->lock);
>> -
>> -    ivpu_dbg_bo(vdev, bo, "unbind");
>> +    lockdep_assert(lockdep_is_held(&bo->lock) || !kref_read(&bo->base.base.refcount));
>>         if (bo->mmu_mapped) {
>>           drm_WARN_ON(&vdev->drm, !bo->ctx);
>> @@ -122,7 +112,6 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
>>         if (bo->ctx) {
>>           ivpu_mmu_context_remove_node(bo->ctx, &bo->mm_node);
>> -        bo->vpu_addr = 0;
>>           bo->ctx = NULL;
>>       }
>>   @@ -139,13 +128,6 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
>>       dma_resv_unlock(bo->base.base.resv);
>>   }
>>   -static void ivpu_bo_unbind(struct ivpu_bo *bo)
>> -{
>> -    mutex_lock(&bo->lock);
>> -    ivpu_bo_unbind_locked(bo);
>> -    mutex_unlock(&bo->lock);
>> -}
> 
> This does not seem to be related to $SUBJECT

OK, I'll drop this.

>> -
>>   void ivpu_bo_remove_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx)
>>   {
>>       struct ivpu_bo *bo;
>> @@ -156,8 +138,10 @@ void ivpu_bo_remove_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_m
>>       mutex_lock(&vdev->bo_list_lock);
>>       list_for_each_entry(bo, &vdev->bo_list, bo_list_node) {
>>           mutex_lock(&bo->lock);
>> -        if (bo->ctx == ctx)
>> +        if (bo->ctx == ctx) {
>> +            ivpu_dbg_bo(vdev, bo, "unbind");
>>               ivpu_bo_unbind_locked(bo);
>> +        }
>>           mutex_unlock(&bo->lock);
>>       }
>>       mutex_unlock(&vdev->bo_list_lock);
>> @@ -209,9 +193,6 @@ ivpu_bo_create(struct ivpu_device *vdev, u64 size, u32 flags)
>>       list_add_tail(&bo->bo_list_node, &vdev->bo_list);
>>       mutex_unlock(&vdev->bo_list_lock);
>>   -    ivpu_dbg(vdev, BO, "create: vpu_addr 0x%llx size %zu flags 0x%x\n",
>> -         bo->vpu_addr, bo->base.base.size, flags);
>> -
>>       return bo;
>>   }
>>   @@ -243,15 +224,15 @@ static void ivpu_bo_free(struct drm_gem_object *obj)
>>       struct ivpu_device *vdev = to_ivpu_device(obj->dev);
>>       struct ivpu_bo *bo = to_ivpu_bo(obj);
>>   +    ivpu_dbg_bo(vdev, bo, "free");
>> +
>>       mutex_lock(&vdev->bo_list_lock);
>>       list_del(&bo->bo_list_node);
>>       mutex_unlock(&vdev->bo_list_lock);
>>         drm_WARN_ON(&vdev->drm, !dma_resv_test_signaled(obj->resv, DMA_RESV_USAGE_READ));
>>   -    ivpu_dbg_bo(vdev, bo, "free");
>> -
>> -    ivpu_bo_unbind(bo);
>> +    ivpu_bo_unbind_locked(bo);
> 
> This does not seem to be related to $SUBJECT

OK, I'll drop this.

  reply	other threads:[~2024-01-10 11:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05 11:22 [PATCH 00/10] accel/ivpu fixes for 6.8 Jacek Lawrynowicz
2024-01-05 11:22 ` [PATCH 01/10] accel/ivpu: Dump MMU events in case of VPU boot timeout Jacek Lawrynowicz
2024-01-05 15:11   ` Jeffrey Hugo
2024-01-05 11:22 ` [PATCH 02/10] accel/ivpu: Call diagnose failure in ivpu_mmu_cmdq_sync() Jacek Lawrynowicz
2024-01-05 15:12   ` Jeffrey Hugo
2024-01-05 11:22 ` [PATCH 03/10] accel/ivpu: Add debug prints for MMU map/unmap operations Jacek Lawrynowicz
2024-01-05 15:32   ` Jeffrey Hugo
2024-01-09 12:50     ` Jacek Lawrynowicz
2024-01-05 11:22 ` [PATCH 04/10] accel/ivpu: Add diagnostic messages when VPU fails to boot or suspend Jacek Lawrynowicz
2024-01-05 15:41   ` Jeffrey Hugo
2024-01-05 11:22 ` [PATCH 05/10] accel/ivpu: Fix potential infinite loops in IRQ handlers Jacek Lawrynowicz
2024-01-05 16:35   ` Jeffrey Hugo
2024-01-09 12:34     ` Jacek Lawrynowicz
2024-01-05 11:22 ` [PATCH 06/10] accel/ivpu: Fix for missing lock around drm_gem_shmem_vmap() Jacek Lawrynowicz
2024-01-05 16:36   ` Jeffrey Hugo
2024-01-09 12:51     ` Jacek Lawrynowicz
2024-01-05 11:22 ` [PATCH 07/10] accel/ivpu: Free buffer sgt on unbind Jacek Lawrynowicz
2024-01-05 16:37   ` Jeffrey Hugo
2024-01-05 11:22 ` [PATCH 08/10] accel/ivpu: Disable buffer sharing among VPU contexts Jacek Lawrynowicz
2024-01-05 16:46   ` Jeffrey Hugo
2024-01-10 10:53     ` Jacek Lawrynowicz
2024-01-05 22:34   ` Carl Vanderlip
2024-01-10 10:54     ` Jacek Lawrynowicz
2024-01-05 11:22 ` [PATCH 09/10] accel/ivpu: Improve buffer object debug logs Jacek Lawrynowicz
2024-01-05 17:03   ` Jeffrey Hugo
2024-01-10 11:08     ` Jacek Lawrynowicz [this message]
2024-01-05 11:22 ` [PATCH 10/10] accel/ivpu: Remove deprecated DRM_IVPU_PARAM_CONTEXT_PRIORITY Jacek Lawrynowicz
2024-01-05 17:29   ` Jeffrey Hugo
2024-01-10 14:33     ` Jacek Lawrynowicz
2024-01-11 21:03       ` Jeffrey Hugo

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=c3b0a181-ef57-407f-af9f-60ead481dd8e@linux.intel.com \
    --to=jacek.lawrynowicz@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=quic_jhugo@quicinc.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.