mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
2c92ca849f
With the rework of how the __string() handles dynamic strings where it saves off the source string in field in the helper structure[1], the assignment of that value to the trace event field is stored in the helper value and does not need to be passed in again. This means that with: __string(field, mystring) Which use to be assigned with __assign_str(field, mystring), no longer needs the second parameter and it is unused. With this, __assign_str() will now only get a single parameter. There's over 700 users of __assign_str() and because coccinelle does not handle the TRACE_EVENT() macro I ended up using the following sed script: git grep -l __assign_str | while read a ; do sed -e 's/\(__assign_str([^,]*[^ ,]\) *,[^;]*/\1)/' $a > /tmp/test-file; mv /tmp/test-file $a; done I then searched for __assign_str() that did not end with ';' as those were multi line assignments that the sed script above would fail to catch. Note, the same updates will need to be done for: __assign_str_len() __assign_rel_str() __assign_rel_str_len() I tested this with both an allmodconfig and an allyesconfig (build only for both). [1] https://lore.kernel.org/linux-trace-kernel/20240222211442.634192653@goodmis.org/ Link: https://lore.kernel.org/linux-trace-kernel/20240516133454.681ba6a0@rorschach.local.home Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Christian König <christian.koenig@amd.com> for the amdgpu parts. Acked-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> #for Acked-by: Rafael J. Wysocki <rafael@kernel.org> # for thermal Acked-by: Takashi Iwai <tiwai@suse.de> Acked-by: Darrick J. Wong <djwong@kernel.org> # xfs Tested-by: Guenter Roeck <linux@roeck-us.net>
212 lines
5.8 KiB
C
212 lines
5.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0
|
|
*
|
|
* Copyright 2022-2023 HabanaLabs, Ltd.
|
|
* All Rights Reserved.
|
|
*
|
|
*/
|
|
|
|
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM habanalabs
|
|
|
|
#if !defined(_TRACE_HABANALABS_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
#define _TRACE_HABANALABS_H
|
|
|
|
#include <linux/tracepoint.h>
|
|
|
|
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);
|
|
__entry->virt_addr = virt_addr;
|
|
__entry->phys_addr = phys_addr;
|
|
__entry->page_size = page_size;
|
|
__entry->flush_pte = flush_pte;
|
|
),
|
|
|
|
TP_printk("%s: vaddr: %#llx, paddr: %#llx, psize: %#x, flush: %s",
|
|
__get_str(dname),
|
|
__entry->virt_addr,
|
|
__entry->phys_addr,
|
|
__entry->page_size,
|
|
__entry->flush_pte ? "true" : "false")
|
|
);
|
|
|
|
DEFINE_EVENT(habanalabs_mmu_template, habanalabs_mmu_map,
|
|
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));
|
|
|
|
DEFINE_EVENT(habanalabs_mmu_template, habanalabs_mmu_unmap,
|
|
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));
|
|
|
|
DECLARE_EVENT_CLASS(habanalabs_dma_alloc_template,
|
|
TP_PROTO(struct device *dev, u64 cpu_addr, u64 dma_addr, size_t size, const char *caller),
|
|
|
|
TP_ARGS(dev, cpu_addr, dma_addr, size, caller),
|
|
|
|
TP_STRUCT__entry(
|
|
__string(dname, dev_name(dev))
|
|
__field(u64, cpu_addr)
|
|
__field(u64, dma_addr)
|
|
__field(u32, size)
|
|
__field(const char *, caller)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__assign_str(dname);
|
|
__entry->cpu_addr = cpu_addr;
|
|
__entry->dma_addr = dma_addr;
|
|
__entry->size = size;
|
|
__entry->caller = caller;
|
|
),
|
|
|
|
TP_printk("%s: cpu_addr: %#llx, dma_addr: %#llx, size: %#x, caller: %s",
|
|
__get_str(dname),
|
|
__entry->cpu_addr,
|
|
__entry->dma_addr,
|
|
__entry->size,
|
|
__entry->caller)
|
|
);
|
|
|
|
DEFINE_EVENT(habanalabs_dma_alloc_template, habanalabs_dma_alloc,
|
|
TP_PROTO(struct device *dev, u64 cpu_addr, u64 dma_addr, size_t size, const char *caller),
|
|
TP_ARGS(dev, cpu_addr, dma_addr, size, caller));
|
|
|
|
DEFINE_EVENT(habanalabs_dma_alloc_template, habanalabs_dma_free,
|
|
TP_PROTO(struct device *dev, u64 cpu_addr, u64 dma_addr, size_t size, const char *caller),
|
|
TP_ARGS(dev, cpu_addr, dma_addr, size, caller));
|
|
|
|
DECLARE_EVENT_CLASS(habanalabs_dma_map_template,
|
|
TP_PROTO(struct device *dev, u64 phys_addr, u64 dma_addr, size_t len,
|
|
enum dma_data_direction dir, const char *caller),
|
|
|
|
TP_ARGS(dev, phys_addr, dma_addr, len, dir, caller),
|
|
|
|
TP_STRUCT__entry(
|
|
__string(dname, dev_name(dev))
|
|
__field(u64, phys_addr)
|
|
__field(u64, dma_addr)
|
|
__field(u32, len)
|
|
__field(int, dir)
|
|
__field(const char *, caller)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__assign_str(dname);
|
|
__entry->phys_addr = phys_addr;
|
|
__entry->dma_addr = dma_addr;
|
|
__entry->len = len;
|
|
__entry->dir = dir;
|
|
__entry->caller = caller;
|
|
),
|
|
|
|
TP_printk("%s: phys_addr: %#llx, dma_addr: %#llx, len: %#x, dir: %d, caller: %s",
|
|
__get_str(dname),
|
|
__entry->phys_addr,
|
|
__entry->dma_addr,
|
|
__entry->len,
|
|
__entry->dir,
|
|
__entry->caller)
|
|
);
|
|
|
|
DEFINE_EVENT(habanalabs_dma_map_template, habanalabs_dma_map_page,
|
|
TP_PROTO(struct device *dev, u64 phys_addr, u64 dma_addr, size_t len,
|
|
enum dma_data_direction dir, const char *caller),
|
|
TP_ARGS(dev, phys_addr, dma_addr, len, dir, caller));
|
|
|
|
DEFINE_EVENT(habanalabs_dma_map_template, habanalabs_dma_unmap_page,
|
|
TP_PROTO(struct device *dev, u64 phys_addr, u64 dma_addr, size_t len,
|
|
enum dma_data_direction dir, const char *caller),
|
|
TP_ARGS(dev, phys_addr, dma_addr, len, dir, caller));
|
|
|
|
DECLARE_EVENT_CLASS(habanalabs_comms_template,
|
|
TP_PROTO(struct device *dev, char *op_str),
|
|
|
|
TP_ARGS(dev, op_str),
|
|
|
|
TP_STRUCT__entry(
|
|
__string(dname, dev_name(dev))
|
|
__field(char *, op_str)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__assign_str(dname);
|
|
__entry->op_str = op_str;
|
|
),
|
|
|
|
TP_printk("%s: cms: %s",
|
|
__get_str(dname),
|
|
__entry->op_str)
|
|
);
|
|
|
|
DEFINE_EVENT(habanalabs_comms_template, habanalabs_comms_protocol_cmd,
|
|
TP_PROTO(struct device *dev, char *op_str),
|
|
TP_ARGS(dev, op_str));
|
|
|
|
DEFINE_EVENT(habanalabs_comms_template, habanalabs_comms_send_cmd,
|
|
TP_PROTO(struct device *dev, char *op_str),
|
|
TP_ARGS(dev, op_str));
|
|
|
|
DEFINE_EVENT(habanalabs_comms_template, habanalabs_comms_wait_status,
|
|
TP_PROTO(struct device *dev, char *op_str),
|
|
TP_ARGS(dev, op_str));
|
|
|
|
DEFINE_EVENT(habanalabs_comms_template, habanalabs_comms_wait_status_done,
|
|
TP_PROTO(struct device *dev, char *op_str),
|
|
TP_ARGS(dev, op_str));
|
|
|
|
DECLARE_EVENT_CLASS(habanalabs_reg_access_template,
|
|
TP_PROTO(struct device *dev, u32 addr, u32 val),
|
|
|
|
TP_ARGS(dev, addr, val),
|
|
|
|
TP_STRUCT__entry(
|
|
__string(dname, dev_name(dev))
|
|
__field(u32, addr)
|
|
__field(u32, val)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__assign_str(dname);
|
|
__entry->addr = addr;
|
|
__entry->val = val;
|
|
),
|
|
|
|
TP_printk("%s: addr: %#x, val: %#x",
|
|
__get_str(dname),
|
|
__entry->addr,
|
|
__entry->val)
|
|
);
|
|
|
|
DEFINE_EVENT(habanalabs_reg_access_template, habanalabs_rreg32,
|
|
TP_PROTO(struct device *dev, u32 addr, u32 val),
|
|
TP_ARGS(dev, addr, val));
|
|
|
|
DEFINE_EVENT(habanalabs_reg_access_template, habanalabs_wreg32,
|
|
TP_PROTO(struct device *dev, u32 addr, u32 val),
|
|
TP_ARGS(dev, addr, val));
|
|
|
|
DEFINE_EVENT(habanalabs_reg_access_template, habanalabs_elbi_read,
|
|
TP_PROTO(struct device *dev, u32 addr, u32 val),
|
|
TP_ARGS(dev, addr, val));
|
|
|
|
DEFINE_EVENT(habanalabs_reg_access_template, habanalabs_elbi_write,
|
|
TP_PROTO(struct device *dev, u32 addr, u32 val),
|
|
TP_ARGS(dev, addr, val));
|
|
|
|
#endif /* if !defined(_TRACE_HABANALABS_H) || defined(TRACE_HEADER_MULTI_READ) */
|
|
|
|
/* This part must be outside protection */
|
|
#include <trace/define_trace.h>
|