From: Shaohua Li <shli@fb.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Chris Mason <clm@fb.com>, Peter Zijlstra <peterz@infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
X86 ML <x86@kernel.org>, <Kernel-team@fb.com>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
John Stultz <john.stultz@linaro.org>
Subject: Re: [PATCH v2 3/3] X86: Add a thread cpu time implementation to vDSO
Date: Fri, 19 Dec 2014 10:16:13 -0800 [thread overview]
Message-ID: <20141219181613.GA86430@devbig257.prn2.facebook.com> (raw)
In-Reply-To: <CALCETrUaYkVtbxOHwsAe35L_Mfr3YLMnwX_FbR4D+EjNiuHwaQ@mail.gmail.com>
On Fri, Dec 19, 2014 at 09:53:24AM -0800, Andy Lutomirski wrote:
> On Fri, Dec 19, 2014 at 9:42 AM, Chris Mason <clm@fb.com> wrote:
> >
> >
> > On Fri, Dec 19, 2014 at 11:48 AM, Andy Lutomirski <luto@amacapital.net>
> > wrote:
> >>
> >> On Fri, Dec 19, 2014 at 3:23 AM, Peter Zijlstra <peterz@infradead.org>
> >> wrote:
> >>>
> >>> On Thu, Dec 18, 2014 at 04:22:59PM -0800, Andy Lutomirski wrote:
> >>>>
> >>>> Bad news: this patch is incorrect, I think. Take a look at
> >>>> update_rq_clock -- it does fancy things involving irq time and
> >>>> paravirt steal time. So this patch could result in extremely
> >>>> non-monotonic results.
> >>>
> >>>
> >>> Yeah, I'm not sure how (and if) we could make all that work :/
> >>
> >>
> >> I obviously can't comment on what Facebook needs, but if I were
> >> rigging something up to profile my own code*, I'd want a count of
> >> elapsed time, including user, system, and probably interrupt as well.
> >> I would probably not want to count time during which I'm not
> >> scheduled, and I would also probably not want to count steal time.
> >> The latter makes any implementation kind of nasty.
> >>
> >> The API presumably doesn't need to be any particular clock id for
> >> clock_gettime, and it may not even need to be clock_gettime at all.
> >>
> >> Is perf self-monitoring good enough for this? If not, can we make it
> >> good enough?
> >>
> >> * I do this today using CLOCK_MONOTONIC
> >
> >
> > The clock_gettime calls are used for a wide variety of things, but usually
> > they are trying to instrument how much CPU the application is using. So for
> > example with the HHVM interpreter they have a ratio of the number of hhvm
> > instructions they were able to execute in N seconds of cputime. This gets
> > used to optimize the HHVM implementation and can be used as a push blocking
> > counter (code can't go in if it makes it slower).
> >
> > Wall time isn't a great representation of this because it includes factors
> > that might be outside a given HHVM patch, but it sounds like we're saying
> > almost the same thing.
> >
> > I'm not familiar with the perf self monitoring?
>
> You can call perf_event_open and mmap the result. Then you can read
> the docs^Wheader file.
>
> On the god side, it's an explicit mmap, so all the nasty preemption
> issues are entirely moot. And you can count cache misses and such if
> you want to be fancy.
>
> On the bad side, the docs are a bit weak, and the added context switch
> overhead might be higher.
I'll measure the overhead for sure. If overhead isn't high, the perf
approach is very interesting. On the other hand, is it acceptable the
clock_gettime fallbacks to slow path if irq time is enabled (it's
overhead is high, we don't enable it actually)?
Thanks,
Shaohua
prev parent reply other threads:[~2014-12-19 18:17 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 23:12 [PATCH v2 1/3] X86: make VDSO data support multiple pages Shaohua Li
2014-12-17 23:12 ` [PATCH v2 2/3] X86: add a generic API to let vdso code detect context switch Shaohua Li
2014-12-19 1:05 ` Thomas Gleixner
2014-12-17 23:12 ` [PATCH v2 3/3] X86: Add a thread cpu time implementation to vDSO Shaohua Li
2014-12-18 23:30 ` Andy Lutomirski
2014-12-19 0:22 ` Andy Lutomirski
2014-12-19 0:30 ` Shaohua Li
2014-12-19 0:32 ` Andy Lutomirski
2014-12-19 0:34 ` Thomas Gleixner
2014-12-19 11:23 ` Peter Zijlstra
2014-12-19 16:48 ` Andy Lutomirski
2014-12-19 17:03 ` Peter Zijlstra
2014-12-19 17:07 ` Andy Lutomirski
2014-12-19 17:27 ` Peter Zijlstra
2014-12-19 17:42 ` Andy Lutomirski
2015-01-02 2:59 ` Shaohua Li
2015-01-02 15:31 ` David Ahern
2015-01-02 17:02 ` Shaohua Li
2015-01-02 17:09 ` David Ahern
2015-01-02 17:17 ` Shaohua Li
2015-01-02 17:26 ` David Ahern
2015-01-02 17:47 ` Andy Lutomirski
2015-01-05 23:23 ` Shaohua Li
2015-01-06 10:18 ` Peter Zijlstra
2015-01-06 16:59 ` Shaohua Li
2015-01-12 19:50 ` Shaohua Li
2014-12-19 17:42 ` Chris Mason
2014-12-19 17:53 ` Andy Lutomirski
2014-12-19 18:16 ` Shaohua Li [this message]
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=20141219181613.GA86430@devbig257.prn2.facebook.com \
--to=shli@fb.com \
--cc=Kernel-team@fb.com \
--cc=clm@fb.com \
--cc=hpa@zytor.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/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.