include/trace/events/cma.h | 17 ++++++++++++----- mm/cma.c | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-)
From: gaoxiang17 <gaoxiang17@xiaomi.com>
This makes cma info more intuitive during debugging.
Signed-off-by: gaoxiang17 <gaoxiang17@xiaomi.com>
---
include/trace/events/cma.h | 17 ++++++++++++-----
mm/cma.c | 2 +-
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/include/trace/events/cma.h b/include/trace/events/cma.h
index 383c09f583ac..fbe70008ffc7 100644
--- a/include/trace/events/cma.h
+++ b/include/trace/events/cma.h
@@ -38,25 +38,32 @@ TRACE_EVENT(cma_release,
TRACE_EVENT(cma_alloc_start,
- TP_PROTO(const char *name, unsigned long count, unsigned int align),
+ TP_PROTO(const char *name, unsigned long request_count, unsigned long available_count,
+ unsigned long total_count, unsigned int align),
- TP_ARGS(name, count, align),
+ TP_ARGS(name, request_count, available_count, total_count, align),
TP_STRUCT__entry(
__string(name, name)
- __field(unsigned long, count)
+ __field(unsigned long, request_count)
+ __field(unsigned long, available_count)
+ __field(unsigned long, total_count)
__field(unsigned int, align)
),
TP_fast_assign(
__assign_str(name);
- __entry->count = count;
+ __entry->count = request_count;
+ __entry->available_count = available_count;
+ __entry->total_count = total_count;
__entry->align = align;
),
TP_printk("name=%s count=%lu align=%u",
__get_str(name),
- __entry->count,
+ __entry->request_count,
+ __entry->available_count,
+ __entry->total_count,
__entry->align)
);
diff --git a/mm/cma.c b/mm/cma.c
index 2ffa4befb99a..e56ec64d0567 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -864,7 +864,7 @@ static struct page *__cma_alloc(struct cma *cma, unsigned long count,
if (!count)
return page;
- trace_cma_alloc_start(name, count, align);
+ trace_cma_alloc_start(name, count, cma->available_count, cma->count, align);
for (r = 0; r < cma->nranges; r++) {
page = NULL;
--
2.34.1
Hi Xiang, kernel test robot noticed the following build errors: [auto build test ERROR on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/Xiang-Gao/mm-cma-add-available_count-and-total-count-in-trace_cma_alloc_start/20250819-112831 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20250819032654.4345-1-gxxa03070307%40gmail.com patch subject: [PATCH] mm/cma: add available_count and total count in trace_cma_alloc_start config: s390-randconfig-002-20250819 (https://download.01.org/0day-ci/archive/20250819/202508192303.cnpF2rQG-lkp@intel.com/config) compiler: s390-linux-gcc (GCC) 12.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250819/202508192303.cnpF2rQG-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202508192303.cnpF2rQG-lkp@intel.com/ All error/warnings (new ones prefixed by >>): In file included from include/trace/define_trace.h:132, from include/trace/events/cma.h:138, from mm/cma.c:31: include/trace/events/cma.h: In function 'trace_raw_output_cma_alloc_start': >> include/trace/events/cma.h:62:19: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long unsigned int' [-Wformat=] 62 | TP_printk("name=%s count=%lu align=%u", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/trace/trace_events.h:219:34: note: in definition of macro 'DECLARE_EVENT_CLASS' 219 | trace_event_printf(iter, print); \ | ^~~~~ include/trace/trace_events.h:45:30: note: in expansion of macro 'PARAMS' 45 | PARAMS(print)); \ | ^~~~~~ include/trace/events/cma.h:39:1: note: in expansion of macro 'TRACE_EVENT' 39 | TRACE_EVENT(cma_alloc_start, | ^~~~~~~~~~~ include/trace/events/cma.h:62:9: note: in expansion of macro 'TP_printk' 62 | TP_printk("name=%s count=%lu align=%u", | ^~~~~~~~~ In file included from include/trace/trace_events.h:256: include/trace/events/cma.h:62:45: note: format string is defined here 62 | TP_printk("name=%s count=%lu align=%u", | ~^ | | | unsigned int | %lu >> include/trace/events/cma.h:62:19: warning: too many arguments for format [-Wformat-extra-args] 62 | TP_printk("name=%s count=%lu align=%u", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/trace/trace_events.h:219:34: note: in definition of macro 'DECLARE_EVENT_CLASS' 219 | trace_event_printf(iter, print); \ | ^~~~~ include/trace/trace_events.h:45:30: note: in expansion of macro 'PARAMS' 45 | PARAMS(print)); \ | ^~~~~~ include/trace/events/cma.h:39:1: note: in expansion of macro 'TRACE_EVENT' 39 | TRACE_EVENT(cma_alloc_start, | ^~~~~~~~~~~ include/trace/events/cma.h:62:9: note: in expansion of macro 'TP_printk' 62 | TP_printk("name=%s count=%lu align=%u", | ^~~~~~~~~ include/trace/events/cma.h: In function 'do_trace_event_raw_event_cma_alloc_start': >> include/trace/events/cma.h:56:24: error: 'struct trace_event_raw_cma_alloc_start' has no member named 'count' 56 | __entry->count = request_count; | ^~ include/trace/trace_events.h:427:11: note: in definition of macro '__DECLARE_EVENT_CLASS' 427 | { assign; } \ | ^~~~~~ include/trace/trace_events.h:435:23: note: in expansion of macro 'PARAMS' 435 | PARAMS(assign), PARAMS(print)) \ | ^~~~~~ include/trace/trace_events.h:40:9: note: in expansion of macro 'DECLARE_EVENT_CLASS' 40 | DECLARE_EVENT_CLASS(name, \ | ^~~~~~~~~~~~~~~~~~~ include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS' 44 | PARAMS(assign), \ | ^~~~~~ include/trace/events/cma.h:39:1: note: in expansion of macro 'TRACE_EVENT' 39 | TRACE_EVENT(cma_alloc_start, | ^~~~~~~~~~~ include/trace/events/cma.h:54:9: note: in expansion of macro 'TP_fast_assign' 54 | TP_fast_assign( | ^~~~~~~~~~~~~~ In file included from include/trace/define_trace.h:133: include/trace/events/cma.h: In function 'do_perf_trace_cma_alloc_start': >> include/trace/events/cma.h:56:24: error: 'struct trace_event_raw_cma_alloc_start' has no member named 'count' 56 | __entry->count = request_count; | ^~ include/trace/perf.h:51:11: note: in definition of macro '__DECLARE_EVENT_CLASS' 51 | { assign; } \ | ^~~~~~ include/trace/perf.h:67:23: note: in expansion of macro 'PARAMS' 67 | PARAMS(assign), PARAMS(print)) \ | ^~~~~~ include/trace/trace_events.h:40:9: note: in expansion of macro 'DECLARE_EVENT_CLASS' 40 | DECLARE_EVENT_CLASS(name, \ | ^~~~~~~~~~~~~~~~~~~ include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS' 44 | PARAMS(assign), \ | ^~~~~~ include/trace/events/cma.h:39:1: note: in expansion of macro 'TRACE_EVENT' 39 | TRACE_EVENT(cma_alloc_start, | ^~~~~~~~~~~ include/trace/events/cma.h:54:9: note: in expansion of macro 'TP_fast_assign' 54 | TP_fast_assign( | ^~~~~~~~~~~~~~ vim +56 include/trace/events/cma.h 38 > 39 TRACE_EVENT(cma_alloc_start, 40 41 TP_PROTO(const char *name, unsigned long request_count, unsigned long available_count, 42 unsigned long total_count, unsigned int align), 43 44 TP_ARGS(name, request_count, available_count, total_count, align), 45 46 TP_STRUCT__entry( 47 __string(name, name) 48 __field(unsigned long, request_count) 49 __field(unsigned long, available_count) 50 __field(unsigned long, total_count) 51 __field(unsigned int, align) 52 ), 53 54 TP_fast_assign( 55 __assign_str(name); > 56 __entry->count = request_count; 57 __entry->available_count = available_count; 58 __entry->total_count = total_count; 59 __entry->align = align; 60 ), 61 > 62 TP_printk("name=%s count=%lu align=%u", 63 __get_str(name), 64 __entry->request_count, 65 __entry->available_count, 66 __entry->total_count, 67 __entry->align) 68 ); 69 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Xiang, kernel test robot noticed the following build warnings: [auto build test WARNING on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/Xiang-Gao/mm-cma-add-available_count-and-total-count-in-trace_cma_alloc_start/20250819-112831 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20250819032654.4345-1-gxxa03070307%40gmail.com patch subject: [PATCH] mm/cma: add available_count and total count in trace_cma_alloc_start config: x86_64-buildonly-randconfig-002-20250819 (https://download.01.org/0day-ci/archive/20250819/202508192304.gauRFPJE-lkp@intel.com/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250819/202508192304.gauRFPJE-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202508192304.gauRFPJE-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from mm/cma.c:31: In file included from include/trace/events/cma.h:138: In file included from include/trace/define_trace.h:132: In file included from include/trace/trace_events.h:256: >> include/trace/events/cma.h:65:5: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat] 39 | 40 | TP_fast_assign( | ~~~~~~~~~~~~~~~ 41 | __assign_str(name); | ~~~~~~~~~~~~~~~~~~~ 42 | __entry->count = request_count; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | __entry->available_count = available_count; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | __entry->total_count = total_count; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 45 | __entry->align = align; | ~~~~~~~~~~~~~~~~~~~~~~~ 46 | ), | ~~ 47 | 48 | TP_printk("name=%s count=%lu align=%u", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | %lu 49 | __get_str(name), | ~~~~~~~~~~~~~~~~ 50 | __entry->request_count, | ~~~~~~~~~~~~~~~~~~~~~~~ 51 | __entry->available_count, | ^~~~~~~~~~~~~~~~~~~~~~~~~ 52 | __entry->total_count, | ~~~~~~~~~~~~~~~~~~~~~ 53 | __entry->align) | ~~~~~~~~~~~~~~~ 54 | ); | ~ include/trace/stages/stage3_trace_output.h:6:17: note: expanded from macro '__entry' 6 | #define __entry field | ^ include/trace/stages/stage3_trace_output.h:9:43: note: expanded from macro 'TP_printk' 9 | #define TP_printk(fmt, args...) fmt "\n", args | ~~~ ^ include/trace/trace_events.h:45:16: note: expanded from macro 'TRACE_EVENT' 40 | DECLARE_EVENT_CLASS(name, \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 41 | PARAMS(proto), \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | PARAMS(args), \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | PARAMS(tstruct), \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | PARAMS(assign), \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 45 | PARAMS(print)); \ | ~~~~~~~^~~~~~~ include/linux/tracepoint.h:139:25: note: expanded from macro 'PARAMS' 139 | #define PARAMS(args...) args | ^~~~ include/trace/trace_events.h:219:27: note: expanded from macro 'DECLARE_EVENT_CLASS' 219 | trace_event_printf(iter, print); \ | ^~~~~ In file included from mm/cma.c:31: In file included from include/trace/events/cma.h:138: In file included from include/trace/define_trace.h:132: In file included from include/trace/trace_events.h:256: >> include/trace/events/cma.h:66:5: warning: data argument not used by format string [-Wformat-extra-args] 39 | 40 | TP_fast_assign( | ~~~~~~~~~~~~~~~ 41 | __assign_str(name); | ~~~~~~~~~~~~~~~~~~~ 42 | __entry->count = request_count; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | __entry->available_count = available_count; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | __entry->total_count = total_count; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 45 | __entry->align = align; | ~~~~~~~~~~~~~~~~~~~~~~~ 46 | ), | ~~ 47 | 48 | TP_printk("name=%s count=%lu align=%u", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 49 | __get_str(name), | ~~~~~~~~~~~~~~~~ 50 | __entry->request_count, | ~~~~~~~~~~~~~~~~~~~~~~~ 51 | __entry->available_count, | ~~~~~~~~~~~~~~~~~~~~~~~~~ 52 | __entry->total_count, | ^~~~~~~~~~~~~~~~~~~~~ 53 | __entry->align) | ~~~~~~~~~~~~~~~ 54 | ); | ~ include/trace/stages/stage3_trace_output.h:6:17: note: expanded from macro '__entry' 6 | #define __entry field | ^ include/trace/stages/stage3_trace_output.h:9:43: note: expanded from macro 'TP_printk' 9 | #define TP_printk(fmt, args...) fmt "\n", args | ^ include/trace/trace_events.h:45:16: note: expanded from macro 'TRACE_EVENT' 40 | DECLARE_EVENT_CLASS(name, \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 41 | PARAMS(proto), \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | PARAMS(args), \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | PARAMS(tstruct), \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | PARAMS(assign), \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 45 | PARAMS(print)); \ | ~~~~~~~^~~~~~~ include/linux/tracepoint.h:139:25: note: expanded from macro 'PARAMS' 139 | #define PARAMS(args...) args | ^ include/trace/trace_events.h:219:27: note: expanded from macro 'DECLARE_EVENT_CLASS' 219 | trace_event_printf(iter, print); \ | ^~~~~ In file included from mm/cma.c:31: In file included from include/trace/events/cma.h:138: In file included from include/trace/define_trace.h:132: In file included from include/trace/trace_events.h:468: include/trace/events/cma.h:56:12: error: no member named 'count' in 'struct trace_event_raw_cma_alloc_start' 56 | __entry->count = request_count; | ~~~~~~~ ^ include/trace/stages/stage6_event_callback.h:133:33: note: expanded from macro 'TP_fast_assign' 133 | #define TP_fast_assign(args...) args | ^~~~ include/trace/trace_events.h:44:16: note: expanded from macro 'TRACE_EVENT' 44 | PARAMS(assign), \ | ^~~~~~ include/linux/tracepoint.h:139:25: note: expanded from macro 'PARAMS' 139 | #define PARAMS(args...) args | ^~~~ include/trace/trace_events.h:435:16: note: expanded from macro 'DECLARE_EVENT_CLASS' 435 | PARAMS(assign), PARAMS(print)) \ | ^~~~~~ include/linux/tracepoint.h:139:25: note: expanded from macro 'PARAMS' 139 | #define PARAMS(args...) args | ^~~~ include/trace/trace_events.h:427:4: note: expanded from macro '\ __DECLARE_EVENT_CLASS' 427 | { assign; } \ | ^~~~~~ In file included from mm/cma.c:31: In file included from include/trace/events/cma.h:138: In file included from include/trace/define_trace.h:133: In file included from include/trace/perf.h:110: include/trace/events/cma.h:56:12: error: no member named 'count' in 'struct trace_event_raw_cma_alloc_start' 56 | __entry->count = request_count; | ~~~~~~~ ^ include/trace/stages/stage6_event_callback.h:133:33: note: expanded from macro 'TP_fast_assign' 133 | #define TP_fast_assign(args...) args | ^~~~ include/trace/trace_events.h:44:16: note: expanded from macro 'TRACE_EVENT' 44 | PARAMS(assign), \ | ^~~~~~ include/linux/tracepoint.h:139:25: note: expanded from macro 'PARAMS' 139 | #define PARAMS(args...) args | ^~~~ include/trace/perf.h:67:16: note: expanded from macro 'DECLARE_EVENT_CLASS' 67 | PARAMS(assign), PARAMS(print)) \ | ^~~~~~ vim +65 include/trace/events/cma.h 40 41 TP_PROTO(const char *name, unsigned long request_count, unsigned long available_count, 42 unsigned long total_count, unsigned int align), 43 44 TP_ARGS(name, request_count, available_count, total_count, align), 45 46 TP_STRUCT__entry( 47 __string(name, name) 48 __field(unsigned long, request_count) 49 __field(unsigned long, available_count) 50 __field(unsigned long, total_count) 51 __field(unsigned int, align) 52 ), 53 54 TP_fast_assign( 55 __assign_str(name); 56 __entry->count = request_count; 57 __entry->available_count = available_count; 58 __entry->total_count = total_count; 59 __entry->align = align; 60 ), 61 62 TP_printk("name=%s count=%lu align=%u", 63 __get_str(name), 64 __entry->request_count, > 65 __entry->available_count, > 66 __entry->total_count, 67 __entry->align) 68 ); 69 70 TRACE_EVENT(cma_alloc_finish, 71 72 TP_PROTO(const char *name, unsigned long pfn, const struct page *page, 73 unsigned long count, unsigned int align, int errorno), 74 75 TP_ARGS(name, pfn, page, count, align, errorno), 76 77 TP_STRUCT__entry( 78 __string(name, name) 79 __field(unsigned long, pfn) 80 __field(const struct page *, page) 81 __field(unsigned long, count) 82 __field(unsigned int, align) 83 __field(int, errorno) 84 ), 85 86 TP_fast_assign( 87 __assign_str(name); 88 __entry->pfn = pfn; 89 __entry->page = page; 90 __entry->count = count; 91 __entry->align = align; 92 __entry->errorno = errorno; 93 ), 94 95 TP_printk("name=%s pfn=0x%lx page=%p count=%lu align=%u errorno=%d", 96 __get_str(name), 97 __entry->pfn, 98 __entry->page, 99 __entry->count, 100 __entry->align, 101 __entry->errorno) 102 ); 103 104 TRACE_EVENT(cma_alloc_busy_retry, 105 106 TP_PROTO(const char *name, unsigned long pfn, const struct page *page, 107 unsigned long count, unsigned int align), 108 109 TP_ARGS(name, pfn, page, count, align), 110 111 TP_STRUCT__entry( 112 __string(name, name) 113 __field(unsigned long, pfn) 114 __field(const struct page *, page) 115 __field(unsigned long, count) 116 __field(unsigned int, align) 117 ), 118 119 TP_fast_assign( 120 __assign_str(name); 121 __entry->pfn = pfn; 122 __entry->page = page; 123 __entry->count = count; 124 __entry->align = align; 125 ), 126 127 TP_printk("name=%s pfn=0x%lx page=%p count=%lu align=%u", 128 __get_str(name), 129 __entry->pfn, 130 __entry->page, 131 __entry->count, 132 __entry->align) 133 ); 134 135 #endif /* _TRACE_CMA_H */ 136 137 /* This part must be outside protection */ > 138 #include <trace/define_trace.h> -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
On 19.08.25 05:26, Xiang Gao wrote: > From: gaoxiang17 <gaoxiang17@xiaomi.com> Nit regarding subject: "mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start" Acked-by: David Hildenbrand <david@redhat.com> -- Cheers David / dhildenb
© 2016 - 2025 Red Hat, Inc.