Re: [PATCH v4 7/9] iommu/vt-d: Add trace events for domain map/unmap

Lu Baolu
2019-06-05T06:55:52Z

Hi Steve,

On 6/4/19 5:01 PM, Steven Rostedt wrote:
> On Mon, 3 Jun 2019 09:16:18 +0800
> Lu Baolu <baolu.lu@linux.intel.com> wrote:
>
>
>> +TRACE_EVENT(bounce_unmap_single,
>> + TP_PROTO(struct device *dev, dma_addr_t dev_addr, size_t size),
>> +
>> + TP_ARGS(dev, dev_addr, size),
>> +
>> + TP_STRUCT__entry(
>> + __string(dev_name, dev_name(dev))
>> + __field(dma_addr_t, dev_addr)
>> + __field(size_t, size)
>> + ),
>> +
>> + TP_fast_assign(
>> + __assign_str(dev_name, dev_name(dev));
>> + __entry->dev_addr = dev_addr;
>> + __entry->size = size;
>> + ),
>> +
>> + TP_printk("dev=%s dev_addr=0x%llx size=%zu",
>> + __get_str(dev_name),
>> + (unsigned long long)__entry->dev_addr,
>> + __entry->size)
>> +);
>> +
>> +TRACE_EVENT(bounce_map_sg,
>> + TP_PROTO(struct device *dev, unsigned int i, unsigned int nelems,
>> + dma_addr_t dev_addr, phys_addr_t phys_addr, size_t size),
>> +
>> + TP_ARGS(dev, i, nelems, dev_addr, phys_addr, size),
>> +
>> + TP_STRUCT__entry(
>> + __string(dev_name, dev_name(dev))
>> + __field(unsigned int, i)
>> + __field(unsigned int, last)
>> + __field(dma_addr_t, dev_addr)
>> + __field(phys_addr_t, phys_addr)
>> + __field(size_t, size)
>> + ),
>> +
>> + TP_fast_assign(
>> + __assign_str(dev_name, dev_name(dev));
>> + __entry->i = i;
>> + __entry->last = nelems - 1;
>> + __entry->dev_addr = dev_addr;
>> + __entry->phys_addr = phys_addr;
>> + __entry->size = size;
>> + ),
>> +
>> + TP_printk("dev=%s elem=%u/%u dev_addr=0x%llx phys_addr=0x%llx size=%zu",
>> + __get_str(dev_name), __entry->i, __entry->last,
>> + (unsigned long long)__entry->dev_addr,
>> + (unsigned long long)__entry->phys_addr,
>> + __entry->size)
>> +);
>> +
>> +TRACE_EVENT(bounce_unmap_sg,
>> + TP_PROTO(struct device *dev, unsigned int i, unsigned int nelems,
>> + dma_addr_t dev_addr, phys_addr_t phys_addr, size_t size),
>> +
>> + TP_ARGS(dev, i, nelems, dev_addr, phys_addr, size),
>> +
>> + TP_STRUCT__entry(
>> + __string(dev_name, dev_name(dev))
>> + __field(unsigned int, i)
>> + __field(unsigned int, last)
>> + __field(dma_addr_t, dev_addr)
>> + __field(phys_addr_t, phys_addr)
>> + __field(size_t, size)
>> + ),
>> +
>> + TP_fast_assign(
>> + __assign_str(dev_name, dev_name(dev));
>> + __entry->i = i;
>> + __entry->last = nelems - 1;
>> + __entry->dev_addr = dev_addr;
>> + __entry->phys_addr = phys_addr;
>> + __entry->size = size;
>> + ),
>> +
>> + TP_printk("dev=%s elem=%u/%u dev_addr=0x%llx phys_addr=0x%llx size=%zu",
>> + __get_str(dev_name), __entry->i, __entry->last,
>> + (unsigned long long)__entry->dev_addr,
>> + (unsigned long long)__entry->phys_addr,
>> + __entry->size)
>> +);
>
> These last two events look identical. Please use the
> DECLARE_EVENT_CLASS() to describe the event and then DEFINE_EVENT() for
> the two events.
>
> Each TRACE_EVENT() can add up to 5k of data/text, where as a
> DEFINE_EVENT() just adds around 250 bytes.
>
> (Note, a TRACE_EVENT() is defined as a
> DECLARE_EVENT_CLASS()/DEFINE_EVENT() pair)

Thanks for reviewing. I will rework this patch according to your
comments here.

>
> -- Steve
>

Best regards,
Baolu

>
>> +#endif /* _TRACE_INTEL_IOMMU_H */
>> +
>> +/* This part must be outside protection */
>> +#include <trace/define_trace.h>
>
>