All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: John Stultz <johnstul@us.ibm.com>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Salman Qazi <sqazi@google.com>,
	stable@kernel.org
Subject: Re: [PATCH] clocksource, prevent overflow in clocksource_cyc2ns
Date: Thu, 05 Apr 2012 08:27:13 -0400	[thread overview]
Message-ID: <4F7D8FA1.1010107@redhat.com> (raw)
In-Reply-To: <4F7CF094.5020201@us.ibm.com>

> 
> So what kernel version are you using?

I retested using top of the linux.git tree, running

echo 1 > /proc/sys/kernel/sysrq
for i in `seq 10000`; do sleep 1000 & done
echo t > /proc/sysrq-trigger

and I no longer see a problem.  However, if I increase the number of threads to
1000/cpu I get

Clocksource %s unstable (delta = -429565427)
Clocksource switching to hpet

> to narrow down if you're  problem  is currently present in mainline or only in
> older kernels, as that will help us find the proper fix.

If I hack in (sorry for the cut-and-paste)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index c958338..f38b8d0 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -279,11 +279,16 @@ static void clocksource_watchdog(unsigned long data)
                        continue;
                }

-               wd_nsec = clocksource_cyc2ns((wdnow - cs->wd_last) & watchdog->m
-                                            watchdog->mult, watchdog->shift);
+               /*wd_nsec = clocksource_cyc2ns((wdnow - cs->wd_last) & watchdog-
+                                            watchdog->mult, watchdog->shift);*/
+               wd_nsec = mult_frac(((wdnow - cs->wd_last), watchdog->mult,
+                                   1UL << watchdog->shift);
+
+               /*cs_nsec = clocksource_cyc2ns((csnow - cs->cs_last) &
+                                            cs->mask, cs->mult, cs->shift);*/
+               cs_nsec = mult_frac(((csnow - cs->cs_last), cs->mult,
+                                   1UL << cs->shift);

-               cs_nsec = clocksource_cyc2ns((csnow - cs->cs_last) &
-                                            cs->mask, cs->mult, cs->shift);
                cs->cs_last = csnow;
                cs->wd_last = wdnow;


then I don't see unstable messages.

I think the problem is still here but it only happens in extreme cases.

P.

  parent reply	other threads:[~2012-04-05 12:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-04 15:11 [PATCH] clocksource, prevent overflow in clocksource_cyc2ns Prarit Bhargava
2012-04-04 18:00 ` John Stultz
2012-04-04 18:33   ` Prarit Bhargava
2012-04-05  1:08     ` John Stultz
2012-04-05 11:00       ` Prarit Bhargava
2012-04-05 16:23         ` John Stultz
2012-04-05 12:27       ` Prarit Bhargava [this message]
2012-04-05 16:45         ` John Stultz
2012-04-06 23:29         ` Thomas Gleixner
2012-04-07 13:47           ` Prarit Bhargava
2012-04-18 23:20         ` John Stultz
2012-04-18 23:59           ` Prarit Bhargava
2012-04-19  0:18             ` John Stultz
2012-04-19 11:56               ` Prarit Bhargava
2012-04-19 12:50               ` Thomas Gleixner
2012-04-19 12:52                 ` Thomas Gleixner
2012-04-19 13:06                   ` Prarit Bhargava
2012-04-19 13:18                     ` Thomas Gleixner
2012-04-19 18:12                   ` John Stultz
2012-04-25 12:29                     ` Prarit Bhargava
2012-04-19 12:37             ` Thomas Gleixner
2012-04-19 12:51               ` Thomas Gleixner

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=4F7D8FA1.1010107@redhat.com \
    --to=prarit@redhat.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sqazi@google.com \
    --cc=stable@kernel.org \
    --cc=tglx@linutronix.de \
    /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.