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


Groups > linux.kernel > #1176592

Re: [PATCH v2 v4.2-rc1] printk: make extended printk support conditional on netconsole

From Petr Mladek <pmladek@suse.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 v4.2-rc1] printk: make extended printk support conditional on netconsole
Date 2015-07-03 16:10 +0200
Message-ID <pI9Pc-13T-13@gated-at.bofh.it> (permalink)
References (5 earlier) <pGJtM-7jc-13@gated-at.bofh.it> <pGJWN-86F-3@gated-at.bofh.it> <pGJWN-86F-1@gated-at.bofh.it> <pGQOC-1cM-5@gated-at.bofh.it> <pHPx7-538-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu 2015-07-02 12:21:41, Tejun Heo wrote:
> 6fe29354befe ("printk: implement support for extended console
> drivers") implemented extended printk support for extended netconsole.
> The code added was miniscule but it added static 8k buffer
> unconditionally unnecessarily bloating the kernel for cases where
> extended netconsole is not used.
> 
> This patch introduces CONFIG_PRINTK_CON_EXTENDED which is selected by
> CONFIG_NETCONSOLE.  If the config option is not set, extended printk
> support is compiled out along with the static buffer.
> 
> Verified 8k reduction in vmlinux bss when !CONFIG_NETCONSOLE.
> 
> v2: Added a warning for cases where CON_EXTENDED is requested while
>     CONFIG_PRINTK_CON_EXTENDED is disabled as suggested by Petr.
> 
> Cc: Petr Mladek <pmladek@suse.com>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Reported-and-suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>

Reviewed-by: Petr Mladek <pmladek@suse.cz>

There is still one small thing that might get improved, see below.
But it is not that important and might be solved later. I am sorry
for not noticing it last time.


> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index cf8c242..f719118 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -84,6 +84,10 @@ static struct lockdep_map console_lock_dep_map = {
>  };
>  #endif
>  
> +#ifdef CONFIG_PRINTK_CON_EXTENDED
> +
> +#define CONSOLE_EXT_LOG_BUF_LEN		CONSOLE_EXT_LOG_MAX
> +
>  /*
>   * Number of registered extended console drivers.
>   *
> @@ -96,6 +100,32 @@ static struct lockdep_map console_lock_dep_map = {
>   */
>  static int nr_ext_console_drivers;
>  
> +static void inc_nr_ext_console_drivers(void)
> +{
> +	nr_ext_console_drivers++;
> +}
> +
> +static void dec_nr_ext_console_drivers(void)
> +{
> +	nr_ext_console_drivers--;
> +}
> +
> +#else	/* CONFIG_PRINTK_CON_EXTENDED */
> +
> +#define CONSOLE_EXT_LOG_BUF_LEN		0
> +#define nr_ext_console_drivers		0
> +
> +static void inc_nr_ext_console_drivers(void)
> +{
> +	WARN_ONCE(true, "printk: CON_EXTENDED requested when !CONFIG_PRINTK_CON_EXTENDED\n");
> +}
> +
> +static void dec_nr_ext_console_drivers(void)
> +{
> +}
> +
> +#endif	/* CONFIG_PRINTK_CON_EXTENDED */
> +
>  /*
>   * Helper macros to handle lockdep when locking/unlocking console_sem. We use
>   * macros instead of functions so that _RET_IP_ contains useful information.
> @@ -2561,9 +2591,11 @@ void register_console(struct console *newcon)
>  		console_drivers->next = newcon;
>  	}
>  
> -	if (newcon->flags & CON_EXTENDED)
> -		if (!nr_ext_console_drivers++)
> +	if (newcon->flags & CON_EXTENDED) {
> +		if (!nr_ext_console_drivers)
>  			pr_info("printk: continuation disabled due to ext consoles, expect more fragments in /dev/kmsg\n");

I would move the check and the message into
inc_nr_ext_console_drivers() when CONFIG_PRINTK_CON_EXTENDED is
defined. It does not make sense if we do not increment the counter.

Best Regards,
Petr
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

Re: [PATCH 3/3] printk: implement support for extended console  drivers Tejun Heo <tj@kernel.org> - 2015-06-29 17:30 +0200
  Re: [PATCH 3/3] printk: implement support for extended console drivers Geert Uytterhoeven <geert@linux-m68k.org> - 2015-06-29 17:50 +0200
    Re: [PATCH 3/3] printk: implement support for extended console  drivers Tejun Heo <tj@kernel.org> - 2015-06-29 17:50 +0200
      [PATCH v4.2-rc1] printk: make extended printk support conditional on  netconsole Tejun Heo <tj@kernel.org> - 2015-06-30 01:40 +0200
        Re: [PATCH v2 v4.2-rc1] printk: make extended printk support  conditional on netconsole Petr Mladek <pmladek@suse.com> - 2015-07-03 16:10 +0200
          Re: [PATCH v2 v4.2-rc1] printk: make extended printk support  conditional on netconsole Tejun Heo <tj@kernel.org> - 2015-07-03 17:30 +0200
        [PATCH v3 v4.2-rc1] printk: make extended printk support conditional  on netconsole Tejun Heo <tj@kernel.org> - 2015-07-03 18:30 +0200

csiph-web