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]
Message-ID: <4A03209E.4070603@garzik.org>
Date:	Thu, 07 May 2009 13:55:42 -0400
From:	Jeff Garzik <jeff@...zik.org>
To:	Alan Cox <alan@...rguk.ukuu.org.uk>
CC:	"H. Peter Anvin" <hpa@...or.com>, Christoph Lameter <cl@...ux.com>,
	Alok Kataria <akataria@...are.com>,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	the arch/x86 maintainers <x86@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86: Reduce the default HZ value

Alan Cox wrote:
> On Thu, 07 May 2009 12:55:05 -0400
> Jeff Garzik <jeff@...zik.org> wrote:
> 
>> H. Peter Anvin wrote:
>>> Alan Cox wrote:
>>>> Hooray - finally someone admits the *real* problem here, and for power
>>>> management too. Otherwise known as "referencing jiffies as a variable must
>>>> die"
>>> Amen.  Also, "using HZ as a unit of measurement must die, too."
>> Love to -- now, what will it be replaced with?
>>
>> grep for 'deadline' in drivers/ata/libata* to find an example not so 
>> easily converted away from jiffies.
> 
> I don't see any.
> 
> I do see a complicated interface that appears to actually really want to
> implement
> 
> 		add_timer(&foo->expiry_timer);
> 
> and checks against the timer completing. In fact it looks as if all the
> stuff in there is really down to
> 
> 		add a timer
> 		check if it expired
> 		check how long until it expires
> 		delete it

This is why I mentioned this example... because it's not as easy as you 
seem to think it is :)

We care only about a decreasing time interval.  This interval is passed 
to register polling functions (bitbang no longer than <this> amount of 
time), as well as _cumulatively_ affecting the entire EH [sub-]process.

A timer-based solution, in addition to being an ugly hack, would imply 
replacing a simple variable with _at least_ two spinlocks, plus a timer 
callback function that simply says "I expired".  With loops such as

	max_msecs = calc_deadline(overall_deadline, ...)
	while (!(register & bit))
		msleep(1)
		max_msecs--
		register = readl(...)

must be converted to the more-complex timer-based solution.		

libata would be happy to use milliseconds rather than jiffies; the unit 
does not matter.  What matters is calculating our progress versus the 
clock tick, as spread across multiple functions, multiple contexts, and 
register polling loops.

The current code is a -lot- more simple than checking "is timer 
expired?" all over the code, given that any sort of timer-based function 
implies dealing with additional concurrency issues -- a complication the 
libata EH does not need.

	Jeff



--
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