Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: rostedt@goodmis.org, Ralf Baechle <ralf@linux-mips.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>, Nicholas Mc Guire <der.herr@hofr.at>,
	David Daney <ddaney@caviumnetworks.com>,
	Richard Sandiford <rdsandiford@googlemail.com>,
	Patrik Kluba <kpajko79@gmail.com>,
	Michal Simek <monstr@monstr.eu>,
	"Maciej W . Rozycki" <macro@linux-mips.org>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
	zhangfx@lemote.com, zhouqg@gmail.com
Subject: Re: [PATCH v8 01/16] tracing: convert trace_clock_local() as weak function
Date: Mon, 16 Nov 2009 16:07:40 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.0911161559280.24119@localhost.localdomain> (raw)
In-Reply-To: <9dc81a7a9e5a292cccdf465c533a2b08d19d6021.1258177321.git.wuzhangjin@gmail.com>

On Sat, 14 Nov 2009, Wu Zhangjin wrote:

> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> trace_clock_local() is based on the arch-specific sched_clock(), in X86,
> it is tsc(64bit) based, which can give very high precision(about 1ns
> with 1GHz). but in MIPS, the sched_clock() is jiffies based, which can
> give only 10ms precison with 1000 HZ. which is not enough for tracing,
> especially for Real Time system.
> 
> so, we need to implement a MIPS specific sched_clock() to get higher
> precision. There is a tsc like clock counter register in MIPS, whose
> frequency is half of the processor, so, if the cpu frequency is 800MHz,
> the time precision reaches 2.5ns, which is very good for tracing, even
> for Real Time system.
> 
> but 'Cause it is only 32bit long, which will rollover quickly, so, such
> a sched_clock() will bring with extra load, which is not good for the
> whole system. so, we only need to implement a arch-specific
> trace_clock_local() for tracing. as a preparation, we convert it as a
> weak function.

Hmm, I'm not convinced that this is really a huge overhead. 

First of all the rollover happens once every 10 seconds on a 800MHz
machine. 

Secondly we have a lockless implementation of extending 32bit counters
to 63 bit which is used at least by ARM to provide a high resolution
sched_clock implementation. See include/linux/cnt32_63.h and the users
in arch/

But that's a problem which can be discussed seperately and does not
affect the rest of the tracing infrastructure. I really would
recommend that you implement a sched_clock for the r4k machines based
on cnt32_63 and measure the overhead. Having a fine granular
sched_clock in general is probably not a bad thing.

Thanks,

	tglx

  parent reply	other threads:[~2009-11-16 15:08 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-14  6:30 [PATCH v8 00/16] ftrace for MIPS Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 01/16] tracing: convert trace_clock_local() as weak function Wu Zhangjin
2009-11-16 15:01   ` Steven Rostedt
2009-11-16 15:07   ` Thomas Gleixner [this message]
2009-11-16 15:21     ` Wu Zhangjin
2009-11-16 15:47     ` Michal Simek
2009-11-14  6:33 ` [PATCH v8 02/16] tracing: add mips_timecounter_read() for MIPS Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 03/16] tracing: add MIPS specific trace_clock_local() Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 04/16] tracing: add static function tracer support for MIPS Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 05/16] tracing: enable HAVE_FUNCTION_TRACE_MCOUNT_TEST " Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 06/16] tracing: add an endian argument to scripts/recordmcount.pl Wu Zhangjin
2009-11-16 14:21   ` Thomas Gleixner
2009-11-16 14:29     ` Wu Zhangjin
2009-11-16 15:10       ` Steven Rostedt
2009-11-16 15:32       ` Thomas Gleixner
2009-11-14  6:33 ` [PATCH v8 07/16] tracing: add dynamic function tracer support for MIPS Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 08/16] tracing: add IRQENTRY_EXIT section " Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 09/16] tracing: define a new __time_notrace annotation flag Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 10/16] tracing: not trace the timecounter_read* in kernel/time/clocksource.c Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 11/16] tracing: not trace mips_timecounter_read() for MIPS Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 12/16] tracing: add function graph tracer support " Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 13/16] tracing: add dynamic function graph tracer " Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 14/16] tracing: make ftrace for MIPS work without -fno-omit-frame-pointer Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 15/16] tracing: reserve $12(t0) for mcount-ra-address of gcc 4.5 Wu Zhangjin
2009-11-14  6:33 ` [PATCH v8 16/16] tracing: make function graph tracer work with -mmcount-ra-address Wu Zhangjin
2009-11-16 13:48 ` [PATCH v8 00/16] ftrace for MIPS Ralf Baechle
2009-11-16 14:19   ` 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=alpine.LFD.2.00.0911161559280.24119@localhost.localdomain \
    --to=tglx@linutronix.de \
    --cc=ddaney@caviumnetworks.com \
    --cc=der.herr@hofr.at \
    --cc=fweisbec@gmail.com \
    --cc=kpajko79@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=mingo@elte.hu \
    --cc=monstr@monstr.eu \
    --cc=ralf@linux-mips.org \
    --cc=rdsandiford@googlemail.com \
    --cc=rostedt@goodmis.org \
    --cc=wuzhangjin@gmail.com \
    --cc=zhangfx@lemote.com \
    --cc=zhouqg@gmail.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