All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: wen.yang@linux.dev, Gabriele Monaco <gmonaco@redhat.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Nam Cao <namcao@linutronix.de>,
	linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Wen Yang <wen.yang@linux.dev>
Subject: Re: [PATCH v7 03/14] rv: Add a KUnit test for the HA timer underflow
Date: Mon, 12 Oct 2026 17:27:31 +0800	[thread overview]
Message-ID: <202610121745.TCxIxDec-lkp@intel.com> (raw)
In-Reply-To: <cdaf33af866392428f1942cef4e442b1d106989c.1791745088.git.wen.yang@linux.dev>

Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on trace/for-next]
[also build test ERROR on shuah-kselftest/next shuah-kselftest/fixes linus/master v7.3-rc6 next-20261009]
[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/wen-yang-linux-dev/rv-Force-environment-reset-action-on-HA-monitor-start/20261012-033907
base:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link:    https://lore.kernel.org/r/cdaf33af866392428f1942cef4e442b1d106989c.1791745088.git.wen.yang%40linux.dev
patch subject: [PATCH v7 03/14] rv: Add a KUnit test for the HA timer underflow
config: x86_64-randconfig-1005-20261012 (https://download.01.org/0day-ci/archive/20261012/202610121745.TCxIxDec-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261012/202610121745.TCxIxDec-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/202610121745.TCxIxDec-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from kernel/trace/rv/rv_monitors_test.c:71:
>> include/rv/ha_monitor.h:66:16: error: no member named 'da_mon' in 'ha_monitor'
      66 | _Static_assert(offsetof(struct ha_monitor, da_mon) == 0,
         |                ^                           ~~~~~~
   include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
      16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
         |                                 ^                        ~~~~~~
   In file included from kernel/trace/rv/rv_monitors_test.c:71:
>> include/rv/ha_monitor.h:122:5: warning: 'HA_TIMER_HRTIMER' is not defined, evaluates to 0 [-Wundef]
     122 | #if HA_TIMER_TYPE == HA_TIMER_WHEEL
         |     ^
   kernel/trace/rv/rv_monitors_test.c:21:23: note: expanded from macro 'HA_TIMER_TYPE'
      21 | #define HA_TIMER_TYPE HA_TIMER_HRTIMER
         |                       ^
   In file included from kernel/trace/rv/rv_monitors_test.c:71:
   include/rv/ha_monitor.h:122:22: warning: 'HA_TIMER_WHEEL' is not defined, evaluates to 0 [-Wundef]
     122 | #if HA_TIMER_TYPE == HA_TIMER_WHEEL
         |                      ^
>> include/rv/ha_monitor.h:192:30: error: no member named 'da_mon' in 'struct ha_monitor'
     192 |         struct ha_monitor *ha_mon = to_ha_monitor(da_mon);
         |                                     ^~~~~~~~~~~~~~~~~~~~~
   include/rv/ha_monitor.h:68:63: note: expanded from macro 'to_ha_monitor'
      68 | #define to_ha_monitor(da) container_of(da, struct ha_monitor, da_mon)
         |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
   include/linux/container_of.h:20:56: note: expanded from macro 'container_of'
      20 |         static_assert(__same_type(*(ptr), typeof_member(type, member)) || \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
      21 |                       __same_type(*(ptr), void),                        \
         |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      22 |                       "pointer type mismatch in container_of()");       \
         |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/container_of.h:8:45: note: expanded from macro 'typeof_member'
       8 | #define typeof_member(T, m)     typeof(((T*)0)->m)
         |                                                 ^
   include/linux/compiler_types.h:610:74: note: expanded from macro '__same_type'
     610 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                                                                          ^
   include/linux/build_bug.h:79:50: note: expanded from macro 'static_assert'
      79 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
         |                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:80:56: note: expanded from macro '__static_assert'
      80 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   In file included from kernel/trace/rv/rv_monitors_test.c:71:
   include/rv/ha_monitor.h:192:30: error: no member named 'da_mon' in 'ha_monitor'
     192 |         struct ha_monitor *ha_mon = to_ha_monitor(da_mon);
         |                                     ^~~~~~~~~~~~~~~~~~~~~
   include/rv/ha_monitor.h:68:27: note: expanded from macro 'to_ha_monitor'
      68 | #define to_ha_monitor(da) container_of(da, struct ha_monitor, da_mon)
         |                           ^                                   ~~~~~~
   include/linux/container_of.h:23:27: note: expanded from macro 'container_of'
      23 |         (type *)((void *)(ptr) - offsetof(type, member)); })
         |                                  ^              ~~~~~~
   include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
      16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
         |                                 ^                        ~~~~~~
   In file included from kernel/trace/rv/rv_monitors_test.c:71:
>> include/rv/ha_monitor.h:192:21: error: initializing 'struct ha_monitor *' with an expression of incompatible type 'void'
     192 |         struct ha_monitor *ha_mon = to_ha_monitor(da_mon);
         |                            ^        ~~~~~~~~~~~~~~~~~~~~~
   include/rv/ha_monitor.h:208:30: error: no member named 'da_mon' in 'struct ha_monitor'
     208 |         struct ha_monitor *ha_mon = to_ha_monitor(da_mon);
         |                                     ^~~~~~~~~~~~~~~~~~~~~
   include/rv/ha_monitor.h:68:63: note: expanded from macro 'to_ha_monitor'
      68 | #define to_ha_monitor(da) container_of(da, struct ha_monitor, da_mon)
         |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
   include/linux/container_of.h:20:56: note: expanded from macro 'container_of'
      20 |         static_assert(__same_type(*(ptr), typeof_member(type, member)) || \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
      21 |                       __same_type(*(ptr), void),                        \
         |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      22 |                       "pointer type mismatch in container_of()");       \
         |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/container_of.h:8:45: note: expanded from macro 'typeof_member'
       8 | #define typeof_member(T, m)     typeof(((T*)0)->m)
         |                                                 ^
   include/linux/compiler_types.h:610:74: note: expanded from macro '__same_type'
     610 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                                                                          ^
   include/linux/build_bug.h:79:50: note: expanded from macro 'static_assert'
      79 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
         |                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:80:56: note: expanded from macro '__static_assert'
      80 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   In file included from kernel/trace/rv/rv_monitors_test.c:71:
   include/rv/ha_monitor.h:208:30: error: no member named 'da_mon' in 'ha_monitor'
     208 |         struct ha_monitor *ha_mon = to_ha_monitor(da_mon);
         |                                     ^~~~~~~~~~~~~~~~~~~~~
   include/rv/ha_monitor.h:68:27: note: expanded from macro 'to_ha_monitor'
      68 | #define to_ha_monitor(da) container_of(da, struct ha_monitor, da_mon)
         |                           ^                                   ~~~~~~
   include/linux/container_of.h:23:27: note: expanded from macro 'container_of'
      23 |         (type *)((void *)(ptr) - offsetof(type, member)); })
         |                                  ^              ~~~~~~
   include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
      16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
         |                                 ^                        ~~~~~~
   In file included from kernel/trace/rv/rv_monitors_test.c:71:
   include/rv/ha_monitor.h:208:21: error: initializing 'struct ha_monitor *' with an expression of incompatible type 'void'
     208 |         struct ha_monitor *ha_mon = to_ha_monitor(da_mon);
         |                            ^        ~~~~~~~~~~~~~~~~~~~~~
