Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH 02/13] tracing/IB/hfi1: Use the new __vstring() helper
       [not found] <20220705224453.120955146@goodmis.org>
@ 2022-07-05 22:44 ` Steven Rostedt
  2022-07-06  4:20   ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2022-07-05 22:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Dennis Dalessandro, Jason Gunthorpe,
	Leon Romanovsky, linux-rdma

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Instead of open coding a __dynamic_array() with a fixed length (which
defeats the purpose of the dynamic array in the first place). Use the new
__vstring() helper that will use a va_list and only write enough of the
string into the ring buffer that is needed.

Cc: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: linux-rdma@vger.kernel.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 drivers/infiniband/hw/hfi1/trace_dbg.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/trace_dbg.h b/drivers/infiniband/hw/hfi1/trace_dbg.h
index 707f1053f0b7..582b6f68df3d 100644
--- a/drivers/infiniband/hw/hfi1/trace_dbg.h
+++ b/drivers/infiniband/hw/hfi1/trace_dbg.h
@@ -26,14 +26,10 @@ DECLARE_EVENT_CLASS(hfi1_trace_template,
 		    TP_PROTO(const char *function, struct va_format *vaf),
 		    TP_ARGS(function, vaf),
 		    TP_STRUCT__entry(__string(function, function)
-				     __dynamic_array(char, msg, MAX_MSG_LEN)
+				     __vstring(msg, vaf->fmt, vaf->va)
 				     ),
 		    TP_fast_assign(__assign_str(function, function);
-				   WARN_ON_ONCE(vsnprintf
-						(__get_dynamic_array(msg),
-						 MAX_MSG_LEN, vaf->fmt,
-						 *vaf->va) >=
-						MAX_MSG_LEN);
+				   __assign_vstr(msg, vaf->fmt, vaf->va);
 				   ),
 		    TP_printk("(%s) %s",
 			      __get_str(function),
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 02/13] tracing/IB/hfi1: Use the new __vstring() helper
  2022-07-05 22:44 ` [PATCH 02/13] tracing/IB/hfi1: Use the new __vstring() helper Steven Rostedt
@ 2022-07-06  4:20   ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-07-06  4:20 UTC (permalink / raw)
  To: Steven Rostedt, linux-kernel
  Cc: kbuild-all, Ingo Molnar, Andrew Morton,
	Linux Memory Management List, Dennis Dalessandro, Jason Gunthorpe,
	Leon Romanovsky, linux-rdma

Hi Steven,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on rostedt-trace/for-next]
[also build test WARNING on wireless-next/main]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Steven-Rostedt/tracing-events-Add-__vstring-and-__assign_vstr-helpers/20220706-065125
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git for-next
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220706/202207061250.oSPdYi3E-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/e742b16f3b984d761db2d898c15e7632e9166d4a
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Steven-Rostedt/tracing-events-Add-__vstring-and-__assign_vstr-helpers/20220706-065125
        git checkout e742b16f3b984d761db2d898c15e7632e9166d4a
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/infiniband/hw/hfi1/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/trace/define_trace.h:102,
                    from drivers/infiniband/hw/hfi1/trace_dbg.h:111,
                    from drivers/infiniband/hw/hfi1/trace.h:15,
                    from drivers/infiniband/hw/hfi1/trace.c:6:
   drivers/infiniband/hw/hfi1/./trace_dbg.h: In function 'trace_event_get_offsets_hfi1_trace_template':
