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:	Fri, 09 May 2008 14:13:45 +0200
From:	Gabriel C <nix.or.die@...glemail.com>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, "Rafael J. Wysocki" <rjw@...k.pl>,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	hinko.kocevar@...rtapot.si
Subject: Re: CONFIG_PRINTK_TIME broken on git HEAD ?

Peter Zijlstra wrote:
> On Thu, 2008-05-08 at 13:21 +0200, Gabriel C wrote:
> 
>>> Ok, so the issue is that the clock doesn't start at 0, but at:
>>> 4294014.506571 ?
>> At least on my box , yes.
>>
> 
> Does this work for you?

No it does not , I still get :

....

[    0.000000] PERCPU: Allocating 42756 bytes of per cpu data
[    0.000000] NR_CPUS: 8, nr_cpu_ids: 4
[4294014.506571] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 1010723                                                               

...

> 
> ---
> 
> Subject: sched: fixup sched-clock offset
> From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> 
> It could happen that ktime doesn't start at 0.
> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> ---
>  kernel/sched_clock.c |   16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> Index: linux-2.6-2/kernel/sched_clock.c
> ===================================================================
> --- linux-2.6-2.orig/kernel/sched_clock.c
> +++ linux-2.6-2/kernel/sched_clock.c
> @@ -59,21 +59,23 @@ static inline struct sched_clock_data *c
>  	return &per_cpu(sched_clock_data, cpu);
>  }
>  
> +static __read_mostly u64 ktime_offset;
> +
>  void sched_clock_init(void)
>  {
> -	u64 ktime_now = ktime_to_ns(ktime_get());
> -	u64 now = 0;
>  	int cpu;
>  
> +	ktime_offset = ktime_to_ns(ktime_get());
> +
>  	for_each_possible_cpu(cpu) {
>  		struct sched_clock_data *scd = cpu_sdc(cpu);
>  
>  		scd->lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;
>  		scd->prev_jiffies = jiffies;
> -		scd->prev_raw = now;
> -		scd->tick_raw = now;
> -		scd->tick_gtod = ktime_now;
> -		scd->clock = ktime_now;
> +		scd->prev_raw = 0;
> +		scd->tick_raw = 0;
> +		scd->tick_gtod = 0;
> +		scd->clock = 0;
>  	}
>  }
>  
> @@ -177,7 +179,7 @@ void sched_clock_tick(void)
>  	WARN_ON_ONCE(!irqs_disabled());
>  
>  	now = sched_clock();
> -	now_gtod = ktime_to_ns(ktime_get());
> +	now_gtod = ktime_to_ns(ktime_get()) - ktime_offset;
>  
>  	__raw_spin_lock(&scd->lock);
>  	__update_sched_clock(scd, now);
> 
> 
> 
--
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