Re: [PATCH 1/3] habanalabs: define trace events

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


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

> +DECLARE_EVENT_CLASS(habanalabs_mmu_template,
> + TP_PROTO(struct device *dev, u64 virt_addr, u64 phys_addr, u32 page_size, bool flush_pte),
> +
> + TP_ARGS(dev, virt_addr, phys_addr, page_size, flush_pte),
> +
> + TP_STRUCT__entry(
> + __string(dname, dev_name(dev))
> + __field(u64, virt_addr)
> + __field(u64, phys_addr)
> + __field(u32, page_size)
> + __field(u8, flush_pte)
> + ),
> +
> + TP_fast_assign(
> + __assign_str(dname, dev_name(dev));
> + __entry->virt_addr = virt_addr;
> + __entry->phys_addr = phys_addr;
> + __entry->page_size = page_size;
> + __entry->flush_pte = flush_pte ? 1 : 0;

I think you can just have:

__entry->flush_pte = flush_pte;

as I believe the C standard states that bool is saved as an integer '1' for
'true' and '0' for 'false'.

> + ),
> +

> + TP_printk("%s: vaddr: %#llx, paddr: %#llx, psize: %#x, flush: %u",

If you want this to be a bit nicer looking, you could have "flush: %s",

> + __get_str(dname),
> + __entry->virt_addr,
> + __entry->phys_addr,
> + __entry->page_size,
> + __entry->flush_pte)

And here: __entry->flush_pte ? "true" : "false")

Other than this, from a tracing point of view:

Reviewed-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>

-- Steve


> +);
> +