lkml.org 
[lkml]   [2008]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] video4linux: Push down the BKL
    On Tue, 27 May 2008 13:31:00 -0300
    Mauro Carvalho Chehab <mchehab@infradead.org> wrote:

    > Since the other methods don't explicitly call BKL (and, AFAIK, kernel
    > open handler don't call it neither), if a program 1 is opening a
    > device and initializing some data, and a program 2 starts doing
    > ioctl, interrupting program 1 execution in the middle of a data
    > initialization procedure, you may have a race condition, since some
    > devices initialize some device global data during open [1].

    In fact, 2.6.26 and prior kernels *do* acquire the BKL on open (for
    char devices) - that's the behavior that the bkl-removal tree is there
    to do away with. So, for example, I've pushed that acquisition down
    into video_open() instead.

    So, for now, open() is serialized against ioctl() in video drivers. As
    soon as you take the BKL out of ioctl(), though, that won't happen,
    unless the mutex you use is also acquired in the open path.

    jon


    \
     
     \ /
      Last update: 2008-05-27 18:41    [W:3.414 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site