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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101208150517.GF9777@n2100.arm.linux.org.uk>
Date:	Wed, 8 Dec 2010 15:05:17 +0000
From:	Russell King - ARM Linux <linux@....linux.org.uk>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	Mikael Pettersson <mikpe@...uu.se>,
	Venkatesh Pallipadi <venki@...gle.com>,
	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	John Stultz <johnstul@...ibm.com>
Subject: Re: [BUG] 2.6.37-rc3 massive interactivity regression on ARM

On Wed, Dec 08, 2010 at 03:44:19PM +0100, Peter Zijlstra wrote:
> One of the problems is I think the cycles2ns multiplication of the raw
> clock, that makes dealing with wrap-around lots harder, so I guess we
> should deal with the wrap on the raw clock values and then apply
> cycles2ns on the delta or somesuch. But I expect the clocksource
> infrastructure already has something like that, John?

I've thought about that, but it becomes slightly problematical, as
was shown in one of the examples I provided.  If you do scale by
doing a 64-bit multiply and shift, you're always going to end up
with less than a 64-bit result.

I think your idea makes sense though, but I think for it to be able
to cover the full 64-bit range, we need to do the wraparound handling
after scaling.  So maybe something like the following:

static unsigned long long last_ns, cur_ns;
static unsigned long long max = (max_read_clock() * mult) >> shift;

unsigned long long sched_clock(void)
{
	unsigned long long cyc = read_clock();
	unsigned long long ns = (cyc * mult) >> shift;
	unsigned long long delta;

	spin_lock(&sched_clock_lock);
	delta = last_ns - ns;
	if (ns < last_ns)
		delta += max;

	last_ns = ns;
	ns = cur_ns += delta;
	spin_unlock(&sched_clock_lock);

	return ns;
}
--
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