[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56BA16B5.60805@redhat.com>
Date: Tue, 09 Feb 2016 17:41:25 +0100
From: Denys Vlasenko <dvlasenk@...hat.com>
To: Steven Rostedt <rostedt@...dmis.org>
CC: linux-kernel@...r.kernel.org, srostedt@...hat.com,
Tejun Heo <tj@...nel.org>,
Peter Hurley <peter@...leysoftware.com>
Subject: Re: [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?
Powered by blists - more mailing lists