Re: [PATCH] trace: Fix some checker warnings

From: Google
Date: Sun Dec 04 2022 - 21:22:54 EST


On Fri, 2 Dec 2022 20:43:15 +0800
kernel test robot <lkp@xxxxxxxxx> wrote:

> Hi David,
>
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on linus/master]
> [also build test ERROR on v6.1-rc7 next-20221202]
> [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/David-Howells/trace-Fix-some-checker-warnings/20221202-040957
> patch link: https://lore.kernel.org/r/166992525941.1716618.13740663757583361463.stgit%40warthog.procyon.org.uk
> patch subject: [PATCH] trace: Fix some checker warnings
> config: i386-randconfig-a012
> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
> reproduce (this is a W=1 build):
> # https://github.com/intel-lab-lkp/linux/commit/90c2da2e191f0b26e8194f45579e8227c9950fa8
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review David-Howells/trace-Fix-some-checker-warnings/20221202-040957
> git checkout 90c2da2e191f0b26e8194f45579e8227c9950fa8
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> kernel/trace/trace.c: In function 'trace_create_maxlat_file':
> >> kernel/trace/trace.c:1725:48: error: 'tracing_max_lat_fops' undeclared (first use in this function); did you mean 'trace_min_max_fops'?
> 1725 | &tracing_max_lat_fops);
> | ^~~~~~~~~~~~~~~~~~~~
> | trace_min_max_fops
> kernel/trace/trace.c:1725:48: note: each undeclared identifier is reported only once for each function it appears in
>

This is not an error introduced by this patch, but the osnoise introduced this.
tracing_max_lat_fops is used from max latency tracer, hwlat tracer and osnoise
tracer, but it is defined only when the CONFIG_TRACER_MAX_TRACE and
CONFIG_HWLAT_TRACER.

commit 424b650f35c7 ("tracing: Fix missing osnoise tracer on max_latency")
may not enough. We need to add more CONFIG_OSNOISE_TRACER checks like below.

I think it is the time to introduce a shared config CONFIG_MAX_TRACE
for all those users to simplify the #ifdefs.

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 5cfc95a52bc3..14f18edfe5bc 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -6572,7 +6572,8 @@ tracing_thresh_write(struct file *filp, const char __user *ubuf,
return ret;
}

-#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)
+#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER) \
+ || defined(CONFIG_OSNOISE_TRACER)

static ssize_t
tracing_max_lat_read(struct file *filp, char __user *ubuf,
@@ -7587,7 +7588,8 @@ static const struct file_operations tracing_thresh_fops = {
.llseek = generic_file_llseek,
};

-#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)
+#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER) \
+ || defined(CONFIG_OSNOISE_TRACER)
static const struct file_operations tracing_max_lat_fops = {
.open = tracing_open_generic,
.read = tracing_max_lat_read,

--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>