George Nychis | 6 Oct 17:38

how to link to hrtimers in the kernel

Hi all,

I have modified drivers/usb/core/devio.c to use hrtimer_nanosleep(), and 
have included linux/hrtimer.h with it.

But now I am having trouble linking, I get:
ERROR: "hrtimer_nanosleep" [drivers/usb/core/usbcore.ko] undefined!

How do I properly link to the hrtimer library?

Thanks!
George
Randy.Dunlap | 6 Oct 18:33

[patch] Re: how to link to hrtimers in the kernel

On Mon, 6 Oct 2008, George Nychis wrote:

> Hi all,
> 
> I have modified drivers/usb/core/devio.c to use hrtimer_nanosleep(), and have
> included linux/hrtimer.h with it.
> 
> But now I am having trouble linking, I get:
> ERROR: "hrtimer_nanosleep" [drivers/usb/core/usbcore.ko] undefined!
> 
> How do I properly link to the hrtimer library?

Hi,
That function needs to be exported in its source file.
Patch below should fix it for you.

From: Randy Dunlap <randy.dunlap <at> oracle.com>

Export hrtimer_nanosleep() for module use.

Signed-off-by: Randy Dunlap <randy.dunlap <at> oracle.com>
---
 kernel/hrtimer.c |    1 +
 1 file changed, 1 insertion(+)

--- linux-2.6.27-rc8-git5.orig/kernel/hrtimer.c
+++ linux-2.6.27-rc8-git5/kernel/hrtimer.c
@@ -1559,6 +1559,7 @@ out:
 	destroy_hrtimer_on_stack(&t.timer);
 	return ret;
(Continue reading)

Thomas Gleixner | 6 Oct 18:51

Re: [patch] Re: how to link to hrtimers in the kernel

On Mon, 6 Oct 2008, Randy.Dunlap wrote:
> On Mon, 6 Oct 2008, George Nychis wrote:
> 
> > Hi all,
> > 
> > I have modified drivers/usb/core/devio.c to use hrtimer_nanosleep(), and have
> > included linux/hrtimer.h with it.

Please do not use hrtimer_nanosleep() in drivers. That's
wrong.

What do you want to achieve ?

> Export hrtimer_nanosleep() for module use.

NAK, hrtimer_nanosleep is part of the user space interfaces.

> Signed-off-by: Randy Dunlap <randy.dunlap <at> oracle.com>
> ---
>  kernel/hrtimer.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- linux-2.6.27-rc8-git5.orig/kernel/hrtimer.c
> +++ linux-2.6.27-rc8-git5/kernel/hrtimer.c
> @@ -1559,6 +1559,7 @@ out:
>  	destroy_hrtimer_on_stack(&t.timer);
>  	return ret;
>  }
> +EXPORT_SYMBOL_GPL(hrtimer_nanosleep);
>  
(Continue reading)

George Nychis | 6 Oct 19:16

Re: [patch] Re: how to link to hrtimers in the kernel


Thomas Gleixner wrote:
> On Mon, 6 Oct 2008, Randy.Dunlap wrote:
>> On Mon, 6 Oct 2008, George Nychis wrote:
>>
>>> Hi all,
>>>
>>> I have modified drivers/usb/core/devio.c to use hrtimer_nanosleep(), and have
>>> included linux/hrtimer.h with it.
> 
> Please do not use hrtimer_nanosleep() in drivers. That's
> wrong.
> 
> What do you want to achieve ?
>  

I am trying to sleep at the microsecond level, which ssleep and msleep 
cannot provide.  I couldn't find any other nanosleep method in the kernel.

I found information by searching the net on using jiffies to accomplish 
sleep periods, but that is not high enough in resolution.

I'd greatly appreciate any feedback.

Thanks!
George
Brian Pomerantz | 7 Oct 16:55

Re: [patch] Re: how to link to hrtimers in the kernel

On Mon, Oct 06, 2008 at 01:16:15PM -0400, George Nychis wrote:
> 
> I am trying to sleep at the microsecond level, which ssleep and msleep 
> cannot provide.  I couldn't find any other nanosleep method in the kernel.
> 
> I found information by searching the net on using jiffies to accomplish 
> sleep periods, but that is not high enough in resolution.
> 
> I'd greatly appreciate any feedback.
> 

Is there any reason you can't use udelay()/ndelay()?

BAPper

Gmane