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


Groups > linux.kernel > #1608070

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

Path csiph.com!news.mixmin.net!border2.nntp.ams1.giganews.com!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer04.fr7!futter-mich.highwinds-media.com!news.highwinds-media.com!fu-berlin.de!bofh.it!news.nic.it!robomod
From Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH 0/4] printk: introduce printing kernel thread
Date Fri, 24 Mar 2017 03:00:01 +0100
Message-ID <tomGd-2CL-7@gated-at.bofh.it> (permalink)
References <ti0fn-8f0-15@gated-at.bofh.it> <tnTux-6TD-17@gated-at.bofh.it> <to2o9-5jo-1@gated-at.bofh.it> <to6L8-8hs-13@gated-at.bofh.it>
X-Original-To Peter Zijlstra <peterz@infradead.org>, Petr Mladek <pmladek@suse.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qEdgxx5pxnPSTDH/i9CutVMtRKTA6UxAtWcGqyM22MI=; b=T1t8d4eHf0l6F9khUTU9JNhKKvQPoPVfQncpXpaBPl7fNkQxjtPKu9G2K8M2QiGi0i iSWxPk7E6rhWUJpEwucmFJ9T898O82JT9qVGd2dZ2cE7WpzX18XGX+Bnx0Llu2ysTzn7 y7OdIJ+b5TaFQvhgKWlUMvlh+RuZMlBITj0HHUeYFkIbVg9ITK7wjtm7ieSBo0BmkXln 4PA3GqgtIgQwBfN2BUJ7jLmuuSgQcK4dTvz9Dh4NE33ViIl2Zod3/QTZDPWAkOePdvx+ A/nRQpejPdgUAVHfjMEyOlWeZPqjKy52WYK2FULgi2ceIhQhLNulbTrnlb4AfrKJqDvi gqFA==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qEdgxx5pxnPSTDH/i9CutVMtRKTA6UxAtWcGqyM22MI=; b=fg9rdDaSiYEpdqIGZJ1PpVpTwr3+1BTORe3OtgJdWbh0wUHbmBzuKYb5qIN8tal4Iy ZurCilXczWAjIXH8+z8bj7ItwH6vgUy/RM/yrDLyv4HSwxVntfN0C/Ft+q3vQEka9ero sgg30IQm2QHHylf9oGvIA7XhG8OZ4vgyisV14nGGoalwt+T48eibYaiVCU9NqUjOO087 o3KD9Oo+i0/Mb+8yd9O2W8Tj5AlXUPPdz2g+HKu/ZFV+L0IWnoVpc5rhCGeZlwxJHxbY 8gEkfkbH87FCLI/MZHGsJo0D1E0GU43qrE6wXgri6/5nPVOmNWUyACdxB7LQpO+RAA78 u7Ww==
X-Gm-Message-State AFeK/H3oOhGP6AYDKVGP94c8tE5Or8ckspH9NRRz4QyXNS+T4pSQauFf1LgZ2k08ltdNEA==
X-Received by 10.99.226.83 with SMTP id y19mr6036054pgj.34.1490320779691; Thu, 23 Mar 2017 18:59:39 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.8.0 (2017-02-23)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 82
Organization linux.* mail to news gateway
X-Original-Cc Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>, Steven Rostedt <rostedt@goodmis.org>, Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org>, "Rafael J . Wysocki" <rjw@rjwysocki.net>, linux-kernel@vger.kernel.org, Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
X-Original-Date Fri, 24 Mar 2017 10:59:36 +0900
X-Original-Message-ID <20170324015936.GA366@jagdpanzerIV.localdomain>
X-Original-References <20170306124554.828-1-sergey.senozhatsky@gmail.com> <20170322175920.bcltzwega6dts2n4@hirez.programming.kicks-ass.net> <20170323040958.GB2519@jagdpanzerIV.localdomain> <20170323085143.2cpxgtlmhhrvrcbw@hirez.programming.kicks-ass.net>
X-Original-Sender linux-kernel-owner@vger.kernel.org
X-Received-Bytes 6084
X-Received-Body-CRC 2585189699
Xref csiph.com linux.kernel:1608070

Show key headers only | View raw


On (03/23/17 09:51), Peter Zijlstra wrote:
[..]
> > > 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?
> 
> Ah, that's what you meant. Yeah, dunno, I'm still unconvinced about the
> whole printk thread thing.

I see your point.
but I can't think of alternatives that would fix all those lockups and
stalls and at the same time have better guarantees than printk_kthread.


> Also those function names are horrifically long.

right. not happy with the naming either.

so what I'm thinking about right now is:

we have that thing which we call "old printk" mode, which is not
really informative. and my proposal is rename "old" mode and use
"printk rescue" mode instead. because we switch to that mode when
we are trying to "rescue" kernel logs. so the API can be something
like
		printk_rescue_on()
		printk_rescue_off()

opinions?



--- random thoughts ---

another thing that bothers me a bit is that we need to place those
printk_rescue_on/printk_rescue_off switches all over the kernel.
sort of a root cause [in some of the cases] here is the fact that
we don't have any feedback from printk_kthread in vprintk_emit():
	does printk_kthread make any progress?
	do we flush messages to the serial console?
	etc.

and we've got everything we need to have such a feedback in
vprintk_emit():

	a) console is not suspended so console_unlock() can call console drivers
	b) printk_kthread != NULL
	c) we are not in enforced rescue/emergency mode
	d) `log_next_seq' moves forward (always `true', we are in vprintk_emit())
	e) `console_seq' stands still

so we can have an automatic rescue mode fallback in vprintk_emit().
if (a)-(e) are true then we give up on waking up printk_kthread,
switch to rescue mode and attempt to console_trylock() directly from
vprintk_emit(). the part that sucks here is that we need to give
printk_kthread some time to catch up. for instance, if (e) is true
for the past 50 invocations of vprintk_emit(), IOW:

	- we added 50 lines to printk
	- none have been printed on the serial console

then we
	- declare rescue
	- do console_trylock() instead of wake_up() //unless in deferred vprintk_emit()


50 is completely made up. can be 100, or 10, or anything else.


and we can jump between rescue-normal printk modes, so this should
also return back the throttling of tasks which printk() a lot (item
(2) in patch set cover letter) that we used to have.


thoughts?

	-ss

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