lkml.org 
[lkml]   [2019]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] tty/n_hdlc: fix sleep in !TASK_RUNNING state warning
From
Date


> On Jan 2, 2019, at 7:04 AM, Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> wrote:
>
> On 2019/01/01 12:11, Paul Fulghum wrote:
>> NAK to this patch. It causes lost wakeups in both read and write paths.
>>
>> The write path does not need changing.
>>
>> The read path can be fixed by setting current to TASK_RUNNING at the top of the if (rbuf) block
>> so the warning is not triggered by copy_to_user(). If this block runs the condition is satisfied
>> and it breaks out of the polling loop where it is already being set to TASK_RUNNING and removed
>> from the wait queue. This particular path just needs to account for the copy_to_user which occurs
>> before breaking out.
>>
>> I’ll make a patch to do this when I have the ability to test it in a day or two.
>>
>
> OK. Then, any chance it is rewritten using wait_event_interruptible() in order to reduce lines?
> ( wait_event_interruptible() automatically calls might_sleep(), but is it acceptable for you? )
>

This looks good to me. I applied it and tested blocking (sleep/no sleep) and non-blocking (success/EAGAIN) paths for both read and write.
\
 
 \ /
  Last update: 2019-01-02 21:56    [W:0.162 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site