you can try and use hpet directly. 10MHZ is the minimum by spec. On Mon, Mar 16, 2009 at 2:07 PM, Denis Borisevich <dennisfen@xxxxxxxxx> wrote: > 2009/3/16 Matthias Kaehlcke <matthias@xxxxxxxxxxxx>: >> El Mon, Mar 16, 2009 at 01:03:35PM +0300 Denis Borisevich ha dit: >> >>> 2009/3/16 Razvan Deaconescu <razvan@xxxxxxxxxxxxxxxxxx>: >>> > On Mon, 2009-03-16 at 00:41 +0300, Denis Borisevich wrote: >>> >> Hi! >>> >> Is there any way to achieve a timeout of say 10 usecs in kernel module? >>> > >>> > See udelay[1]. Please note that it does busy-waiting (you can't >>> > block/put to sleep the current process for periods less than 1000/HZ >>> > milliseconds). >>> > >>> > Razvan >>> > >>> > [1] http://lxr.linux.no/linux+v2.6.28.7/arch/x86/include/asm/delay.h#20 >>> >>> >>> Hmm..busy-wait is not good for my situation. Is there any way to >>> achieve these little timeouts with RT_PREEMPT patch? >> >> user space processes can use nanosleep() for sleeping for short times, >> though the kernel only guarantees that the process will sleep *at >> least* the specified time. the implementation of nanosleep() uses >> hrtimer_nanosleep() to achieve this, maybe you could try something >> similar: >> >> http://lxr.linux.no/linux+v2.6.28/kernel/hrtimer.c#L1632 >> >> 10 usecs is a very short time for sleeping, i'm not sure if the kernel >> can provide this granularity. probably your task needs to have rt >> priority to be re-scheduled after such a short period. >> >> ftrace (Documentation/ftrace.txt) can be useful to determine whether >> the real sleep time is near to the period you pretend. >> >> -- >> Matthias Kaehlcke >> Embedded Linux Engineer >> Barcelona >> >> >> Someone has said that it requires less mental effort to condemn than to think >> (Emma Goldman) >> .''`. >> using free software / Debian GNU/Linux | http://debian.org : :' : >> `. `'` >> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- >> > > In our project we use rt-enabled kernel. And the application's main > working loop is about 2ms that's why I need such little timeouts in my > driver. > Thank you for your help. I will look at hr-timers usage. > > -- > Denis > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx > Please read the FAQ at http://kernelnewbies.org/FAQ > > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