Thread (1 message) flat view 1 message, 1 author, 2025-11-13

Re: [trace:latency/for-next 3/5] kernel/trace/rv/monitors/sleep/sleep.c:219:26: error: static declaration of 'rv_sleep' follows non-static declaration

From: Gabriele Monaco <gmonaco@redhat.com>
Date: 2025-11-13 12:09:16
Also in: oe-kbuild-all
Subsystem: runtime verification (rv), the rest · Maintainers: Steven Rostedt, Gabriele Monaco, Linus Torvalds

On Thu, 2025-11-13 at 19:41 +0800, kernel test robot wrote:
tree:  
https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace latency/for-
next
head:   69d8895cb9a9f6450374577af8584c2e21cb5a9f
commit: 4f739ed19d222de33b19ca639a34523fbbec20d0 [3/5] rv: Pass va_list to
reactors
config: arc-randconfig-r071-20251113
(https://download.01.org/0day-ci/archive/20251113/202511131948.vxi5mdjU-lkp@in
tel.com/config)
compiler: arc-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build):
(https://download.01.org/0day-ci/archive/20251113/202511131948.vxi5mdjU-lkp@in
tel.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
quoted
Reported-by: kernel test robot <redacted>
Closes:
https://lore.kernel.org/oe-kbuild-all/202511131948.vxi5mdjU-lkp@intel.com/ (local)
All errors (new ones prefixed by >>):
quoted
quoted
kernel/trace/rv/monitors/sleep/sleep.c:219:26: error: static declaration
of 'rv_sleep' follows non-static declaration
    static struct rv_monitor rv_sleep = {
                             ^~~~~~~~
My bad I didn't test with !CONFIG_RV_REACTORS, is there a reason why we'd want
this non-static?

#ifdef CONFIG_RV_REACTORS
static struct rv_monitor RV_MONITOR_NAME;
#else
extern struct rv_monitor RV_MONITOR_NAME;
#endif

ltl_monitor is included only by the files defining the rv_MONITOR_NAME, that's
definitely static as far as I see it.

I'd go with a Fix like this:
diff --git a/include/rv/ltl_monitor.h b/include/rv/ltl_monitor.h
index 00c42b36f961..eff60cd61106 100644
--- a/include/rv/ltl_monitor.h
+++ b/include/rv/ltl_monitor.h
@@ -17,12 +17,7 @@
 #endif
 
 #define RV_MONITOR_NAME CONCATENATE(rv_, MONITOR_NAME)
-
-#ifdef CONFIG_RV_REACTORS
 static struct rv_monitor RV_MONITOR_NAME;
-#else
-extern struct rv_monitor RV_MONITOR_NAME;
-#endif
 
 static int ltl_monitor_slot = RV_PER_TASK_MONITOR_INIT;
 
Any thought?

Thanks,
Gabriele
   In file included from include/linux/cleanup.h:7,
                    from include/linux/interrupt.h:8,
                    from include/linux/trace_recursion.h:5,
                    from include/linux/ftrace.h:10,
                    from kernel/trace/rv/monitors/sleep/sleep.c:2:
   include/rv/ltl_monitor.h:19:37: note: previous declaration of 'rv_sleep'
was here
    #define RV_MONITOR_NAME CONCATENATE(rv_, MONITOR_NAME)
                                        ^~~
   include/linux/args.h:25:24: note: in definition of macro '__CONCAT'
    #define __CONCAT(a, b) a ## b
                           ^
   include/rv/ltl_monitor.h:19:25: note: in expansion of macro 'CONCATENATE'
    #define RV_MONITOR_NAME CONCATENATE(rv_, MONITOR_NAME)
                            ^~~~~~~~~~~
   include/rv/ltl_monitor.h:24:26: note: in expansion of macro
'RV_MONITOR_NAME'
    extern struct rv_monitor RV_MONITOR_NAME;
                             ^~~~~~~~~~~~~~~


vim +/rv_sleep +219 kernel/trace/rv/monitors/sleep/sleep.c

f74f8bb246cf22 Nam Cao 2025-07-09  218  
f74f8bb246cf22 Nam Cao 2025-07-09 @219  static struct rv_monitor rv_sleep = {
f74f8bb246cf22 Nam Cao 2025-07-09  220  	.name = "sleep",
f74f8bb246cf22 Nam Cao 2025-07-09  221  	.description = "Monitor that
RT tasks do not undesirably sleep",
f74f8bb246cf22 Nam Cao 2025-07-09  222  	.enable = enable_sleep,
f74f8bb246cf22 Nam Cao 2025-07-09  223  	.disable = disable_sleep,
f74f8bb246cf22 Nam Cao 2025-07-09  224  };
f74f8bb246cf22 Nam Cao 2025-07-09  225  

:::::: The code at line 219 was first introduced by commit
:::::: f74f8bb246cf22f27752977da62079cb615f55b2 rv: Add rtapp_sleep monitor

:::::: TO: Nam Cao [off-list ref]
:::::: CC: Steven Rostedt (Google) [off-list ref]
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help