[lkml]   [2003]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH][2.6-mm] radeonfb as module
    On Tue, 2003-10-21 at 19:28, James Simmons wrote:
    > > acquire_console_sem is exported,
    > > but release_console_sem is not
    > >
    > > this seems like a bug for me,
    > > as if one acquire console_sem, he should be able to relase it
    > True that release_console_sem should be exported as well. But that lock
    > shouldn't be in a driver. In fbcon.c yes but not the driver. My next pacth
    > will fix that.

    Well... please leave it the way I did it for now. There are subtle
    races if you don't do. In a more general manner, there are a lot of
    races in fbdev regarding lack of console_sem. For example, we should
    take it on any mode change ioctl etc...

    The problem is that, except for eventual local spinlocks, the console
    sem is the only way to protect the low level drivers against concurrent
    accesses, and those _do_ need some protection or you can have
    accelerated printk racing against a mode change for example, etc...

    It's even worse if mode change can sleep. Some updates to fbdev I'm
    currently working on will require the ability to sleep from the
    set_par() function. I would even to sleep in blank(), but that's
    not possible, I think, at the moment (isn't it called by a timer
    in the console code ?) so I'm doing something more complicated
    using timers.

    So almost all calls to the fbdev should be done with the console
    sem held (even blank imho, if you can't get it using a trylock,
    delay it by firing the timer).

    Regarding the fb_client callbacks, to avoid lock nesting, I decided
    the only sane way is to have the _caller_ take the console sem.
    That's important as those can be called from things like set_par()
    which will (if the above is fixed properly) be called with the
    console sem already held. So the act of taking the console sem should
    be moved up the chain as much as possible. In the case of calls issued
    from outside the fbdev world, like PM callbacks, the driver can only
    take the console sem itself to protect against concurrent set_par
    among others.

    Now, if you want to "hide" the console sem, maybe export an fbdev_lock/
    unlock API whose implementation takes the console sem... That would
    allow maybe to move to a per-fbdev locking in the future provided we
    can deal with the "printk" problem (that is deferring actual display
    while still letting fbcon draw into the console buffer).


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:58    [W:0.024 / U:39.712 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site