public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Denys Vlasenko <dvlasenk@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, srostedt@redhat.com,
	Tejun Heo <tj@kernel.org>,
	Peter Hurley <peter@hurleysoftware.com>
Subject: Re: [PATCH] printk: avoid livelock if another CPU printks continuously
Date: Tue, 09 Feb 2016 17:41:25 +0100	[thread overview]
Message-ID: <56BA16B5.60805@redhat.com> (raw)
In-Reply-To: <20160209105024.3606f233@gandalf.local.home>

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?

  parent reply	other threads:[~2016-02-09 16:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 20:35 [PATCH] printk: avoid livelock if another CPU printks continuously Denys Vlasenko
2016-02-08 21:11 ` Steven Rostedt
2016-02-09 14:59   ` Denys Vlasenko
2016-02-09 15:17     ` Steven Rostedt
2016-02-09 15:24       ` Denys Vlasenko
2016-02-09 15:50         ` Steven Rostedt
2016-02-09 16:07           ` Denys Vlasenko
2016-02-09 16:33             ` Steven Rostedt
2016-02-09 16:41           ` Denys Vlasenko [this message]
2016-02-09 16:57             ` Steven Rostedt
2016-02-10 14:44 ` Petr Mladek
2016-02-10 16:10   ` Petr Mladek
2016-02-10 16:25     ` Steven Rostedt
2016-02-10 16:50       ` Peter Hurley
2016-02-11  8:21       ` Sergey Senozhatsky
2016-02-11 11:47         ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56BA16B5.60805@redhat.com \
    --to=dvlasenk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=rostedt@goodmis.org \
    --cc=srostedt@redhat.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox