All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ryan Mallon <ryan@bluewatersys.com>
To: Tim Bird <tim.bird@am.sony.com>
Cc: "Steven Rostedt" <rostedt@goodmis.org>,
	"Ingo Molnar" <mingo@elte.hu>,
	"Frederic Weisbecker" <fweisbec@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"linux kernel" <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.arm.linux.org.uk>
Subject: Re: How to use a different sched_clock() for ftrace on omap?
Date: Thu, 07 May 2009 12:34:50 +1200	[thread overview]
Message-ID: <4A022CAA.9000302@bluewatersys.com> (raw)
In-Reply-To: <4A022333.8030200@am.sony.com>

Tim Bird wrote:
> Hi all,
> 
> I've worked up a replacement sched_clock for ftrace on my omap platform.
> The current sched_clock, based on the 32K timer, has low resolution and
> doesn't provide very useful results.
> 
> Unfortunately, I'm not sure the best way to use my special one, in place
> of a common one in arch/arm/plat-omap/common.c
> 
> I thought the __attribute__ ((weak)) would be enough to have the
> sched_clock() in common.c get out of the way, and allow my board-specific
> sched_clock() to be used.  But that didn't work. 

Not sure that will work correctly since sched_clock in kernel/sched.c is
already defined as weak. If you have two weak versions of a function I
think the one which gets used is based on link order (if your board's
sched_clock is not being used).

> What is the recommended
> way to specify a board-specific function at compile time?

You could look at arch/x86/kernel/tsc_32.c, I think it does what you
want by using the function called native_sched_clock for the default
sched_clock implementation and using the alias attribute if no board
specific implementation is given, ie:

#ifdef CONFIG_SOME_BOARD
unsigned long long sched_clock(void)
{
	some_board_sched_clock();
}
#else
unsigned long long sched_clock(void)
	__attribute__((alias("native_sched_clock")));
#endif

You could make it more generic by have some_board_sched_clock be a
#define (__board_sched_clock or something), so if a board defines it
(will need to be in a platform wide header) then you use that, otherwise
you use native_sched_clock.

~Ryan

-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

       Ryan Mallon                              Unit 5, Amuri Park
       Phone: +64 3 3779127                     404 Barbadoes St
       Fax:   +64 3 3779135                     PO Box 13 889
       Email: ryan@bluewatersys.com             Christchurch, 8013
       Web:   http://www.bluewatersys.com       New Zealand
       Freecall Australia  1800 148 751         USA 1800 261 2934

  reply	other threads:[~2009-05-07  0:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06 23:54 How to use a different sched_clock() for ftrace on omap? Tim Bird
2009-05-07  0:34 ` Ryan Mallon [this message]
2009-05-07  8:51 ` Ingo Molnar
2009-05-07 13:56   ` Steven Rostedt
2009-05-07 13:59     ` Ingo Molnar
     [not found] <cyZbZ-7Eg-9@gated-at.bofh.it>
2009-05-07 14:08 ` Kevin Hilman
2009-05-07 17:19   ` Tim Bird
2009-05-07 17:34     ` Kevin Hilman

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=4A022CAA.9000302@bluewatersys.com \
    --to=ryan@bluewatersys.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=tim.bird@am.sony.com \
    --cc=u.kleine-koenig@pengutronix.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.