public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Willy Tarreau" <w@1wt.eu>, "Ingo Molnar" <mingo@elte.hu>,
	"MINOURA Makoto / ?$BL'1: ?$B??" <minoura@valinux.co.jp>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Faidon Liambotis" <paravoid@debian.org>,
	linux-kernel@vger.kernel.org, stable@kernel.org,
	"Nikola Ciprich" <nikola.ciprich@linuxbox.cz>,
	seto.hidetoshi@jp.fujitsu.com,
	"Hervé Commowick" <hcommowick@exosec.fr>,
	Rand@jasper.es
Subject: Re: 2.6.32.21 - uptime related crashes?
Date: Fri, 15 Jul 2011 10:59:55 -0700	[thread overview]
Message-ID: <1310752795.2945.4.camel@work-vm> (raw)
In-Reply-To: <1310724097.2586.296.camel@twins>

On Fri, 2011-07-15 at 12:01 +0200, Peter Zijlstra wrote:
> On Thu, 2011-07-14 at 17:35 -0700, john stultz wrote:
> > 
> > Peter/Ingo: Can you take a look at the above and let me know if you find
> > it too disagreeable?
> 
> +static unsigned long long __cycles_2_ns(unsigned long long cyc)
> +{
> +       unsigned long long ns = 0;
> +       struct x86_sched_clock_data *data;
> +       int cpu = smp_processor_id();
> +
> +       rcu_read_lock();
> +       data = rcu_dereference(per_cpu(cpu_sched_clock_data, cpu));
> +
> +       if (unlikely(!data))
> +               goto out;
> +
> +       ns = ((cyc - data->base_cycles) * data->mult) >> CYC2NS_SCALE_FACTOR;
> +       ns += data->accumulated_ns;
> +out:
> +       rcu_read_unlock();
> +       return ns;
> +}
> 
> The way I read that we're still not wrapping properly if freq scaling
> 'never' happens.

Right, this doesn't address the mult overflow behavior. As I mentioned
in the patch that the rework allows for solving that in the future using
a (possibly very rare) timer that would accumulate cycles to ns.

This rework just really addresses the multiplication overflow->negative
roll under that currently occurs with the cyc2ns_offset value.

> Because then we're wrapping on accumulated_ns + 2^54.
> 
> Something like resetting base, and adding ns to accumulated_ns and
> returning the latter would make more sense.

Although we have to update the base_cycles and accumulated_ns
atomically, so its probably not something to do in the sched_clock path.

thanks
-john





  reply	other threads:[~2011-07-15 18:00 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28  8:26 2.6.32.21 - uptime related crashes? Nikola Ciprich
2011-04-28 18:34 ` [stable] " Willy Tarreau
2011-04-29 10:02   ` Nikola Ciprich
2011-04-30  9:36     ` Willy Tarreau
2011-04-30 11:22       ` Henrique de Moraes Holschuh
2011-04-30 11:54         ` Willy Tarreau
2011-04-30 12:32           ` Henrique de Moraes Holschuh
2011-04-30 12:02       ` Nikola Ciprich
2011-04-30 15:57         ` Greg KH
2011-04-30 16:08           ` Randy Dunlap
2011-04-30 16:49             ` Willy Tarreau
2011-04-30 18:14               ` Henrique de Moraes Holschuh
2011-04-30 17:39       ` Faidon Liambotis
2011-04-30 20:14         ` Willy Tarreau
2011-05-14 19:04           ` Nikola Ciprich
2011-05-14 20:45             ` Willy Tarreau
2011-05-14 20:59               ` Ben Hutchings
2011-05-14 23:13               ` Nicolas Carlier
2011-05-15 22:56             ` Faidon Liambotis
2011-05-16  6:49               ` Apollon Oikonomopoulos
2011-06-28  2:25         ` john stultz
2011-06-28  5:17           ` Willy Tarreau
2011-06-28  6:19             ` Apollon Oikonomopoulos
2011-07-06  6:15           ` Andrew Morton
2011-07-12  1:18             ` MINOURA Makoto / 箕浦 真
2011-07-12  1:40               ` john stultz
2011-07-12  2:49                 ` MINOURA Makoto / 箕浦 真
2011-07-12  4:19                   ` Willy Tarreau
2011-07-15  0:35                     ` john stultz
2011-07-15  8:30                       ` Peter Zijlstra
2011-07-15 10:02                         ` Peter Zijlstra
2011-07-15 18:03                           ` john stultz
2011-07-15 10:01                       ` Peter Zijlstra
2011-07-15 17:59                         ` john stultz [this message]
2011-07-21  7:22                           ` Ingo Molnar
2011-07-21 12:24                             ` Peter Zijlstra
2011-07-21 12:50                               ` Nikola Ciprich
2011-07-21 12:53                                 ` Peter Zijlstra
2011-07-21 18:45                                   ` Ingo Molnar
2011-07-21 19:32                                     ` Nikola Ciprich
2011-08-25 18:56                                     ` Faidon Liambotis
2011-08-30 22:38                                       ` [stable] " Greg KH
2011-09-04 23:26                                         ` Faidon Liambotis
2011-10-23 18:31                                           ` Ruben Kerkhof
2011-10-23 22:07                                             ` Greg KH
2011-10-25 22:44                                             ` john stultz
2011-10-25 23:25                                               ` Willy Tarreau
2011-12-02 23:45                                                 ` Greg KH
2011-12-03  0:02                                                   ` john stultz
2011-12-03  1:02                                                     ` Greg KH
2011-12-03  7:00                                                       ` Willy Tarreau
2011-12-05 16:53                                                       ` Ingo Molnar
2011-10-26 18:21                                               ` Ruben Kerkhof
2011-07-21 19:25                                   ` Nikola Ciprich
2011-07-21 19:37                                     ` john stultz
2011-07-21 19:53                             ` john stultz
2011-05-06  3:12     ` [stable] " Hidetoshi Seto
2011-05-13 22:08   ` Nicolas Carlier

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=1310752795.2945.4.camel@work-vm \
    --to=johnstul@us.ibm.com \
    --cc=Rand@jasper.es \
    --cc=akpm@linux-foundation.org \
    --cc=hcommowick@exosec.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=minoura@valinux.co.jp \
    --cc=nikola.ciprich@linuxbox.cz \
    --cc=paravoid@debian.org \
    --cc=peterz@infradead.org \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=stable@kernel.org \
    --cc=w@1wt.eu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox