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


Groups > linux.kernel > #1361572

Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async

From Byungchul Park <byungchul.park@lge.com>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async
Date 2016-03-21 09:10 +0100
Message-ID <rf34u-2NK-15@gated-at.bofh.it> (permalink)
References (1 earlier) <reMmZ-81x-3@gated-at.bofh.it> <reVzY-65f-7@gated-at.bofh.it> <reWcG-6lC-3@gated-at.bofh.it> <reWml-6pV-1@gated-at.bofh.it> <rf2Bs-2nn-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Mar 21, 2016 at 04:35:07PM +0900, Sergey Senozhatsky wrote:
> On (03/21/16 09:56), Byungchul Park wrote:
> > > > > +	if (!sync_print) {
> > > > > +		if (in_sched) {
> > > > > +			/*
> > > > > +			 * @in_sched messages may come too early, when we don't
> > > > > +			 * yet have @printk_kthread. We can't print deferred
> > > > > +			 * messages directly, because this may deadlock, route
> > > > > +			 * them via IRQ context.
> > > > > +			 */
> > > > > +			__this_cpu_or(printk_pending,
> > > > > +					PRINTK_PENDING_OUTPUT);
> > > > > +			irq_work_queue(this_cpu_ptr(&wake_up_klogd_work));
> > > > > +		} else if (printk_kthread && !in_panic) {
> > > > > +			/* Offload printing to a schedulable context. */
> > > > > +			wake_up_process(printk_kthread);
> > > > 
> > > > It will not print the "lockup suspected" message at all, for e.g. rq->lock,
> > > > p->pi_lock and any locks which are used within wake_up_process().
> > > 
> > > this will switch to old SYNC printk() mode should such a lockup ever
> > > happen, which is a giant advantage over any other implementation; doing
> > > wake_up_process() within the 'we can detect recursive printk() here'
> > > gives us better control.
> > > 
> > > why
> > >   printk()->IRQ->wake_up_process()->spin_dump()->printk()->IRQ->wake_up_process()->spin_dump()->printk()->IRQ...
> > > is better?
> > 
> > What is IRQ?
> 
> this is how printk() can print the messages in async mode apart from
> direct and wake_up_process() in vprintk_emit().

Do you mean IRQ work?

Is there any reason why you don't put the wake_up_process() out of the
critical section with my suggestion, even though it can solve the infinite
recuresion you worried about?

> 
> 	-ss
> 
> > > > Furtheremore, any printk() within wake_up_process() cannot work at all, as
> > > > well.
> > > 
> > > there is printk_deferred() which has LOGLEVEL_SCHED and which must be used
> > > in sched functions.
> > 
> > It would be good for all scheduler code to use the printk_deferred() as you
> > said, but it's not true yet.
> > 
> > > 
> > > 	-ss
> > 

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


Thread

[RFC][PATCH v5 0/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-03-20 15:20 +0100
  [RFC][PATCH v5 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-03-20 15:20 +0100
    Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-21 01:10 +0100
      Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-21 01:50 +0100
        Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-21 02:00 +0100
          Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-21 08:40 +0100
            Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-21 09:10 +0100
              Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-21 09:50 +0100
                Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-21 10:30 +0100
                Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Jan Kara <jack@suse.cz> - 2016-03-21 15:40 +0100
                Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-03-21 16:10 +0100
                Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Jan Kara <jack@suse.cz> - 2016-03-21 16:40 +0100
                Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-03-21 18:20 +0100
                Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-22 03:20 +0100
                Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-22 03:20 +0100
                Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-22 07:00 +0100
                Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Byungchul Park <byungchul.park@lge.com> - 2016-03-22 08:00 +0100
                Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-22 08:50 +0100
              Re: [RFC][PATCH v5 1/2] printk: Make printk() completely async Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-03-21 10:00 +0100
  [RFC][PATCH v5 2/2] printk: Make wake_up_klogd_work_func() async Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-03-20 15:20 +0100

csiph-web