linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Brodkin <alexey.brodkin@synopsys.com>
To: "daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>
Cc: "tglx@linutronix.de" <tglx@linutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Vineet Gupta <vineet.gupta1@synopsys.com>,
	"linux-snps-arc@lists.infradead.org" 
	<linux-snps-arc@lists.infradead.org>
Subject: Re: [PATCH v2] clocksource/drivers/arc_timer: Utilize generic sched_clock
Date: Mon, 19 Nov 2018 09:31:16 +0000	[thread overview]
Message-ID: <dab866a50e66e73f6010de1487b06019887930c8.camel@synopsys.com> (raw)
In-Reply-To: <2c46ab6e-f0a9-4857-9772-f3c714284e98@linaro.org>

Hi Daniel,

On Sun, 2018-11-18 at 03:17 +0100, Daniel Lezcano wrote:
> On 05/11/2018 15:39, Daniel Lezcano wrote:
> > On 24/10/2018 00:33, Vineet Gupta wrote:
> > > On 10/17/2018 04:30 AM, Alexey Brodkin wrote:
> > > > It turned out we used to use default implementation of sched_clock()
> > > > from kernel/sched/clock.c which was as precise as 1/HZ, i.e.
> > > > by default we had 10 msec granularity of time measurement.
> > > > 
> > > > Now given ARC built-in timers are clocked with the same frequency as
> > > > CPU cores we may get much higher precision of time tracking.
> > > > 
> > > > Thus we switch to generic sched_clock which really reads ARC hardware
> > > > counters.
> > > > 
> > > > This is especially helpful for measuring short events.
> > > > That's what we used to have:
> > > > ------------------------------>8------------------------
> > > > $ perf stat /bin/sh -c /root/lmbench-master/bin/arc/hello > /dev/null
> > > > 
> > > >  Performance counter stats for '/bin/sh -c /root/lmbench-master/bin/arc/hello':
> > > > 
> > > >          10.000000      task-clock (msec)         #    2.832 CPUs utilized
> > > >                  1      context-switches          #    0.100 K/sec
> > > >                  1      cpu-migrations            #    0.100 K/sec
> > > >                 63      page-faults               #    0.006 M/sec
> > > >            3049480      cycles                    #    0.305 GHz
> > > >            1091259      instructions              #    0.36  insn per cycle
> > > >             256828      branches                  #   25.683 M/sec
> > > >              27026      branch-misses             #   10.52% of all branches
> > > > 
> > > >        0.003530687 seconds time elapsed
> > > > 
> > > >        0.000000000 seconds user
> > > >        0.010000000 seconds sys
> > > > ------------------------------>8------------------------
> > > > 
> > > > And now we'll see:
> > > > ------------------------------>8------------------------
> > > > $ perf stat /bin/sh -c /root/lmbench-master/bin/arc/hello > /dev/null
> > > > 
> > > >  Performance counter stats for '/bin/sh -c /root/lmbench-master/bin/arc/hello':
> > > > 
> > > >           3.004322      task-clock (msec)         #    0.865 CPUs utilized
> > > >                  1      context-switches          #    0.333 K/sec
> > > >                  1      cpu-migrations            #    0.333 K/sec
> > > >                 63      page-faults               #    0.021 M/sec
> > > >            2986734      cycles                    #    0.994 GHz
> > > >            1087466      instructions              #    0.36  insn per cycle
> > > >             255209      branches                  #   84.947 M/sec
> > > >              26002      branch-misses             #   10.19% of all branches
> > > > 
> > > >        0.003474829 seconds time elapsed
> > > > 
> > > >        0.003519000 seconds user
> > > >        0.000000000 seconds sys
> > > > ------------------------------>8------------------------
> > > > 
> > > > Note how much more meaningful is the second output - time spent for
> > > > execution pretty much matches number of cycles spent (we're running
> > > > @ 1GHz here).
> > > > 
> > > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > > > Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> > > > Cc: Vineet Gupta <vgupta@synopsys.com>
> > > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > ---
> > > 
> > > Acked-by: Vineet Gupta <vgupta@synopsys.com>
> > > 
> > > @Daniel is this going via timer tree or you want me to pick it up.
> > 
> > I will take care of it.
> 
> Please resend without the arch Kconfig change

I'm wondering if there's a problem with arc/arc/Kconfig change going
through your tree? This way it will be really atomic change and it will be
much easier to back-port (and that's what we'd really like to happen).

If Vineet is OK with that IMHO it's safe to keep it in the one and only commit.

Otherwise should I just split this patch in 2 and still submit them as series or
have 2 completely not-related patches one for you and one for Vineet?

In that case do I understand correctly that we may enable GENERIC_SCHED_CLOCK
for ARC even before proposed change for arc_timer.c gets merged - i.e. with no
special GENERIC_SCHED_CLOCK driver we'll safely fall-back to jiffie-based
sched clock which we anyways use now when GENERIC_SCHED_CLOCK is disabled, right?

-Alexey

  reply	other threads:[~2018-11-19  9:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 11:30 [PATCH v2] clocksource/drivers/arc_timer: Utilize generic sched_clock Alexey Brodkin
2018-10-23 22:33 ` Vineet Gupta
2018-11-05 14:39   ` Daniel Lezcano
2018-11-18  2:17     ` Daniel Lezcano
2018-11-19  9:31       ` Alexey Brodkin [this message]
2018-11-19  9:43         ` Daniel Lezcano
2018-11-19  9:55           ` Alexey Brodkin
2018-11-19  9:58             ` Daniel Lezcano
2018-11-19 11:30               ` Alexey Brodkin
2018-11-05 14:48   ` Daniel Lezcano

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=dab866a50e66e73f6010de1487b06019887930c8.camel@synopsys.com \
    --to=alexey.brodkin@synopsys.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=tglx@linutronix.de \
    --cc=vineet.gupta1@synopsys.com \
    /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;
as well as URLs for NNTP newsgroup(s).