lkml.org 
[lkml]   [2015]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 08/12] time: Add warnings when overflows or underflows are observed
On Thu, Jan 22, 2015 at 04:09:23PM -0800, John Stultz wrote:
> #ifdef CONFIG_DEBUG_TIMEKEEPING
> +#define WARNINGFREQ (HZ*300) /* 5 minute rate-limiting */
> +/*
> + * These simple flag variables are managed
> + * without locks, which is racy, but ok since
> + * we don't really care about being super
> + * precise about how many events were seen,
> + * just that a problem was observed.
> + */
> +static int timekeeping_underflow_seen;
> +static int timekeeping_overflow_seen;
> +
> static void timekeeping_check_update(struct timekeeper *tk, cycle_t offset)
> {
>
> cycle_t max_cycles = tk->tkr.clock->max_cycles;
> const char *name = tk->tkr.clock->name;
> + static long last_warning; /* we always hold write on timekeeper lock */
>
> if (offset > max_cycles)
> printk_deferred("ERROR: cycle offset (%lld) is larger then"
> @@ -133,28 +145,60 @@ static void timekeeping_check_update(struct timekeeper *tk, cycle_t offset)
> printk_deferred("WARNING: cycle offset (%lld) is past"
> " the %s 50%% safety margin (%lld)\n",
> offset, name, max_cycles>>1);
> +
> + if (timekeeping_underflow_seen) {
> + if (jiffies - last_warning > WARNINGFREQ) {
> + printk_deferred("WARNING: Clocksource underflow observed\n");
> + last_warning = jiffies;
> + }
> + timekeeping_underflow_seen = 0;
> + }
> + if (timekeeping_overflow_seen) {
> + if (jiffies - last_warning > WARNINGFREQ) {
> + printk_deferred("WARNING: Clocksource overflow observed\n");
> + last_warning = jiffies;
> + }
> + timekeeping_overflow_seen = 0;
> + }
> +
> }

Ah, ignore my last comment. Excellent!


\
 
 \ /
  Last update: 2015-01-23 15:41    [W:0.116 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site