linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource: Use correct limit for wd-cs-wd read back delay in printing
@ 2025-07-31 12:04 Aaron Lu
  2025-08-01  1:48 ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Lu @ 2025-07-31 12:04 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: John Stultz, Thomas Gleixner, Stephen Boyd, linux-kernel

With commit 4ac1dd3245b9("clocksource: Set cs_watchdog_read() checks
based on .uncertainty_margin"), the limit for wd-cs-wd read back delay
is changed from the static WATCHDOG_MAX_SKEW to dynamic ones based on
watchdog and cs' uncertainty_margin, but WATCHDOG_MAX_SKEW is still used
when dumping information.

Fix this by using the actual limit: md(2 * watchdog->uncertainty_margin)
+ cs->unvertainty_margin.

Signed-off-by: Aaron Lu <ziqianlu@bytedance.com>
---
 kernel/time/clocksource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index e400fe150f9d7..ae0fcd5af41c2 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -290,7 +290,7 @@ static enum wd_read_status cs_watchdog_read(struct clocksource *cs, u64 *csnow,
 	}
 
 	pr_warn("timekeeping watchdog on CPU%d: wd-%s-wd excessive read-back delay of %lldns vs. limit of %ldns, wd-wd read-back delay only %lldns, attempt %d, marking %s unstable\n",
-		smp_processor_id(), cs->name, wd_delay, WATCHDOG_MAX_SKEW, wd_seq_delay, nretries, cs->name);
+		smp_processor_id(), cs->name, wd_delay, md + cs->uncertainty_margin, wd_seq_delay, nretries, cs->name);
 	return WD_READ_UNSTABLE;
 
 skip_test:
-- 
2.39.5


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

* Re: [PATCH] clocksource: Use correct limit for wd-cs-wd read back delay in printing
  2025-07-31 12:04 [PATCH] clocksource: Use correct limit for wd-cs-wd read back delay in printing Aaron Lu
@ 2025-08-01  1:48 ` kernel test robot
  2025-08-01  2:42   ` Aaron Lu
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2025-08-01  1:48 UTC (permalink / raw)
  To: Aaron Lu, Paul E. McKenney
  Cc: llvm, oe-kbuild-all, John Stultz, Thomas Gleixner, Stephen Boyd,
	linux-kernel

