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:	Thu, 23 Jan 2014 09:53:54 +0800
From:	Dave Young <dyoung@...hat.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Markus Trippelsdorf <markus@...ppelsdorf.de>,
	Sasha Levin <sasha.levin@...cle.com>,
	Arjan van de Ven <arjan@...ux.intel.com>, lenb@...nel.org,
	rjw@...ysocki.net, Eliezer Tamir <eliezer.tamir@...ux.intel.com>,
	rui.zhang@...el.com, jacob.jun.pan@...ux.intel.com,
	Mike Galbraith <bitbucket@...ine.de>,
	Ingo Molnar <mingo@...nel.org>, hpa@...or.com,
	paulmck@...ux.vnet.ibm.com, Thomas Gleixner <tglx@...utronix.de>,
	John Stultz <john.stultz@...aro.org>,
	Andy Lutomirski <luto@...capital.net>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 13/15] sched: Use a static_key for sched_clock_stable

On 01/22/14 at 10:08pm, Peter Zijlstra wrote:
> > 
> > I think its the right region to look through. My current suspect is the
> > linear continuity fit with the initial 'random' multiplier.
> > 
> > That initial 'random' multiplier can get us quite high, and we'll fit
> > the function to match that but continue at a sane rate.
> > 
> > I'll try and prod a little more later this evening as time permits.
> 
> Does this cure things?

Peter, the odd timstamp still happens with this patch for me.

> 
> ---
>  arch/x86/kernel/tsc.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
> index a3acbac2ee72..bb04148c5fe0 100644
> --- a/arch/x86/kernel/tsc.c
> +++ b/arch/x86/kernel/tsc.c
> @@ -237,7 +237,7 @@ static inline unsigned long long cycles_2_ns(unsigned long long cyc)
>  /* XXX surely we already have this someplace in the kernel?! */
>  #define DIV_ROUND(n, d) (((n) + ((d) / 2)) / (d))
>  
> -static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
> +static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu, bool origin)
>  {
>  	unsigned long long tsc_now, ns_now;
>  	struct cyc2ns_data *data;
> @@ -252,7 +252,10 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
>  	data = cyc2ns_write_begin(cpu);
>  
>  	rdtscll(tsc_now);
> -	ns_now = cycles_2_ns(tsc_now);
> +	if (origin)
> +		ns_now = 0;
> +	else
> +		ns_now = cycles_2_ns(tsc_now);
>  
>  	/*
>  	 * Compute a new multiplier as per the above comment and ensure our
> @@ -926,7 +929,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
>  			mark_tsc_unstable("cpufreq changes");
>  	}
>  
> -	set_cyc2ns_scale(tsc_khz, freq->cpu);
> +	set_cyc2ns_scale(tsc_khz, freq->cpu, false);
>  
>  	return 0;
>  }
> @@ -1199,7 +1202,7 @@ void __init tsc_init(void)
>  	 */
>  	for_each_possible_cpu(cpu) {
>  		cyc2ns_init(cpu);
> -		set_cyc2ns_scale(cpu_khz, cpu);
> +		set_cyc2ns_scale(cpu_khz, cpu, true);
>  	}
>  
>  	if (tsc_disabled > 0)
--
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