lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160323100420.GD5522@pathway.suse.cz>
Date:	Wed, 23 Mar 2016 11:04:20 +0100
From:	Petr Mladek <pmladek@...e.com>
To:	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc:	Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jan Kara <jack@...e.com>, Tejun Heo <tj@...nel.org>,
	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
	linux-kernel@...r.kernel.org,
	Byungchul Park <byungchul.park@....com>,
	Jan Kara <jack@...e.cz>
Subject: Re: [RFC][PATCH v6 1/2] printk: Make printk() completely async

On Wed 2016-03-23 09:37:25, Sergey Senozhatsky wrote:
> Hello Petr,
> 
> On (03/22/16 14:11), Petr Mladek wrote:
> > > +	 * Set printing_func() sleep condition early, under the @logbuf_lock.
> > > +	 * So printing kthread (if RUNNING) will go to console_lock() and spin
> > > +	 * on @logbuf_lock.
> > > +	 */
> > > +	if (!printk_sync)
> > > +		need_flush_console = true;
> > 
> > We set this variable for each call and also when printk_kthread is
> > NULL or when sync_printk is false.
> 
> hm, yes. (printk_kthread && !need_flush_console) makes more sense.
> so we it doesn't get re-dirty if already set.

This does not solve the problem mentioned below. There still might be
extra cycle if the kthread is inside console_unclock().

> > We migth want to clear it also from console_unlock(). I think that
> > a good place would be in the check:
> > 
> > 	raw_spin_lock(&logbuf_lock);
> > 	retry = console_seq != log_next_seq;
> > 	raw_spin_unlock_irqrestore(&logbuf_lock, flags);
> 
> hm, what's wrong with clearing it in printk_kthread  printing function?

I though about the following scenario:

CPU0					CPU1

vprintk_emit()
  need_flush_console = true;

  wake_up_process(printk_thread)

					printing_func()

					  need_flush_console = false;

					  console_lock()
					  console_unlock()

vprintk_emit()

  need_flush_console = true;

					    # flush 1st message
					    # flush 2nd message

					    if (!need_flush_console)
					      # fails and continues

					    console_lock()
					    console_unlock()

					    # nope because 2nd
					    # message already flushed

					  if (!need_flush_console)
					     schedule()

					     # did one unnecessary
					     # cycle to get asleep


Best Regards,
Petr

PS: If you touch the code, please rename printing_func() to
printk_kthread_func() to make it more clear what it does.
I am sorry for nitpicking.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