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:	Wed, 11 Mar 2009 13:18:41 -0500
From:	Timur Tabi <timur@...escale.com>
To:	Alan Cox <alan@...rguk.ukuu.org.uk>
CC:	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	linux-kernel@...r.kernel.org, rdreier@...co.com,
	jirislaby@...il.com, peterz@...radead.org, will.newton@...il.com,
	hancockrwd@...il.com, jeremy@...p.org
Subject: Re: [PATCH v4] introduce macro spin_event_timeout()

Alan Cox wrote:
>> Are you talking about the udelay() inside the loop?  If so, I agree
>> that this is bad and have removed it in the PowerPC-specific version:
> 
> The behaviour you want there is system specific - 10uS is a minimum
> politeness value for x86 PCI bus for example.

So we need to allow for delays between successive rights?  We can
provide that with a third parameter to the macro.

>> rdtsc instruction.  In this case, we're not adding arbitrary delays
>> into the loop, and we're not using jiffies, but we are
>> architecture-dependent.
> 
> and not useful

Is there an architecture-independent method for reading a timebase
register that's not jiffies?

> A macro of this form really needs to be able to look like
> 
> 	spin_until_timeout(readb(foo) & 0x80, 30 * HZ) {
> 		udelay(10);
> 		/* Maybe do other stuff */
> 	}
> 
> to be more generally useful

You mean something like this:

#define spin_until_timeout(condition, timeout) 		\
	for (unsigned long __timeout = jiffies + (timeout);	\
		(!(condition) && time_after(jiffies, __timeout)); )

How do I return a value indicating whether a timeout occurred or
condition came true?

-- 
Timur Tabi
Linux kernel developer at Freescale
--
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