public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* udelay and timers
@ 2008-09-26  7:51 Elias Oltmanns
  2008-09-26  9:42 ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Elias Oltmanns @ 2008-09-26  7:51 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner; +Cc: linux-kernel

Hi all,

finally, I have managed to identify the cause of some odd symptoms on my
system, but I need your help to understand what is really going on and
what should be done to fix things. My problem is this: I have written a
small test module which, in due course, does the following:

...
        mod_timer(&timera, jiffies + msecs_to_jiffies(10000));
        mod_timer(&timerb, jiffies + HZ/50);
...

The callbacks for those timers are defined as follows:

void timera.function(unsigned long data)
{
        udelay(120);
        mod_timer(&timera, jiffies + msecs_to_jiffies(10000));
}

void timerb.function(unsigned long data)
{
...
        mod_timer(&timerb, jiffies + HZ/50);
}

Now, I can observe that because of the call to udelay() in the callback
of timera, timerb rather frequently fires *much* too early, i.e. after
less than 1 msec rather than 20 msecs. This means that an udelay in a
timer callback heavily affects the precision of other timers running at
the time. The effect if particularly grave on a tickless system, but
even when NO_HZ was not set, I have observed this behaviour.

As I understand, udelay() is meant to be usable in softirq context. What
can I do to find out what exactly causes the problem?

Thank you very much for your assistance,

Elias

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: udelay and timers
  2008-09-26  7:51 udelay and timers Elias Oltmanns
@ 2008-09-26  9:42 ` Thomas Gleixner
  2008-09-28  8:55   ` Elias Oltmanns
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2008-09-26  9:42 UTC (permalink / raw)
  To: Elias Oltmanns; +Cc: Ingo Molnar, linux-kernel

On Fri, 26 Sep 2008, Elias Oltmanns wrote:

> Hi all,
> 
> finally, I have managed to identify the cause of some odd symptoms on my
> system, but I need your help to understand what is really going on and
> what should be done to fix things. My problem is this: I have written a
> small test module which, in due course, does the following:
> 
> ...
>         mod_timer(&timera, jiffies + msecs_to_jiffies(10000));
>         mod_timer(&timerb, jiffies + HZ/50);
> ...
> 
> The callbacks for those timers are defined as follows:
> 
> void timera.function(unsigned long data)
> {
>         udelay(120);
>         mod_timer(&timera, jiffies + msecs_to_jiffies(10000));
> }
> 
> void timerb.function(unsigned long data)
> {
> ...
>         mod_timer(&timerb, jiffies + HZ/50);
> }
> 
> Now, I can observe that because of the call to udelay() in the callback
> of timera, timerb rather frequently fires *much* too early, i.e. after
> less than 1 msec rather than 20 msecs. This means that an udelay in a
> timer callback heavily affects the precision of other timers running at
> the time. The effect if particularly grave on a tickless system, but
> even when NO_HZ was not set, I have observed this behaviour.
> 
> As I understand, udelay() is meant to be usable in softirq context. What
> can I do to find out what exactly causes the problem?

I have no idea what's going wrong. Can you please provide the full
source of your test module ?

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: udelay and timers
  2008-09-26  9:42 ` Thomas Gleixner
@ 2008-09-28  8:55   ` Elias Oltmanns
  0 siblings, 0 replies; 3+ messages in thread
From: Elias Oltmanns @ 2008-09-28  8:55 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Ingo Molnar, linux-kernel

[Apologies for the delayed response, I have just temporary internet
access right now.]

Thomas Gleixner <tglx@linutronix.de> wrote:
> On Fri, 26 Sep 2008, Elias Oltmanns wrote:
>
>> Hi all,
>> 
>> finally, I have managed to identify the cause of some odd symptoms on my
>> system, but I need your help to understand what is really going on and
>> what should be done to fix things. My problem is this: I have written a
>> small test module which, in due course, does the following:
[...]
>> Now, I can observe that because of the call to udelay() in the callback
>> of timera, timerb rather frequently fires *much* too early, i.e. after
>> less than 1 msec rather than 20 msecs. This means that an udelay in a
>> timer callback heavily affects the precision of other timers running at
>> the time. The effect if particularly grave on a tickless system, but
>> even when NO_HZ was not set, I have observed this behaviour.
>> 
>> As I understand, udelay() is meant to be usable in softirq context. What
>> can I do to find out what exactly causes the problem?
>
> I have no idea what's going wrong. Can you please provide the full
> source of your test module ?

Even though I still don't understand exactly what is going on myself, I
have, after some more testing, come to the conclusion that the ath5k
driver is to blame for messing up softirq handling. I have to talk to
the wireless people in order to get this sorted out. Sorry for the
noise.

Regards,

Elias

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-09-28  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-26  7:51 udelay and timers Elias Oltmanns
2008-09-26  9:42 ` Thomas Gleixner
2008-09-28  8:55   ` Elias Oltmanns

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox