From mboxrd@z Thu Jan 1 00:00:00 1970 From: Petr Mladek Subject: Re: [PATCH v4.2-rc1] printk: make extended printk support conditional on netconsole Date: Wed, 1 Jul 2015 18:05:13 +0200 Message-ID: <20150701160513.GC8099@pathway.suse.cz> References: <1430318704-32374-1-git-send-email-tj@kernel.org> <1430318704-32374-4-git-send-email-tj@kernel.org> <20150629152805.GM15805@mtj.duckdns.org> <20150629154914.GQ15805@mtj.duckdns.org> <20150629161355.GS15805@mtj.duckdns.org> <20150629233140.GA7711@mtj.duckdns.org> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <20150629233140.GA7711@mtj.duckdns.org> Sender: netdev-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Tejun Heo Cc: Linus Torvalds , Andrew Morton , "David S. Miller" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , Kay Sievers , Josh Triplett , Linux Embedded , Geert Uytterhoeven On Mon 2015-06-29 19:31:40, 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. > > Signed-off-by: Tejun Heo > Reported-and-suggested-by: Geert Uytterhoeven > --- > Linus, Andrew. > > This removes an unnecessary 8k bss bloat introduced during v4.2-rc1 > merge window on certain configs. The original patch was routed > through -mm. How should this be routed? > > Thanks. > > drivers/net/Kconfig | 1 + > init/Kconfig | 3 +++ > kernel/printk/printk.c | 33 +++++++++++++++++++++++++++++---- > 3 files changed, 33 insertions(+), 4 deletions(-) [...] > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c [...] > @@ -2561,9 +2584,11 @@ void register_console(struct console *ne > 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"); > + inc_nr_ext_console_drivers(); We should handle also the situation when CON_EXTENDED is set and CONFIG_PRINTK_CON_EXTENDED is not set by mistake. Otherwise, we will not increment nr_ext_console_drivers here => ext_text will not be filled in console_unlock() => call_console_drivers() will print nothing for the CON_EXTENDED console. At least, I would print an error here. Something like. #ifndef CONFIG_PRINTK_CON_EXTENDED pr_err("The registered extended console will print nothing because the kernel is not compiled with PRINTK_CON_EXTENDED\n"); #endif I wonder if there is a good identification of the console that can be printed. Otherwise, it looks fine to me. Best Regards, Petr