>> include/rv/ha_monitor.h:219:27: error: no member named 'env_store' in 'struct ha_monitor'
     219 |         return READ_ONCE(ha_mon->env_store[env]) == ENV_INVALID_VALUE;
         |                          ~~~~~~  ^
>> include/rv/ha_monitor.h:219:27: error: no member named 'env_store' in 'struct ha_monitor'
     219 |         return READ_ONCE(ha_mon->env_store[env]) == ENV_INVALID_VALUE;
         |                          ~~~~~~  ^
>> include/rv/ha_monitor.h:219:27: error: no member named 'env_store' in 'struct ha_monitor'
     219 |         return READ_ONCE(ha_mon->env_store[env]) == ENV_INVALID_VALUE;
         |                          ~~~~~~  ^
>> include/rv/ha_monitor.h:219:27: error: no member named 'env_store' in 'struct ha_monitor'
     219 |         return READ_ONCE(ha_mon->env_store[env]) == ENV_INVALID_VALUE;
         |                          ~~~~~~  ^
>> include/rv/ha_monitor.h:219:27: error: no member named 'env_store' in 'struct ha_monitor'
     219 |         return READ_ONCE(ha_mon->env_store[env]) == ENV_INVALID_VALUE;
         |                          ~~~~~~  ^
>> include/rv/ha_monitor.h:219:27: error: no member named 'env_store' in 'struct ha_monitor'
     219 |         return READ_ONCE(ha_mon->env_store[env]) == ENV_INVALID_VALUE;
         |                          ~~~~~~  ^
