lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 24 May 2009 09:57:18 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Linus Walleij <linus.ml.walleij@...il.com>
Cc:	linux-kernel@...r.kernel.org, mingo@...e.hu,
	linux-arm-kernel@...ts.arm.linux.org.uk
Subject: Re: [PATCH] U300 sched_clock implementation

On Sat, 2009-05-23 at 23:46 +0200, Linus Walleij wrote:

> This overrides the global sched_clock() symbol in the Linux
> scheduler with a local implementation which takes advantage of
> the timesource in U300 giving a scheduling resolution of 1us. The
> solution is the same as found in the OMAP2 core code.

We assume sched_clock() to return time in ns (e-9) resolution.

> Signed-off-by: Linus Walleij <linus.walleij@...ricsson.com>
> ---
>  arch/arm/mach-u300/timer.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
> index 4bf82f8..222de18 100644
> --- a/arch/arm/mach-u300/timer.c
> +++ b/arch/arm/mach-u300/timer.c
> @@ -346,6 +346,22 @@ static struct clocksource clocksource_u300_1mhz = {
>        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
>  };
> 
> +/*
> + * Override the global weak sched_clock symbol with this
> + * local implementation which uses the clocksource to get some
> + * better resolution when scheduling the kernel. We accept that
> + * this wraps around for now, since it is just a relative time
> + * stamp. (Inspired by OMAP implementation.)
> + */
> +unsigned long long sched_clock(void)
> +{
> +       unsigned long long ret;
> +
> +       ret = (unsigned long long) u300_get_cycles();
> +       ret = (ret * clocksource_u300_1mhz.mult_orig) >>
> +               clocksource_u300_1mhz.shift;
> +       return ret;
> +}
> 
>  /*
>  * This sets up the system timers, clock source and clock event.
> --
> 1.6.2.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