linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org,
	linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Carsten Emde <C.Emde@osadl.org>, John Kacur <jkacur@redhat.com>,
	Frank Rowand <frank.rowand@am.sony.com>,
	Frank <Frank_Rowand@sonyusa.com>
Subject: [PATCH RT 1/2] fix printk flush of messages
Date: Fri, 24 Aug 2012 23:12:20 -0400	[thread overview]
Message-ID: <20120825031657.843877293@goodmis.org> (raw)
In-Reply-To: 20120825031219.772181128@goodmis.org

[-- Attachment #1: 0001-fix-printk-flush-of-messages.patch --]
[-- Type: text/plain, Size: 1778 bytes --]

Updates console-make-rt-friendly.patch

#ifdef CONFIG_PREEMPT_RT_FULL, printk() output is never flushed by
printk() because:

   # some liberties taken in this pseudo-code to make it easier to follow
   printk()
      vprintk()
         raw_spin_lock(&logbuf_lock)
            # increment preempt_count():
            preempt_disable()
      result = console_trylock_for_printk()
         retval = 0
         # lock will always be false, because preempt_count() will be >= 1
         lock = ... && !preempt_count()
         if (lock)
            retval = 1
         return retval
      # result will always be false since lock will always be false
      if (result)
         console_unlock()
            # this is where the printk() output would be flushed

On system boot some printk() output is flushed because register_console()
and tty_open() call console_unlock().

This change also fixes the problem that was previously fixed by
preempt-rt-allow-immediate-magic-sysrq-output-for-preempt_rt_full.patch

Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Cc: Frank <Frank_Rowand@sonyusa.com>
Link: http://lkml.kernel.org/r/4FB44FD0.4090800@am.sony.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/printk.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index 9eabbbb..66e83e5 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -836,7 +836,7 @@ static int console_trylock_for_printk(unsigned int cpu, unsigned long flags)
 	int retval = 0, wake = 0;
 #ifdef CONFIG_PREEMPT_RT_FULL
 	int lock = (!early_boot_irqs_disabled && !irqs_disabled_flags(flags) &&
-		!preempt_count()) || sysrq_in_progress;
+		(preempt_count() <= 1)) || sysrq_in_progress;
 #else
 	int lock = 1;
 #endif
-- 
1.7.10.4

  reply	other threads:[~2012-08-25  3:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-25  3:12 [PATCH RT 0/2] [ANNOUNCE] 3.2.28-rt42-rc1 stable review Steven Rostedt
2012-08-25  3:12 ` Steven Rostedt [this message]
2012-08-25  3:12 ` [PATCH RT 2/2] Linux 3.2.27-rt41-rc1 Steven Rostedt
  -- strict thread matches above, loose matches on Subject: below --
2012-09-13 18:57 [PATCH RT 0/2] [ANNOUNCE] 3.2.28-rt43-rc1 stable review Steven Rostedt
2012-09-13 18:57 ` [PATCH RT 1/2] fix printk flush of messages Steven Rostedt
2012-09-13 18:52 [PATCH RT 0/2] [ANNOUNCE] 3.0.42-rt64-rc1 stable review Steven Rostedt
2012-09-13 18:52 ` [PATCH RT 1/2] fix printk flush of messages Steven Rostedt
2012-08-25  3:49 [PATCH RT 0/2] [ANNOUNCE] 3.0.41-rt62-rc1 stable review Steven Rostedt
2012-08-25  3:49 ` [PATCH RT 1/2] fix printk flush of messages Steven Rostedt
2012-05-17  1:05 Frank Rowand

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=20120825031657.843877293@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=C.Emde@osadl.org \
    --cc=Frank_Rowand@sonyusa.com \
    --cc=frank.rowand@am.sony.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).