lkml.org 
[lkml]   [2016]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v10 1/2] printk: Make printk() completely async
    On (08/26/16 10:56), Sergey Senozhatsky wrote:


    > but every lock we take is potentially dangerous as well.
    ...
    > vprintk_emit()
    > {
    > alt_printk_enter();
    > ...
    > log_store();
    > ...
    > alt_printk_exit();
    >
    > wakep_up_process() /* direct from async printk,
    > or indirect from console_unlock()->up() */
    > alt_printk_enter();
    > ... enqueue task
    > alt_printk_exit();
    > }


    OTOH, after a very quick thought, up() also takes a spin lock, which
    may spindump. so I'll probably prefer to keep the entire alt-printk
    thing entirely in printk(). something like this

    vprintk_emit()
    {
    alt_printk_enter()
    log_store()
    alt_printk_exit()

    if (async_printk)
    {
    alt_printk_enter()
    wake_up_process()
    alt_printk_exit()
    } else {
    if (console_trylock()) {
    console_unlock()
    {
    ....
    alt_printk_enter()
    up()
    alt_printk_exit()
    }
    }
    }
    }

    this leaves console_trylock() `unprotected'. so I guess I'll do
    something like this:

    } else {
    int ret;

    alt_printk_enter()
    ret = console_trylock();
    alt_printk_exit()

    if (ret)
    console_unlock();
    }

    a bit ugly, but well, it is what it is. will think more about it.

    -ss

    \
     
     \ /
      Last update: 2016-09-17 09:57    [W:2.873 / U:1.356 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site