Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1607170

Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread

From Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread
Date 2017-03-23 05:20 +0100
Message-ID <to2o9-5jo-1@gated-at.bofh.it> (permalink)
References <ti0fn-8f0-15@gated-at.bofh.it> <tnTux-6TD-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello Peter,

thanks for taking a look.

On (03/22/17 18:59), Peter Zijlstra wrote:
> On Mon, Mar 06, 2017 at 09:45:50PM +0900, Sergey Senozhatsky wrote:
> >  sysrq is potentially even trickier. can we always wake_up() kernel
> >  thread from sysrq? there probably might be cases when we can't rely
> >  on the scheduler.
> 
> sysrq runs from interrupt context, right? Should be able to do wakeups.

what I though about was -
	what if there are 'misbehaving' higher prio tasks all the time?
	the existing sysrq would attempt to do printing from irq context
	so it doesn't care about run queues.

does it make sense to you?

so what I have currently is something like this:
(not so sure about sysrq_handle_showstate_blocked())

---
 drivers/tty/sysrq.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index c6fc7141d7b2..f0d2684fa99c 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -49,6 +49,7 @@
 #include <linux/syscalls.h>
 #include <linux/of.h>
 #include <linux/rcupdate.h>
+#include <linux/console.h>
 
 #include <asm/ptrace.h>
 #include <asm/irq_regs.h>
@@ -239,6 +240,7 @@ static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus);
 
 static void sysrq_handle_showallcpus(int key)
 {
+	console_printing_thread_off();
 	/*
 	 * Fall back to the workqueue based printing if the
 	 * backtrace printing did not succeed or the
@@ -253,6 +255,7 @@ static void sysrq_handle_showallcpus(int key)
 		}
 		schedule_work(&sysrq_showallcpus);
 	}
+	console_printing_thread_on();
 }
 
 static struct sysrq_key_op sysrq_showallcpus_op = {
@@ -279,8 +282,10 @@ static struct sysrq_key_op sysrq_showregs_op = {
 
 static void sysrq_handle_showstate(int key)
 {
+	console_printing_thread_off();
 	show_state();
 	show_workqueue_state();
+	console_printing_thread_on();
 }
 static struct sysrq_key_op sysrq_showstate_op = {
 	.handler	= sysrq_handle_showstate,
@@ -291,7 +296,9 @@ static struct sysrq_key_op sysrq_showstate_op = {
 
 static void sysrq_handle_showstate_blocked(int key)
 {
+	console_printing_thread_off();
 	show_state_filter(TASK_UNINTERRUPTIBLE);
+	console_printing_thread_on();
 }
 static struct sysrq_key_op sysrq_showstate_blocked_op = {
 	.handler	= sysrq_handle_showstate_blocked,
-- 
2.12.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread Peter Zijlstra <peterz@infradead.org> - 2017-03-22 19:50 +0100
  Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-03-23 05:20 +0100
    Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread Peter Zijlstra <peterz@infradead.org> - 2017-03-23 10:00 +0100
      Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-03-24 03:00 +0100
        Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-03-24 05:50 +0100
        Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread Petr Mladek <pmladek@suse.com> - 2017-03-24 15:50 +0100
          Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-03-25 01:30 +0100
  Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread Petr Mladek <pmladek@suse.com> - 2017-03-23 13:10 +0100

csiph-web