diff options
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_handle.c | 4 | ||||
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_ioctl.c | 8 | ||||
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_mm.c | 10 | ||||
-rw-r--r-- | include/trace/events/nvmap.h | 74 |
4 files changed, 76 insertions, 20 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_handle.c b/drivers/video/tegra/nvmap/nvmap_handle.c index 8a92326e9916..f337bdd2fe05 100644 --- a/drivers/video/tegra/nvmap/nvmap_handle.c +++ b/drivers/video/tegra/nvmap/nvmap_handle.c @@ -334,8 +334,10 @@ int nvmap_alloc_handle_id(struct nvmap_client *client, return -EEXIST; } - trace_nvmap_alloc_handle_id(client, id, heap_mask, align, flags); nvmap_stats_inc(NS_TOTAL, PAGE_ALIGN(h->orig_size)); + trace_nvmap_alloc_handle_id(client, id, + h->size, heap_mask, align, flags, + nvmap_stats_read(NS_TOTAL)); h->userflags = flags; nr_page = ((h->size + PAGE_SIZE - 1) >> PAGE_SHIFT); h->secure = !!(flags & NVMAP_HANDLE_SECURE); diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.c b/drivers/video/tegra/nvmap/nvmap_ioctl.c index d1acc7014622..9d1eae5c2487 100644 --- a/drivers/video/tegra/nvmap/nvmap_ioctl.c +++ b/drivers/video/tegra/nvmap/nvmap_ioctl.c @@ -883,8 +883,12 @@ static int do_cache_maint(struct cache_maint_op *cache_work) nvmap_stats_inc(NS_CFLUSH_DONE, cache_maint_inner_threshold); else nvmap_stats_inc(NS_CFLUSH_DONE, pend - pstart); - if (client) - trace_cache_maint(client, h, pstart, pend, op); + trace_nvmap_cache_maint(client, h, pstart, pend, op, pend - pstart); + trace_nvmap_cache_flush(pend - pstart, + nvmap_stats_read(NS_ALLOC), + nvmap_stats_read(NS_CFLUSH_RQ), + nvmap_stats_read(NS_CFLUSH_DONE)); + wmb(); if (h->flags == NVMAP_HANDLE_UNCACHEABLE || h->flags == NVMAP_HANDLE_WRITE_COMBINE || pstart == pend) diff --git a/drivers/video/tegra/nvmap/nvmap_mm.c b/drivers/video/tegra/nvmap/nvmap_mm.c index 07717bbf7042..dc33480d1db5 100644 --- a/drivers/video/tegra/nvmap/nvmap_mm.c +++ b/drivers/video/tegra/nvmap/nvmap_mm.c @@ -20,6 +20,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include <trace/events/nvmap.h> + #include "nvmap_priv.h" void inner_flush_cache_all(void) @@ -54,12 +56,20 @@ void nvmap_flush_cache(struct page **pages, int numpages) bool flush_inner = true; unsigned long base; + nvmap_stats_inc(NS_CFLUSH_RQ, numpages << PAGE_SHIFT); #if defined(CONFIG_NVMAP_CACHE_MAINT_BY_SET_WAYS) if (numpages >= (cache_maint_inner_threshold >> PAGE_SHIFT)) { + nvmap_stats_inc(NS_CFLUSH_DONE, cache_maint_inner_threshold); inner_flush_cache_all(); flush_inner = false; } #endif + if (flush_inner) + nvmap_stats_inc(NS_CFLUSH_DONE, numpages << PAGE_SHIFT); + trace_nvmap_cache_flush(numpages << PAGE_SHIFT, + nvmap_stats_read(NS_ALLOC), + nvmap_stats_read(NS_CFLUSH_RQ), + nvmap_stats_read(NS_CFLUSH_DONE)); for (i = 0; i < numpages; i++) { #ifdef CONFIG_ARM64 //__flush_dcache_page flushes inner and outer on ARM64 diff --git a/include/trace/events/nvmap.h b/include/trace/events/nvmap.h index fe50b0baaa85..5c5627d0c3be 100644 --- a/include/trace/events/nvmap.h +++ b/include/trace/events/nvmap.h @@ -90,32 +90,39 @@ TRACE_EVENT(nvmap_create_handle, TRACE_EVENT(nvmap_alloc_handle_id, TP_PROTO(struct nvmap_client *client, unsigned long handle_id, + size_t size, u32 heap_mask, u32 align, - u32 flags + u32 flags, + u64 total ), - TP_ARGS(client, handle_id, heap_mask, align, flags), + TP_ARGS(client, handle_id, size, heap_mask, align, flags, total), TP_STRUCT__entry( __field(struct nvmap_client *, client) __field(unsigned long, handle_id) + __field(size_t, size) __field(u32, heap_mask) __field(u32, align) __field(u32, flags) + __field(u64, total) ), TP_fast_assign( __entry->client = client; __entry->handle_id = handle_id; + __entry->size = size; __entry->heap_mask = heap_mask; __entry->align = align; __entry->flags = flags; + __entry->total = total; ), - TP_printk("client=%p, id=0x%lx, heap_mask=0x%x, align=%d, flags=0x%x", - __entry->client, __entry->handle_id, __entry->heap_mask, - __entry->align, __entry->flags) + TP_printk("client=%p, id=0x%lx, size=%zu, heap_mask=0x%x, align=%d, flags=0x%x, total=%llu", + __entry->client, __entry->handle_id, __entry->size, + __entry->heap_mask, __entry->align, __entry->flags, + (unsigned long long)__entry->total) ); TRACE_EVENT(nvmap_free_handle_id, @@ -163,22 +170,24 @@ TRACE_EVENT(nvmap_duplicate_handle_id, __entry->client, __entry->handle_id, __entry->ref) ); -TRACE_EVENT(cache_maint, +TRACE_EVENT(nvmap_cache_maint, TP_PROTO(struct nvmap_client *client, struct nvmap_handle *h, - unsigned long start, - unsigned long end, - u32 op + ulong start, + ulong end, + u32 op, + size_t size ), - TP_ARGS(client, h, start, end, op), + TP_ARGS(client, h, start, end, op, size), TP_STRUCT__entry( __field(struct nvmap_client *, client) __field(struct nvmap_handle *, h) - __field(unsigned long, start) - __field(unsigned long, end) + __field(ulong, start) + __field(ulong, end) __field(u32, op) + __field(size_t, size) ), TP_fast_assign( @@ -187,11 +196,42 @@ TRACE_EVENT(cache_maint, __entry->start = start; __entry->end = end; __entry->op = op; + __entry->size = size; ), - TP_printk("client=%p, h=%p, start=0x%lx, end=0x%lx, op=%d", + TP_printk("client=%p, h=%p, start=0x%lx, end=0x%lx, op=%d, size=%zu", __entry->client, __entry->h, __entry->start, - __entry->end, __entry->op) + __entry->end, __entry->op, __entry->size) +); + +TRACE_EVENT(nvmap_cache_flush, + TP_PROTO(size_t size, + u64 alloc_rq, + u64 total_rq, + u64 total_done + ), + + TP_ARGS(size, alloc_rq, total_rq, total_done), + + TP_STRUCT__entry( + __field(size_t, size) + __field(u64, alloc_rq) + __field(u64, total_rq) + __field(u64, total_done) + ), + + TP_fast_assign( + __entry->size = size; + __entry->alloc_rq = alloc_rq; + __entry->total_rq = total_rq; + __entry->total_done = total_done; + ), + + TP_printk("size=%zu, alloc_rq=%llu, total_rq=%llu, total_done=%llu", + __entry->size, + (unsigned long long)__entry->alloc_rq, + (unsigned long long)__entry->total_rq, + (unsigned long long)__entry->total_done) ); TRACE_EVENT(nvmap_map_into_caller_ptr, @@ -370,16 +410,16 @@ DECLARE_EVENT_CLASS(nvmap_dmabuf_2, TP_STRUCT__entry( __field(struct dma_buf *, dbuf) - __field(struct device *, dev) + __string(name, dev_name(dev)) ), TP_fast_assign( __entry->dbuf = dbuf; - __entry->dev = dev; + __assign_str(name, dev_name(dev)); ), TP_printk("dmabuf=%p, device=%s", - __entry->dbuf, dev_name(__entry->dev) + __entry->dbuf, __get_str(name) ) ); |