Re: [PATCH] lglock: Use spinlock_t instead of arch_spinlock_t

From: Ingo Molnar
Date: Tue Mar 31 2015 - 05:17:44 EST



* Daniel Wagner <daniel.wagner@xxxxxxxxxxxx> wrote:

> On 03/26/2015 05:03 PM, Peter Zijlstra wrote:
> > On Thu, Mar 26, 2015 at 04:02:08PM +0100, Daniel Wagner wrote:
> >> @@ -67,9 +67,9 @@ void lg_global_lock(struct lglock *lg)
> >> preempt_disable();
> >> lock_acquire_exclusive(&lg->lock_dep_map, 0, 0, NULL, _RET_IP_);
> >> for_each_possible_cpu(i) {
> >> - arch_spinlock_t *lock;
> >> + spinlock_t *lock;
> >> lock = per_cpu_ptr(lg->lock, i);
> >> - arch_spin_lock(lock);
> >> + spin_lock(lock);
> >> }
> >> }
> >
> > Nope, that'll blow up in two separate places.
> >
> > One: lockdep, it can only track a limited number of held locks, and it
> > will further report a recursion warning on the 2nd cpu.
>
> I was wondering why I haven't seen it explode. As it turns out I haven't
> looked closely enough at dmesg:
>
> [ +0.001231] BUG: MAX_LOCK_DEPTH too low!
> [ +0.000092] turning off the locking correctness validator.

Yeah, we try really hard to not crash the kernel from debugging code,
whenever we can avoid it! That sometimes creates a false sense of good
kernel health.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/