>> include/trace/trace_events.h:261:16: warning: function 'trace_event_get_offsets_hfi1_trace_template' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
     261 |         struct trace_event_raw_##call __maybe_unused *entry;            \
         |                ^~~~~~~~~~~~~~~~
   drivers/infiniband/hw/hfi1/./trace_dbg.h:25:1: note: in expansion of macro 'DECLARE_EVENT_CLASS'
      25 | DECLARE_EVENT_CLASS(hfi1_trace_template,
         | ^~~~~~~~~~~~~~~~~~~
   In file included from include/trace/define_trace.h:102,
                    from drivers/infiniband/hw/hfi1/trace_dbg.h:111,
                    from drivers/infiniband/hw/hfi1/trace.h:15,
                    from drivers/infiniband/hw/hfi1/trace.c:6:
   drivers/infiniband/hw/hfi1/./trace_dbg.h: In function 'trace_event_raw_event_hfi1_trace_template':
   include/trace/trace_events.h:386:16: warning: function 'trace_event_raw_event_hfi1_trace_template' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
     386 |         struct trace_event_raw_##call *entry;                           \
         |                ^~~~~~~~~~~~~~~~
   drivers/infiniband/hw/hfi1/./trace_dbg.h:25:1: note: in expansion of macro 'DECLARE_EVENT_CLASS'
      25 | DECLARE_EVENT_CLASS(hfi1_trace_template,
         | ^~~~~~~~~~~~~~~~~~~
   In file included from include/trace/define_trace.h:103,
                    from drivers/infiniband/hw/hfi1/trace_dbg.h:111,
                    from drivers/infiniband/hw/hfi1/trace.h:15,
                    from drivers/infiniband/hw/hfi1/trace.c:6:
   drivers/infiniband/hw/hfi1/./trace_dbg.h: In function 'perf_trace_hfi1_trace_template':
   include/trace/perf.h:64:16: warning: function 'perf_trace_hfi1_trace_template' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
      64 |         struct hlist_head *head;                                        \
         |                ^~~~~~~~~~
   drivers/infiniband/hw/hfi1/./trace_dbg.h:25:1: note: in expansion of macro 'DECLARE_EVENT_CLASS'
      25 | DECLARE_EVENT_CLASS(hfi1_trace_template,
         | ^~~~~~~~~~~~~~~~~~~


vim +261 include/trace/trace_events.h

55de2c0b5610cb include/trace/trace_events.h Masami Hiramatsu         2021-11-22  253  
091ad3658e3c76 include/trace/ftrace.h       Ingo Molnar              2009-11-26  254  #undef DECLARE_EVENT_CLASS
091ad3658e3c76 include/trace/ftrace.h       Ingo Molnar              2009-11-26  255  #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)	\
d0ee8f4a1f5f3d include/trace/trace_events.h Steven Rostedt (Red Hat  2015-05-13  256) static inline notrace int trace_event_get_offsets_##call(		\
62323a148fbeb0 include/trace/trace_events.h Steven Rostedt (Red Hat  2015-05-13  257) 	struct trace_event_data_offsets_##call *__data_offsets, proto)	\
7fcb7c472f455d include/trace/ftrace.h       Li Zefan                 2009-06-01  258  {									\
7fcb7c472f455d include/trace/ftrace.h       Li Zefan                 2009-06-01  259  	int __data_size = 0;						\
114e7b52dee69c include/trace/ftrace.h       Filipe Brandenburger     2014-02-28  260  	int __maybe_unused __item_length;				\
a7237765730a10 include/trace/trace_events.h Steven Rostedt (Red Hat  2015-05-13 @261) 	struct trace_event_raw_##call __maybe_unused *entry;		\
7fcb7c472f455d include/trace/ftrace.h       Li Zefan                 2009-06-01  262  									\
7fcb7c472f455d include/trace/ftrace.h       Li Zefan                 2009-06-01  263  	tstruct;							\
7fcb7c472f455d include/trace/ftrace.h       Li Zefan                 2009-06-01  264  									\
7fcb7c472f455d include/trace/ftrace.h       Li Zefan                 2009-06-01  265  	return __data_size;						\
7fcb7c472f455d include/trace/ftrace.h       Li Zefan                 2009-06-01  266  }
7fcb7c472f455d include/trace/ftrace.h       Li Zefan                 2009-06-01  267  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-06  4:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220705224453.120955146@goodmis.org>
2022-07-05 22:44 ` [PATCH 02/13] tracing/IB/hfi1: Use the new __vstring() helper Steven Rostedt
2022-07-06  4:20   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox