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:	Sun, 11 May 2008 15:43:29 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Andi Kleen <andi@...stfloor.org>
cc:	linux-kernel@...r.kernel.org
Subject: Re: better msleep for drivers

Andi,

On Sun, 11 May 2008, Andi Kleen wrote:
> Someone asked if there is a msleep using hrtimers that is more accurate
> than jiffies/msecs for external drivers. There is hrtimer nanosleep,
> but it is currently not exported. It can be reimplemented using hrtimer_start
> etc. which are exported, but that seems rather clumpsy.
> 
> Is there any reason such an obvious function is not exported? 

Well, there was not yet a request / requirement for it.

> Ok I guess right now nobody in tree is using it. But that seems wrong.  
> Perhaps we should have a (exported) usleep_blocking() wrapper or somesuch for 
> that case?  
> 
> I suspect that a lot of drivers could make use of it. Just from grepping we 
> have a lot of msleep(1)s in drivers and I suspect a lot of those would 
> actually like to delay shorter than one jiffie.

Depends, lots of them are just the kind of "lets delay it a bit" with
no real requirement to be accurate. I agree that there are use cases
which could benefit from a more precise sleep facility than msleep
actually is, but we need to have a careful eye on the possible abuse
of such an interface.

> One argument against it would be that it makes them more difficult to test 
> because behavior will differ between hrtimer enabled and disabled systems. 

That's what other in tree hrtimer users already face today. scheduler,
networking and the user space interfaces. So that should be not a too
big problem as the hrtimer infrastructure guarantees that the timer
does not expire early whether highres is enabled or not. It's just
less finegrained with highres=off and that's just the same as we have
right now with msleep().

> Still longer term I suppose there's really no way around having accurate
> sleep functions and it's probably better to start testing earlier than later.

No objections, but we should not do that with a stupid msleep
replacement interface; instead we should expose a flexible in kernel
variant of hrtimer_nanosleep() which lets the user utilize
ABS/REL_TIME and the different clocks. A msleep helper can be built on
top of this very easily.

Thanks,
	tglx
--
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