>> include/rv/ha_monitor.h:219:27: error: no member named 'env_store' in 'struct ha_monitor'
     219 |         return READ_ONCE(ha_mon->env_store[env]) == ENV_INVALID_VALUE;
         |                          ~~~~~~  ^
   include/rv/ha_monitor.h:286:30: error: no member named 'da_mon' in 'struct ha_monitor'
     286 |         struct ha_monitor *ha_mon = to_ha_monitor(da_mon);
         |                                     ^~~~~~~~~~~~~~~~~~~~~
   include/rv/ha_monitor.h:68:63: note: expanded from macro 'to_ha_monitor'
      68 | #define to_ha_monitor(da) container_of(da, struct ha_monitor, da_mon)
         |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
   include/linux/container_of.h:20:56: note: expanded from macro 'container_of'
      20 |         static_assert(__same_type(*(ptr), typeof_member(type, member)) || \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
      21 |                       __same_type(*(ptr), void),                        \
         |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      22 |                       "pointer type mismatch in container_of()");       \
         |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/container_of.h:8:45: note: expanded from macro 'typeof_member'
       8 | #define typeof_member(T, m)     typeof(((T*)0)->m)
         |                                                 ^
   include/linux/compiler_types.h:610:74: note: expanded from macro '__same_type'
     610 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                                                                          ^
   include/linux/build_bug.h:79:50: note: expanded from macro 'static_assert'
      79 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
         |                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:80:56: note: expanded from macro '__static_assert'
      80 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   In file included from kernel/trace/rv/rv_monitors_test.c:71:
   include/rv/ha_monitor.h:286:30: error: no member named 'da_mon' in 'ha_monitor'
     286 |         struct ha_monitor *ha_mon = to_ha_monitor(da_mon);
         |                                     ^~~~~~~~~~~~~~~~~~~~~
   include/rv/ha_monitor.h:68:27: note: expanded from macro 'to_ha_monitor'
      68 | #define to_ha_monitor(da) container_of(da, struct ha_monitor, da_mon)
         |                           ^                                   ~~~~~~
   include/linux/container_of.h:23:27: note: expanded from macro 'container_of'
      23 |         (type *)((void *)(ptr) - offsetof(type, member)); })
         |                                  ^              ~~~~~~
   include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
      16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
         |                                 ^                        ~~~~~~
   In file included from kernel/trace/rv/rv_monitors_test.c:71:
   include/rv/ha_monitor.h:286:21: error: initializing 'struct ha_monitor *' with an expression of incompatible type 'void'
     286 |         struct ha_monitor *ha_mon = to_ha_monitor(da_mon);
         |                            ^        ~~~~~~~~~~~~~~~~~~~~~
   include/rv/ha_monitor.h:321:41: error: no member named 'da_mon' in 'struct ha_monitor'
     321 |         curr_state = smp_load_acquire(&ha_mon->da_mon.curr_state);
         |                                        ~~~~~~  ^
   include/rv/ha_monitor.h:321:41: error: no member named 'da_mon' in 'struct ha_monitor'
     321 |         curr_state = smp_load_acquire(&ha_mon->da_mon.curr_state);
         |                                        ~~~~~~  ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   2 warnings and 20 errors generated.


vim +66 include/rv/ha_monitor.h

f5587d1b6ec938 Gabriele Monaco 2026-03-30   64  
f5587d1b6ec938 Gabriele Monaco 2026-03-30   65  /* This simplifies things since da_mon and ha_mon coexist in the same union */
f5587d1b6ec938 Gabriele Monaco 2026-03-30  @66  _Static_assert(offsetof(struct ha_monitor, da_mon) == 0,
f5587d1b6ec938 Gabriele Monaco 2026-03-30   67  	       "da_mon must be the first element in an ha_mon!");
f5587d1b6ec938 Gabriele Monaco 2026-03-30   68  #define to_ha_monitor(da) container_of(da, struct ha_monitor, da_mon)
f5587d1b6ec938 Gabriele Monaco 2026-03-30   69  
f5587d1b6ec938 Gabriele Monaco 2026-03-30   70  #define ENV_MAX CONCATENATE(env_max_, MONITOR_NAME)
f5587d1b6ec938 Gabriele Monaco 2026-03-30   71  #define ENV_MAX_STORED CONCATENATE(env_max_stored_, MONITOR_NAME)
f5587d1b6ec938 Gabriele Monaco 2026-03-30   72  #define envs CONCATENATE(envs_, MONITOR_NAME)
f5587d1b6ec938 Gabriele Monaco 2026-03-30   73  
f5587d1b6ec938 Gabriele Monaco 2026-03-30   74  /* Environment storage before being reset */
f5587d1b6ec938 Gabriele Monaco 2026-03-30   75  #define ENV_INVALID_VALUE U64_MAX
f5587d1b6ec938 Gabriele Monaco 2026-03-30   76  /* Error with no event occurs only on timeouts */
f5587d1b6ec938 Gabriele Monaco 2026-03-30   77  #define EVENT_NONE EVENT_MAX
f5587d1b6ec938 Gabriele Monaco 2026-03-30   78  #define EVENT_NONE_LBL "none"
f5587d1b6ec938 Gabriele Monaco 2026-03-30   79  #define ENV_BUFFER_SIZE 64
f5587d1b6ec938 Gabriele Monaco 2026-03-30   80  
f5587d1b6ec938 Gabriele Monaco 2026-03-30   81  #ifdef CONFIG_RV_REACTORS
f5587d1b6ec938 Gabriele Monaco 2026-03-30   82  
f5587d1b6ec938 Gabriele Monaco 2026-03-30   83  /*
f5587d1b6ec938 Gabriele Monaco 2026-03-30   84   * ha_react - trigger the reaction after a failed environment constraint
f5587d1b6ec938 Gabriele Monaco 2026-03-30   85   *
f5587d1b6ec938 Gabriele Monaco 2026-03-30   86   * The transition from curr_state with event is otherwise valid, but the
f5587d1b6ec938 Gabriele Monaco 2026-03-30   87   * environment constraint is false. This function can be called also with no
f5587d1b6ec938 Gabriele Monaco 2026-03-30   88   * event from a timer (state constraints only).
f5587d1b6ec938 Gabriele Monaco 2026-03-30   89   */
f5587d1b6ec938 Gabriele Monaco 2026-03-30   90  static void ha_react(enum states curr_state, enum events event, char *env)
f5587d1b6ec938 Gabriele Monaco 2026-03-30   91  {
f5587d1b6ec938 Gabriele Monaco 2026-03-30   92  	rv_react(&rv_this,
f5587d1b6ec938 Gabriele Monaco 2026-03-30   93  		 "rv: monitor %s does not allow event %s on state %s with env %s\n",
f5587d1b6ec938 Gabriele Monaco 2026-03-30   94  		 __stringify(MONITOR_NAME),
f5587d1b6ec938 Gabriele Monaco 2026-03-30   95  		 event == EVENT_NONE ? EVENT_NONE_LBL : model_get_event_name(event),
f5587d1b6ec938 Gabriele Monaco 2026-03-30   96  		 model_get_state_name(curr_state), env);
f5587d1b6ec938 Gabriele Monaco 2026-03-30   97  }
f5587d1b6ec938 Gabriele Monaco 2026-03-30   98  
f5587d1b6ec938 Gabriele Monaco 2026-03-30   99  #else /* CONFIG_RV_REACTOR */
f5587d1b6ec938 Gabriele Monaco 2026-03-30  100  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  101  static void ha_react(enum states curr_state, enum events event, char *env) { }
f5587d1b6ec938 Gabriele Monaco 2026-03-30  102  #endif
f5587d1b6ec938 Gabriele Monaco 2026-03-30  103  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  104  /*
f5587d1b6ec938 Gabriele Monaco 2026-03-30  105   * model_get_state_name - return the (string) name of the given state
f5587d1b6ec938 Gabriele Monaco 2026-03-30  106   */
f5587d1b6ec938 Gabriele Monaco 2026-03-30  107  static char *model_get_env_name(enum envs env)
f5587d1b6ec938 Gabriele Monaco 2026-03-30  108  {
f5587d1b6ec938 Gabriele Monaco 2026-03-30  109  	if ((env < 0) || (env >= ENV_MAX))
f5587d1b6ec938 Gabriele Monaco 2026-03-30  110  		return "INVALID";
f5587d1b6ec938 Gabriele Monaco 2026-03-30  111  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  112  	return RV_AUTOMATON_NAME.env_names[env];
f5587d1b6ec938 Gabriele Monaco 2026-03-30  113  }
f5587d1b6ec938 Gabriele Monaco 2026-03-30  114  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  115  /*
f5587d1b6ec938 Gabriele Monaco 2026-03-30  116   * Monitors requiring a timer implementation need to request it explicitly.
f5587d1b6ec938 Gabriele Monaco 2026-03-30  117   */
f5587d1b6ec938 Gabriele Monaco 2026-03-30  118  #ifndef HA_TIMER_TYPE
f5587d1b6ec938 Gabriele Monaco 2026-03-30  119  #define HA_TIMER_TYPE HA_TIMER_NONE
f5587d1b6ec938 Gabriele Monaco 2026-03-30  120  #endif
f5587d1b6ec938 Gabriele Monaco 2026-03-30  121  
f5587d1b6ec938 Gabriele Monaco 2026-03-30 @122  #if HA_TIMER_TYPE == HA_TIMER_WHEEL
f5587d1b6ec938 Gabriele Monaco 2026-03-30  123  static void ha_monitor_timer_callback(struct timer_list *timer);
f5587d1b6ec938 Gabriele Monaco 2026-03-30  124  #elif HA_TIMER_TYPE == HA_TIMER_HRTIMER
f5587d1b6ec938 Gabriele Monaco 2026-03-30  125  static enum hrtimer_restart ha_monitor_timer_callback(struct hrtimer *hrtimer);
f5587d1b6ec938 Gabriele Monaco 2026-03-30  126  #endif
f5587d1b6ec938 Gabriele Monaco 2026-03-30  127  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  128  /*
f5587d1b6ec938 Gabriele Monaco 2026-03-30  129   * ktime_get_ns is expensive, since we usually don't require precise accounting
f5587d1b6ec938 Gabriele Monaco 2026-03-30  130   * of changes within the same event, cache the current time at the beginning of
f5587d1b6ec938 Gabriele Monaco 2026-03-30  131   * the constraint handler and use the cache for subsequent calls.
f5587d1b6ec938 Gabriele Monaco 2026-03-30  132   * Monitors without ns clocks automatically skip this.
f5587d1b6ec938 Gabriele Monaco 2026-03-30  133   */
f5587d1b6ec938 Gabriele Monaco 2026-03-30  134  #ifdef HA_CLK_NS
f5587d1b6ec938 Gabriele Monaco 2026-03-30  135  #define ha_get_ns() ktime_get_ns()
f5587d1b6ec938 Gabriele Monaco 2026-03-30  136  #else
f5587d1b6ec938 Gabriele Monaco 2026-03-30  137  #define ha_get_ns() 0
f5587d1b6ec938 Gabriele Monaco 2026-03-30  138  #endif /* HA_CLK_NS */
f5587d1b6ec938 Gabriele Monaco 2026-03-30  139  
74e17bd6fc8ed7 Gabriele Monaco 2026-06-01  140  static bool ha_mon_destroying;
74e17bd6fc8ed7 Gabriele Monaco 2026-06-01  141  
700782ec8f6589 Gabriele Monaco 2026-06-01  142  static int ha_monitor_init(void)
700782ec8f6589 Gabriele Monaco 2026-06-01  143  {
700782ec8f6589 Gabriele Monaco 2026-06-01  144  	int ret;
700782ec8f6589 Gabriele Monaco 2026-06-01  145  
74e17bd6fc8ed7 Gabriele Monaco 2026-06-01  146  	WRITE_ONCE(ha_mon_destroying, false);
700782ec8f6589 Gabriele Monaco 2026-06-01  147  	ret = da_monitor_init();
700782ec8f6589 Gabriele Monaco 2026-06-01  148  	if (ret == 0)
700782ec8f6589 Gabriele Monaco 2026-06-01  149  		ha_monitor_enable_hook();
700782ec8f6589 Gabriele Monaco 2026-06-01  150  	return ret;
700782ec8f6589 Gabriele Monaco 2026-06-01  151  }
700782ec8f6589 Gabriele Monaco 2026-06-01  152  
700782ec8f6589 Gabriele Monaco 2026-06-01  153  static void ha_monitor_destroy(void)
700782ec8f6589 Gabriele Monaco 2026-06-01  154  {
74e17bd6fc8ed7 Gabriele Monaco 2026-06-01  155  	WRITE_ONCE(ha_mon_destroying, true);
700782ec8f6589 Gabriele Monaco 2026-06-01  156  	ha_monitor_disable_hook();
700782ec8f6589 Gabriele Monaco 2026-06-01  157  	da_monitor_destroy();
700782ec8f6589 Gabriele Monaco 2026-06-01  158  }
700782ec8f6589 Gabriele Monaco 2026-06-01  159  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  160  /* Should be supplied by the monitor */
f5587d1b6ec938 Gabriele Monaco 2026-03-30  161  static u64 ha_get_env(struct ha_monitor *ha_mon, enum envs env, u64 time_ns);
a8db17cc2158f8 Gabriele Monaco 2026-10-12  162  static void ha_reset_env(struct ha_monitor *ha_mon, enum envs env, u64 time_ns);
f5587d1b6ec938 Gabriele Monaco 2026-03-30  163  static bool ha_verify_constraint(struct ha_monitor *ha_mon,
f5587d1b6ec938 Gabriele Monaco 2026-03-30  164  				 enum states curr_state,
f5587d1b6ec938 Gabriele Monaco 2026-03-30  165  				 enum events event,
f5587d1b6ec938 Gabriele Monaco 2026-03-30  166  				 enum states next_state,
f5587d1b6ec938 Gabriele Monaco 2026-03-30  167  				 u64 time_ns);
a8db17cc2158f8 Gabriele Monaco 2026-10-12  168  #ifdef HA_NO_RESET
a8db17cc2158f8 Gabriele Monaco 2026-10-12  169  static void ha_reset_env(struct ha_monitor *ha_mon, enum envs env, u64 time_ns) { }
a8db17cc2158f8 Gabriele Monaco 2026-10-12  170  #endif
f5587d1b6ec938 Gabriele Monaco 2026-03-30  171  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  172  /*
f5587d1b6ec938 Gabriele Monaco 2026-03-30  173   * ha_monitor_reset_all_stored - reset all environment variables in the monitor
f5587d1b6ec938 Gabriele Monaco 2026-03-30  174   */
f5587d1b6ec938 Gabriele Monaco 2026-03-30  175  static inline void ha_monitor_reset_all_stored(struct ha_monitor *ha_mon)
f5587d1b6ec938 Gabriele Monaco 2026-03-30  176  {
a8db17cc2158f8 Gabriele Monaco 2026-10-12  177  	u64 time_ns = ha_get_ns();
a8db17cc2158f8 Gabriele Monaco 2026-10-12  178  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  179  	for (int i = 0; i < ENV_MAX_STORED; i++)
a8db17cc2158f8 Gabriele Monaco 2026-10-12  180  		ha_reset_env(ha_mon, i, time_ns);
f5587d1b6ec938 Gabriele Monaco 2026-03-30  181  }
f5587d1b6ec938 Gabriele Monaco 2026-03-30  182  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  183  /*
f5587d1b6ec938 Gabriele Monaco 2026-03-30  184   * ha_monitor_init_env - setup timer and reset all environment
f5587d1b6ec938 Gabriele Monaco 2026-03-30  185   *
f5587d1b6ec938 Gabriele Monaco 2026-03-30  186   * Called from a hook in the DA start functions, it supplies the da_mon
f5587d1b6ec938 Gabriele Monaco 2026-03-30  187   * corresponding to the current ha_mon.
f5587d1b6ec938 Gabriele Monaco 2026-03-30  188   * Not all hybrid automata require the timer, still set it for simplicity.
f5587d1b6ec938 Gabriele Monaco 2026-03-30  189   */
f5587d1b6ec938 Gabriele Monaco 2026-03-30  190  static inline void ha_monitor_init_env(struct da_monitor *da_mon)
f5587d1b6ec938 Gabriele Monaco 2026-03-30  191  {
f5587d1b6ec938 Gabriele Monaco 2026-03-30 @192  	struct ha_monitor *ha_mon = to_ha_monitor(da_mon);
f5587d1b6ec938 Gabriele Monaco 2026-03-30  193  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  194  	ha_monitor_reset_all_stored(ha_mon);
f5587d1b6ec938 Gabriele Monaco 2026-03-30  195  	ha_setup_timer(ha_mon);
f5587d1b6ec938 Gabriele Monaco 2026-03-30  196  }
f5587d1b6ec938 Gabriele Monaco 2026-03-30  197  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  198  /*
f5587d1b6ec938 Gabriele Monaco 2026-03-30  199   * ha_monitor_reset_env - stop timer and reset all environment
f5587d1b6ec938 Gabriele Monaco 2026-03-30  200   *
f5587d1b6ec938 Gabriele Monaco 2026-03-30  201   * Called from a hook in the DA reset functions, it supplies the da_mon
f5587d1b6ec938 Gabriele Monaco 2026-03-30  202   * corresponding to the current ha_mon.
f5587d1b6ec938 Gabriele Monaco 2026-03-30  203   * Not all hybrid automata require the timer, still clear it for simplicity.
713c9e1ea76238 Gabriele Monaco 2026-06-01  204   * Monitors that never started have their timer uninitialized, do not stop those.
f5587d1b6ec938 Gabriele Monaco 2026-03-30  205   */
f5587d1b6ec938 Gabriele Monaco 2026-03-30  206  static inline void ha_monitor_reset_env(struct da_monitor *da_mon)
f5587d1b6ec938 Gabriele Monaco 2026-03-30  207  {
f5587d1b6ec938 Gabriele Monaco 2026-03-30  208  	struct ha_monitor *ha_mon = to_ha_monitor(da_mon);
f5587d1b6ec938 Gabriele Monaco 2026-03-30  209  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  210  	if (likely(da_monitoring(da_mon)))
f5587d1b6ec938 Gabriele Monaco 2026-03-30  211  		ha_cancel_timer(ha_mon);
f5587d1b6ec938 Gabriele Monaco 2026-03-30  212  }
f5587d1b6ec938 Gabriele Monaco 2026-03-30  213  
f5587d1b6ec938 Gabriele Monaco 2026-03-30  214  /*
f5587d1b6ec938 Gabriele Monaco 2026-03-30  215   * ha_monitor_env_invalid - return true if env has not been initialised
f5587d1b6ec938 Gabriele Monaco 2026-03-30  216   */
f5587d1b6ec938 Gabriele Monaco 2026-03-30  217  static inline bool ha_monitor_env_invalid(struct ha_monitor *ha_mon, enum envs env)
f5587d1b6ec938 Gabriele Monaco 2026-03-30  218  {
f5587d1b6ec938 Gabriele Monaco 2026-03-30 @219  	return READ_ONCE(ha_mon->env_store[env]) == ENV_INVALID_VALUE;
f5587d1b6ec938 Gabriele Monaco 2026-03-30  220  }
f5587d1b6ec938 Gabriele Monaco 2026-03-30  221  

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

  parent reply	other threads:[~2026-10-12  9:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11 19:39 [PATCH v7 00/14] rv: Add task latency over budget RV monitor wen.yang
2026-10-11 19:39 ` [PATCH v7 01/14] rv: Force environment reset action on HA monitor start wen.yang
2026-10-11 19:39 ` [PATCH v7 02/14] rv: Fix ha_monitor timer and invariant underflow wen.yang
2026-10-11 19:39 ` [PATCH v7 03/14] rv: Add a KUnit test for the HA timer underflow wen.yang
2026-10-11 19:52   ` sashiko-bot
2026-10-12  7:47   ` kernel test robot
2026-10-12  9:27   ` kernel test robot [this message]
2026-10-12 11:18   ` kernel test robot
2026-10-11 19:39 ` [PATCH v7 04/14] rv: Disarm HA timers on the storage free path wen.yang
2026-10-11 19:51   ` sashiko-bot
2026-10-11 19:39 ` [PATCH v7 05/14] rv: Add a KUnit test for " wen.yang
2026-10-11 19:50   ` sashiko-bot
2026-10-11 19:39 ` [PATCH v7 06/14] rv: Make da_monitor_reset_hook and EVENT_NONE_LBL overridable wen.yang
2026-10-11 19:53   ` sashiko-bot
2026-10-11 19:39 ` [PATCH v7 07/14] rv: Introduce DA_MON_ALLOCATION_STRATEGY wen.yang
2026-10-11 19:57   ` sashiko-bot
2026-10-11 19:39 ` [PATCH v7 08/14] rv: Add per-object teardown hook da_extra_cleanup wen.yang
2026-10-11 19:54   ` sashiko-bot
2026-10-11 19:39 ` [PATCH v7 09/14] rv: Add generic uprobe infrastructure for RV monitors wen.yang
2026-10-11 19:49   ` sashiko-bot
2026-10-11 19:39 ` [PATCH v7 10/14] rv: Add tlob model DOT file wen.yang
2026-10-11 19:39 ` [PATCH v7 11/14] rv: Add tlob hybrid automaton monitor wen.yang
2026-10-11 19:58   ` sashiko-bot
2026-10-11 19:39 ` [PATCH v7 12/14] rv: Add KUnit tests for the tlob monitor wen.yang
2026-10-11 19:39 ` [PATCH v7 13/14] selftests/verification: Add tlob selftests wen.yang
2026-10-11 19:51   ` sashiko-bot
2026-10-11 19:39 ` [PATCH v7 14/14] selftests/ftrace: Walk up parent dirs to find test.d/functions wen.yang
2026-10-12 11:58 ` [PATCH v7 00/14] rv: Add task latency over budget RV monitor Gabriele Monaco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202610121745.TCxIxDec-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gmonaco@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=namcao@linutronix.de \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=wen.yang@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.