Skip to contentSkip to conversation

+ spinlock_debug-dont-recompute-jiffies_per_loop.patch added to -mm tree

DISCUSSION Chuck Ebbert 1 participant 1 message Jul 27, 2006

lore
Share & tools
lore
#0 lore raw

In-Reply-To: <[email protected]>

Quoted 11 lines · Ingo Molnar
Quoted 7 lines · Dave Jones
Quoted 2 lines

iteration limit, gets recomputed every time. Caching it explicitly prevents that.

What is the purpose of those __delays being there at all ? Seems odd to be waiting that long when the spinlock could become available a lot sooner. (These also make spinlock debug really painful on boxes with huge numbers of CPUs).

Quoted 5 lines

the debug code has to figure out when to trigger a deadlock warning message. If we are looping in a deadlock with irqs disabled on all CPUs, there's nothing that advances jiffies. The TSC is not reliable. The thing that remains is to use __delay(1). We could calibrate the loop separately perhaps?

Is there some reason this code:

                for (i = 0; i < loops_per_jiffy * HZ; i++) {
                        if (__raw_spin_trylock(&lock->raw_lock))
                                return;
                        __delay(1);
                }

needs to continuously try to update the spinlock? Shouldn't it just read it first, like this, to avoid the bus update traffic?

                        if (spin_can_lock(&lock->raw_lock) &&
                            __raw_spin_trylock(&lock->raw_lock))
                                return;

Also, looking at __delay(), I foresee problems on i386 with the HPET timer. Every call to __delay() causes at least two HPET timer reads and it looks like they're slow (using readl() on ioremapped memory, anyway.)

Signature · 1 line
Chuck