Re: [PATCH] tracing: Move snapshot code out of trace.c and into trace_snapshot.c

From: kernel test robot

Date: Fri Mar 06 2026 - 14:12:42 EST


Hi Steven,

kernel test robot noticed the following build warnings:

[auto build test WARNING on v7.0-rc2]
[cannot apply to trace/for-next linus/master next-20260306]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Steven-Rostedt/tracing-Move-snapshot-code-out-of-trace-c-and-into-trace_snapshot-c/20260306-102714
base: v7.0-rc2
patch link: https://lore.kernel.org/r/20260305211810.3f48aa07%40robin
patch subject: [PATCH] tracing: Move snapshot code out of trace.c and into trace_snapshot.c
config: sparc64-defconfig (https://download.01.org/0day-ci/archive/20260307/202603070230.Zz4BBLtb-lkp@xxxxxxxxx/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/20260307/202603070230.Zz4BBLtb-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603070230.Zz4BBLtb-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> kernel/trace/trace.c:820:5: warning: no previous prototype for function 'tracing_alloc_snapshot' [-Wmissing-prototypes]
820 | int tracing_alloc_snapshot(void)
| ^
kernel/trace/trace.c:820:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
820 | int tracing_alloc_snapshot(void)
| ^
| static
1 warning generated.


vim +/tracing_alloc_snapshot +820 kernel/trace/trace.c

ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 792)
93e31ffbf417a84 Tom Zanussi 2013-10-24 793 /**
93e31ffbf417a84 Tom Zanussi 2013-10-24 794 * tracing_alloc_snapshot - allocate snapshot buffer.
93e31ffbf417a84 Tom Zanussi 2013-10-24 795 *
93e31ffbf417a84 Tom Zanussi 2013-10-24 796 * This only allocates the snapshot buffer if it isn't already
93e31ffbf417a84 Tom Zanussi 2013-10-24 797 * allocated - it doesn't also take a snapshot.
93e31ffbf417a84 Tom Zanussi 2013-10-24 798 *
93e31ffbf417a84 Tom Zanussi 2013-10-24 799 * This is meant to be used in cases where the snapshot buffer needs
93e31ffbf417a84 Tom Zanussi 2013-10-24 800 * to be set up for events that can't sleep but need to be able to
93e31ffbf417a84 Tom Zanussi 2013-10-24 801 * trigger a snapshot.
93e31ffbf417a84 Tom Zanussi 2013-10-24 802 */
93e31ffbf417a84 Tom Zanussi 2013-10-24 803 int tracing_alloc_snapshot(void)
93e31ffbf417a84 Tom Zanussi 2013-10-24 804 {
93e31ffbf417a84 Tom Zanussi 2013-10-24 805 struct trace_array *tr = &global_trace;
93e31ffbf417a84 Tom Zanussi 2013-10-24 806 int ret;
93e31ffbf417a84 Tom Zanussi 2013-10-24 807
2824f5033248600 Steven Rostedt (VMware 2018-05-28 808) ret = tracing_alloc_snapshot_instance(tr);
93e31ffbf417a84 Tom Zanussi 2013-10-24 809 WARN_ON(ret < 0);
93e31ffbf417a84 Tom Zanussi 2013-10-24 810
93e31ffbf417a84 Tom Zanussi 2013-10-24 811 return ret;
93e31ffbf417a84 Tom Zanussi 2013-10-24 812 }
93e31ffbf417a84 Tom Zanussi 2013-10-24 813 EXPORT_SYMBOL_GPL(tracing_alloc_snapshot);
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 814) #else
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 815) void tracing_snapshot(void)
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 816) {
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 817) WARN_ONCE(1, "Snapshot feature not enabled, but internal snapshot used");
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 818) }
1b22e382ab40b0e Steven Rostedt (Red Hat 2013-03-09 819) EXPORT_SYMBOL_GPL(tracing_snapshot);
93e31ffbf417a84 Tom Zanussi 2013-10-24 @820 int tracing_alloc_snapshot(void)
93e31ffbf417a84 Tom Zanussi 2013-10-24 821 {
93e31ffbf417a84 Tom Zanussi 2013-10-24 822 WARN_ONCE(1, "Snapshot feature not enabled, but snapshot allocation used");
93e31ffbf417a84 Tom Zanussi 2013-10-24 823 return -ENODEV;
93e31ffbf417a84 Tom Zanussi 2013-10-24 824 }
93e31ffbf417a84 Tom Zanussi 2013-10-24 825 EXPORT_SYMBOL_GPL(tracing_alloc_snapshot);
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 826) void tracing_snapshot_alloc(void)
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 827) {
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 828) /* Give warning */
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 829) tracing_snapshot();
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 830) }
1b22e382ab40b0e Steven Rostedt (Red Hat 2013-03-09 831) EXPORT_SYMBOL_GPL(tracing_snapshot_alloc);
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 832) #endif /* CONFIG_TRACER_SNAPSHOT */
ad909e21bbe69f1 Steven Rostedt (Red Hat 2013-03-06 833)

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki