Skip to contentSkip to conversation

Processes spinning forever, apparently in lock_timer_base()?

DISCUSSION Oleg Nesterov 1 participant 1 message Aug 3, 2007

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines · Chuck Ebbert

Looks like the same problem with spinlock unfairness we've seen
elsewhere: it seems to be looping here? Or is everyone stuck just waiting for writeout?

lock_timer_base():

Quoted 12 lines
        for (;;) {
                tvec_base_t *prelock_base = timer->base;
                base = tbase_get_base(prelock_base);
                if (likely(base != NULL)) {
                        spin_lock_irqsave(&base->lock, *flags);
                        if (likely(prelock_base == timer->base))
                                return base;
                        /* The timer has migrated to another CPU */
                        spin_unlock_irqrestore(&base->lock, *flags);
                }
                cpu_relax();
        }

I don't think there is an unfairness problem. We are looping only if timer->base changes in between. IOW, there is no "lock + unlock
+ lock(same_lock)" here, we take another lock on each iteration.

And:

Quoted 12 lines
 [<c0407208>] do_IRQ+0xbd/0xd1
 [<c042ffcb>] lock_timer_base+0x19/0x35
 [<c04300df>] __mod_timer+0x9a/0xa4
 [<c060bb55>] schedule_timeout+0x70/0x8f

...

 [<c0407208>] do_IRQ+0xbd/0xd1
 [<c042ffcb>] lock_timer_base+0x19/0x35
 [<c04300df>] __mod_timer+0x9a/0xa4
 [<c060bb55>] schedule_timeout+0x70/0x8f
Quoted 5 lines

...

 [<c042ffcb>] lock_timer_base+0x19/0x35
 [<c04300df>] __mod_timer+0x9a/0xa4
 [<c060bb55>] schedule_timeout+0x70/0x8f

All traces start from schedule_timeout()->mod_timer(). This timer is local, nobody can see it, its ->base can't be NULL or changed.

This means that lock_timer_base() can't loop, but can't take the tvec_t_base_s.lock. But in that case the trace should different, strange.

Oleg.