Hi Aaron,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tip/timers/core]
[also build test WARNING on linus/master v6.16 next-20250731]
[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/Aaron-Lu/clocksource-Use-correct-limit-for-wd-cs-wd-read-back-delay-in-printing/20250731-200709
base:   tip/timers/core
patch link:    https://lore.kernel.org/r/20250731120454.GA309%40bytedance
patch subject: [PATCH] clocksource: Use correct limit for wd-cs-wd read back delay in printing
config: i386-buildonly-randconfig-001-20250801 (https://download.01.org/0day-ci/archive/20250801/202508010911.AmkxEw1p-lkp@intel.com/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/20250801/202508010911.AmkxEw1p-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/202508010911.AmkxEw1p-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> kernel/time/clocksource.c:293:43: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
     292 |         pr_warn("timekeeping watchdog on CPU%d: wd-%s-wd excessive read-back delay of %lldns vs. limit of %ldns, wd-wd read-back delay only %lldns, attempt %d, marking %s unstable\n",
         |                                                                                                           ~~~
         |                                                                                                           %lld
     293 |                 smp_processor_id(), cs->name, wd_delay, md + cs->uncertainty_margin, wd_seq_delay, nretries, cs->name);
         |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:560:37: note: expanded from macro 'pr_warn'
     560 |         printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
         |                                    ~~~     ^~~~~~~~~~~
   include/linux/printk.h:507:60: note: expanded from macro 'printk'
     507 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
         |                                                     ~~~    ^~~~~~~~~~~
   include/linux/printk.h:479:19: note: expanded from macro 'printk_index_wrap'
     479 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                         ~~~~    ^~~~~~~~~~~
   1 warning generated.


vim +293 kernel/time/clocksource.c

   252	
   253	static enum wd_read_status cs_watchdog_read(struct clocksource *cs, u64 *csnow, u64 *wdnow)
   254	{
   255		int64_t md = 2 * watchdog->uncertainty_margin;
   256		unsigned int nretries, max_retries;
   257		int64_t wd_delay, wd_seq_delay;
   258		u64 wd_end, wd_end2;
   259	
   260		max_retries = clocksource_get_max_watchdog_retry();
   261		for (nretries = 0; nretries <= max_retries; nretries++) {
   262			local_irq_disable();
   263			*wdnow = watchdog->read(watchdog);
   264			*csnow = cs->read(cs);
   265			wd_end = watchdog->read(watchdog);
   266			wd_end2 = watchdog->read(watchdog);
   267			local_irq_enable();
   268	
   269			wd_delay = cycles_to_nsec_safe(watchdog, *wdnow, wd_end);
   270			if (wd_delay <= md + cs->uncertainty_margin) {
   271				if (nretries > 1 && nretries >= max_retries) {
   272					pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before success\n",
   273						smp_processor_id(), watchdog->name, nretries);
   274				}
   275				return WD_READ_SUCCESS;
   276			}
   277	
   278			/*
   279			 * Now compute delay in consecutive watchdog read to see if
   280			 * there is too much external interferences that cause
   281			 * significant delay in reading both clocksource and watchdog.
   282			 *
   283			 * If consecutive WD read-back delay > md, report
   284			 * system busy, reinit the watchdog and skip the current
   285			 * watchdog test.
   286			 */
   287			wd_seq_delay = cycles_to_nsec_safe(watchdog, wd_end, wd_end2);
   288			if (wd_seq_delay > md)
   289				goto skip_test;
   290		}
   291	
   292		pr_warn("timekeeping watchdog on CPU%d: wd-%s-wd excessive read-back delay of %lldns vs. limit of %ldns, wd-wd read-back delay only %lldns, attempt %d, marking %s unstable\n",
 > 293			smp_processor_id(), cs->name, wd_delay, md + cs->uncertainty_margin, wd_seq_delay, nretries, cs->name);
   294		return WD_READ_UNSTABLE;
   295	
   296	skip_test:
   297		pr_info("timekeeping watchdog on CPU%d: %s wd-wd read-back delay of %lldns\n",
   298			smp_processor_id(), watchdog->name, wd_seq_delay);
   299		pr_info("wd-%s-wd read-back delay of %lldns, clock-skew test skipped!\n",
   300			cs->name, wd_delay);
   301		return WD_READ_SKIP;
   302	}
   303	

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

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

* Re: [PATCH] clocksource: Use correct limit for wd-cs-wd read back delay in printing
  2025-08-01  1:48 ` kernel test robot
@ 2025-08-01  2:42   ` Aaron Lu
  0 siblings, 0 replies; 3+ messages in thread
From: Aaron Lu @ 2025-08-01  2:42 UTC (permalink / raw)
  To: kernel test robot
  Cc: Paul E. McKenney, llvm, oe-kbuild-all, John Stultz,
	Thomas Gleixner, Stephen Boyd, linux-kernel

On Fri, Aug 01, 2025 at 09:48:40AM +0800, kernel test robot wrote:
> Hi Aaron,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on tip/timers/core]
> [also build test WARNING on linus/master v6.16 next-20250731]
> [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/Aaron-Lu/clocksource-Use-correct-limit-for-wd-cs-wd-read-back-delay-in-printing/20250731-200709
> base:   tip/timers/core
> patch link:    https://lore.kernel.org/r/20250731120454.GA309%40bytedance
> patch subject: [PATCH] clocksource: Use correct limit for wd-cs-wd read back delay in printing
> config: i386-buildonly-randconfig-001-20250801 (https://download.01.org/0day-ci/archive/20250801/202508010911.AmkxEw1p-lkp@intel.com/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/20250801/202508010911.AmkxEw1p-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/202508010911.AmkxEw1p-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
> >> kernel/time/clocksource.c:293:43: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
>      292 |         pr_warn("timekeeping watchdog on CPU%d: wd-%s-wd excessive read-back delay of %lldns vs. limit of %ldns, wd-wd read-back delay only %lldns, attempt %d, marking %s unstable\n",
>          |                                                                                                           ~~~
>          |                                                                                                           %lld

Thanks for catching this, will fix it in next version.

>      293 |                 smp_processor_id(), cs->name, wd_delay, md + cs->uncertainty_margin, wd_seq_delay, nretries, cs->name);
>          |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~

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

end of thread, other threads:[~2025-08-01  2:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-31 12:04 [PATCH] clocksource: Use correct limit for wd-cs-wd read back delay in printing Aaron Lu
2025-08-01  1:48 ` kernel test robot
2025-08-01  2:42   ` Aaron Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).