lkml.org 
[lkml]   [2012]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [RFC PATCH v2 01/10] CPU hotplug: Provide APIs for "light" atomic readers to prevent CPU offline
    From
    Date
    On Fri, 2012-12-07 at 01:06 +0530, Srivatsa S. Bhat wrote:
    > On 12/07/2012 12:58 AM, Steven Rostedt wrote:
    > > On Fri, 2012-12-07 at 00:18 +0530, Srivatsa S. Bhat wrote:
    > >> On 12/06/2012 09:48 PM, Oleg Nesterov wrote:
    > >>> On 12/06, Srivatsa S. Bhat wrote:
    > >>>>
    > >>>> +void get_online_cpus_atomic(void)
    > >>>> +{
    > >>>> + int c, old;
    > >>>> +
    > >>>> + preempt_disable();
    > >>>> + read_lock(&hotplug_rwlock);
    > >>>
    > >>> Confused... Why it also takes hotplug_rwlock?
    > >>
    > >> To avoid ABBA deadlocks.
    > >>
    > >> hotplug_rwlock was meant for the "light" readers.
    > >> The atomic counters were meant for the "heavy/full" readers.
    > >> I wanted them to be able to nest in any manner they wanted,
    > >> such as:
    > >>
    > >> Full inside light:
    > >>
    > >> get_online_cpus_atomic_light()
    > >> ...
    > >> get_online_cpus_atomic_full()
    > >> ...
    > >> put_online_cpus_atomic_full()
    > >> ...
    > >> put_online_cpus_atomic_light()
    > >>
    > >> Or, light inside full:
    > >>
    > >> get_online_cpus_atomic_full()
    > >> ...
    > >> get_online_cpus_atomic_light()
    > >> ...
    > >> put_online_cpus_atomic_light()
    > >> ...
    > >> put_online_cpus_atomic_full()
    > >>
    > >>



    > The root-cause of this deadlock is again lock-ordering mismatch right?
    > CPU0 takes locks in order A, B
    > CPU1 takes locks in order B, A
    >
    > And the writer facilitates in actually getting deadlocked.
    >
    > I avoid this in this patchset by always taking the locks in the same
    > order. So we won't be deadlocking like this.

    OK, I haven't looked closely at the patch yet. I'm currently hacking on
    my own problems. But just from the description above, it looked like you
    were using rw_locks() to be able to inverse the order of the locks.

    -- Steve




    \
     
     \ /
      Last update: 2012-12-06 23:41    [W:2.511 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site