public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Derek Barbosa <debarbos@redhat.com>, john.ogness@linutronix.de
Cc: pmladek@suse.com, rostedt@goodmis.org, senozhatsky@chromium.org,
	linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	williams@redhat.com, jlelli@redhat.com, ahalaney@redhat.com,
	lgoncalv@redhat.com, jwyatt@redhat.com, aubaker@redhat.com
Subject: [PATCH] prinkt/nbcon: Add a scheduling point to nbcon_kthread_func().
Date: Thu, 20 Jun 2024 11:43:00 +0200	[thread overview]
Message-ID: <20240620094300.YJlW043f@linutronix.de> (raw)
In-Reply-To: <20240620093246.HE9XDWSZ@linutronix.de>

Constant printing can lead to a CPU hog in nbcon_kthread_func(). The
context is preemptible but on !PREEMPT kernels there is no explicit
preemption point which leads softlockup warnings.

Add an explicit preemption point in nbcon_kthread_func().

Reported-by: Derek Barbosa <debarbos@redhat.com>
Link: https://lore.kernel.org/ZnHF5j1DUDjN1kkq@debarbos-thinkpadt14sgen2i.remote.csb
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/printk/nbcon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
index bb9689f94d302..0813ce88a49c5 100644
--- a/kernel/printk/nbcon.c
+++ b/kernel/printk/nbcon.c
@@ -1119,6 +1119,7 @@ static int nbcon_kthread_func(void *__console)
 		}
 
 		console_srcu_read_unlock(cookie);
+		cond_resched();
 
 	} while (backlog);
 
-- 
2.45.2


  reply	other threads:[~2024-06-20  9:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 17:37 [BUG] printk/nbcon.c: watchdog BUG: softlockup - CPU#x stuck for 78s Derek Barbosa
2024-06-18 18:57 ` John Ogness
2024-06-18 22:52   ` Andrew Halaney
2024-06-19  5:09     ` John Ogness
2024-06-19  9:46     ` Petr Mladek
2024-06-20 17:27       ` Andrew Halaney
2024-06-21  7:57         ` Petr Mladek
2024-06-20  7:15 ` Sebastian Andrzej Siewior
2024-06-20  9:32   ` Sebastian Andrzej Siewior
2024-06-20  9:43     ` Sebastian Andrzej Siewior [this message]
2024-06-20 17:18       ` [PATCH] prinkt/nbcon: Add a scheduling point to nbcon_kthread_func() Andrew Halaney
2024-06-20 18:34         ` Derek Barbosa
2024-06-21  1:16       ` John Ogness

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=20240620094300.YJlW043f@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=ahalaney@redhat.com \
    --cc=aubaker@redhat.com \
    --cc=debarbos@redhat.com \
    --cc=jlelli@redhat.com \
    --cc=john.ogness@linutronix.de \
    --cc=jwyatt@redhat.com \
    --cc=lgoncalv@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=williams@redhat.com \
    /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