Re: [RFC PATCH v2 01/10] CPU hotplug: Provide APIs for "light"atomic readers to prevent CPU offline

From: Oleg Nesterov
Date: Fri Dec 07 2012 - 16:01:30 EST


On 12/07, Srivatsa S. Bhat wrote:
>
> CPU 0 CPU 1
> ------ ------
>
> 1. Acquire lock A Increment CPU1's
> atomic counter
>
>
>
> 2. Increment CPU0's Try to acquire lock A
> atomic counter
>
>
> Now consider what happens if a hotplug writer (cpu_down) begins,

Exactly. So the fake lockdep_map should be per-cpu as well.

lglock doesn't need this because lg_local_lock() is not recursive
and lockdep can catch the bug like this. So it can look as single
lock for lockdep.

IOW. If you use the global lockdep_map and want lockdep to notice
this deadlock you need rwlock_acquire_read(map, 0, 0, IP). But then
lockdep will complain if the task does "read lock" under "read lock".

Oleg.

--
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/