public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Frans Pop <elendil@planet.nl>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Robin Getz <rgetz@blackfin.uclinux.org>
Cc: linux-kernel@vger.kernel.org, cryptsetup@packages.debian.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH,RFC,resend] printk: restore previous console_loglevel when re-enabling logging
Date: Fri, 10 Jul 2009 16:07:49 +0200	[thread overview]
Message-ID: <20090710140749.GD26264@elte.hu> (raw)
In-Reply-To: <200907061331.49930.elendil@planet.nl>


* Frans Pop <elendil@planet.nl> wrote:

> When logging to console is disabled from userspace using klogctl()
> and later re-enabled, console_loglevel gets set to the default
> log level instead to the previous value.
> This means that if the kernel was booted with 'quiet', the boot is
> suddenly no longer quiet after logging to console gets re-enabled.
> 
> Save the current console_loglevel when logging is disabled and
> restore to that value. If the log level is set to a specific value
> while disabled, this is interpreted as an implicit re-enabling of
> the logging.
> 
> Signed-off-by: Frans Pop <elendil@planet.nl>
> ---
> 
> Resend. The problem that prompted this patch is described in
> http://lkml.org/lkml/2009/6/28/234
> 
> There are two variations possible on the patch below.
> 
> 1) If klogctl(7) is called while logging is not disabled, then set level
>    to default (partially preserving current functionality):
>  	case 7:		/* Enable logging to console */
> -		console_loglevel = default_console_loglevel;
> +		if (saved_console_loglevel == -1)
> +			console_loglevel = default_console_loglevel;
> +		else {
> +			console_loglevel = saved_console_loglevel;
> +			saved_console_loglevel = -1;
> +		}
> 
> 2) If klogctl(8) is called while logging is disabled, then don't enable
>    logging, but remember the requested value for when logging does get
>    enabled again:
>  	case 8:		/* Set level of messages printed to console */
> [...]
> - 		console_loglevel = len;
> +		if (saved_console_loglevel == -1)
> +	 		console_loglevel = len;
> +		else
> +			saved_console_loglevel = len;
> 
> Yet another option would be to ignore the request.

Looks like a possible solution to a real problem (most distros today 
boot with quiet) - albeit it does change previous behavior so 
objections are possible on those grounds.

I've queued it up in the tip:core/printk tree and will push it out 
to linux-next in a few days if there are no objections.

Small sidenote: i moved the (somewhat obscurely placed) 
saved_console_loglevel static variable out of local variable scope 
and next to the console loglevel definitions (such as 
console_printk[]), to increase its visibility as globally relevant 
state and to move it next to the state this variable affects.

Thanks,

	Ingo

  reply	other threads:[~2009-07-10 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-06 11:31 [PATCH,RFC,resend] printk: restore previous console_loglevel when re-enabling logging Frans Pop
2009-07-10 14:07 ` Ingo Molnar [this message]
2009-07-10 14:21 ` [tip:core/printk] printk: Restore " tip-bot for Frans Pop

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=20090710140749.GD26264@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=cryptsetup@packages.debian.org \
    --cc=elendil@planet.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rgetz@blackfin.uclinux.org \
    --cc=torvalds@linux-foundation.org \
    /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