Re: [PATCH 3/3] habanalabs: trace DMA allocations

From: Steven Rostedt
Date: Thu Aug 11 2022 - 09:53:09 EST


On Thu, 11 Aug 2022 14:39:53 +0300
Oded Gabbay <ogabbay@xxxxxxxxxx> wrote:

> @@ -113,11 +116,16 @@ static void *hl_dma_alloc_common(struct hl_device *hdev, size_t size, dma_addr_t
> break;
> }
>
> + if (!ZERO_OR_NULL_PTR(ptr))

If you change the above to:

if (trace_habanalabs_dma_alloc_enabled() && !ZERO_OR_NULL_PTR(ptr))

The conditional check will be skipped when this tracepoint is disabled.

-- Steve


> + trace_habanalabs_dma_alloc(hdev->dev, (u64) (uintptr_t) ptr, *dma_handle, size,
> + caller);
> +
> return ptr;
> }
>