lkml.org 
[lkml]   [2016]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] printk: avoid livelock if another CPU printks continuously
On 02/09/2016 04:50 PM, Steven Rostedt wrote:
> On Tue, 09 Feb 2016 16:24:29 +0100
>>>>>> + /* Good, other CPU entered "for(;;)" loop */
>>>>>> + goto out;
>>>>>> + }
>>>>>> + }
>>>>>> + /* No one seems to be willing to take it... */
>>>>>> + if (console_trylock())
>>>>>> + goto again; /* we took it */
>>>>>
>>>>> Perhaps add a few loops to the taking of the console sem.
>>>>
>>>> Why?
>>>>
>>>> If we fail to take the lock, another CPU took it.
>>>> There is no need to try harder, as soon as we know that any
>>>> other CPU took that lock, we can safely exit this function.
>>>
>>> Because if this CPU is the one spamming the other CPU, it will widen
>>> the window to be the one that takes the lock.
>>
>> If we reached this code, we aren't the spamming CPU. We are the CPU
>> which is being spammed (we are in the loop which services the backlog).
>
> No, I mentioned the taking of console sem. The spamming task will be
> trying that a bit, failing and then letting this CPU continue doing its
> bidding.

That's exactly what we *don't* want to happen.
We want that other CPU to get the lock.

How do you plan to achieve that, if not by giving it a grace period
when it can grab a lock?

\
 
 \ /
  Last update: 2016-02-09 18:01    [W:0.056 / U:3.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site