public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-rt-users <linux-rt-users@vger.kernel.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCH RT] printk: Shortcut out of waiter spinning on PREEMPT_RT
Date: Wed, 16 Jan 2019 11:07:51 +0100	[thread overview]
Message-ID: <20190116100751.2glxadlpco7a46o5@pathway.suse.cz> (raw)
In-Reply-To: <20190115145815.13713791@gandalf.local.home>

On Tue 2019-01-15 14:58:15, Steven Rostedt wrote:
> On Tue, 15 Jan 2019 19:54:33 +0100
> Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> 
> > On 2019-01-15 12:39:10 [-0500], Steven Rostedt wrote:
> > > --- a/kernel/printk/printk.c
> > > +++ b/kernel/printk/printk.c
> > > @@ -1742,6 +1742,13 @@ static int console_trylock_spinning(void)
> > >  	if (console_trylock())
> > >  		return 1;
> > >  
> > > +	/*
> > > +	 * The consoles are preemptable in PREEMPT_RT, which can cause
> > > +	 * spinning to deadlock.
> > > +	 */
> > > +	if (IS_ENABLED(CONFIG_PREEMPT_RT_FULL))
> > > +		return 0;
> > > +
> > >  	printk_safe_enter_irqsave(flags);
> > >  
> > >  	raw_spin_lock(&console_owner_lock);  
> > 
> > So my ("printk: Make rt aware") patch does:
> > 
> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > index 6553508ff3889..d983c509f74a2 100644
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -1617,6 +1617,7 @@ SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len)
> >         return do_syslog(type, buf, len, SYSLOG_FROM_READER);
> >  }
> >  
> > +#ifndef CONFIG_PREEMPT_RT_FULL
> >  /*
> >   * Special console_lock variants that help to reduce the risk of soft-lockups.
> >   * They allow to pass console_lock to another printk() call using a busy wait.
> > @@ -1757,6 +1758,15 @@ static int console_trylock_spinning(void)
> >         return 1;
> >  }
> >  
> > +#else
> > +
> > +static int console_trylock_spinning(void)
> > +{
> > +       return console_trylock();
> > +}
> > +
> > +#endif
> > +
> >  /*
> >   * Call the console drivers, asking them to write out
> >   * log_buf[start] to log_buf[end - 1].
> > 
> > 
> > So it never gets into the codepath where you try to avoid spinning.
> > Right?
> >
> 
> You right! Which appears to be missing from my 4.14, and I thought I
> looked for that in 4.19-rt too, but I guess I was still looking at
> 4.14 :-/. OK, ignore. Sorry for the noise.
> 
> Well, it wasn't a total waste. I now know what to backport to 4.14-rt
> ;-)

The patch makes perfect sense. But it is not ready for upstream
because CONFIG_PREEMPT_RT_FULL is not there yet. Do I get it
correctly, please?

Best Regards,
Petr

  reply	other threads:[~2019-01-16 10:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 17:39 [PATCH RT] printk: Shortcut out of waiter spinning on PREEMPT_RT Steven Rostedt
2019-01-15 18:54 ` Sebastian Andrzej Siewior
2019-01-15 19:58   ` Steven Rostedt
2019-01-16 10:07     ` Petr Mladek [this message]
2019-01-16 11:43       ` Sergey Senozhatsky
2019-01-16 12:27         ` Steven Rostedt

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=20190116100751.2glxadlpco7a46o5@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tglx@linutronix.de \
    /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