Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1173879 > unrolled thread
| Started by | Tejun Heo <tj@kernel.org> |
|---|---|
| First post | 2015-06-29 17:30 +0200 |
| Last post | 2015-07-03 18:30 +0200 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
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
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2015-06-29 17:30 +0200 |
| Subject | Re: [PATCH 3/3] printk: implement support for extended console drivers |
| Message-ID | <pGJaq-6Wg-9@gated-at.bofh.it> |
Hello,
On Mon, Jun 29, 2015 at 11:20:41AM +0200, Geert Uytterhoeven wrote:
> On Wed, Apr 29, 2015 at 4:45 PM, Tejun Heo <tj@kernel.org> wrote:
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
>
> > @@ -2196,6 +2227,7 @@ out:
> > */
> > void console_unlock(void)
> > {
> > + static char ext_text[CONSOLE_EXT_LOG_MAX];
>
> Can you please
> a) make this feature optional,
netconsole itself is optional & modular. I'm not sure making further
splits is called for, especially given the use cases.
> b) (de)allocate this buffer dynamically when the first/last console with
> CON_EXTENDED set is (un)registered?
But yeah, making the buffer allocated on demand should be simple
enough. Will get to it.
Thanks.
--
tejun
--
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/
[toc] | [next] | [standalone]
| From | Geert Uytterhoeven <geert@linux-m68k.org> |
|---|---|
| Date | 2015-06-29 17:50 +0200 |
| Subject | Re: [PATCH 3/3] printk: implement support for extended console drivers |
| Message-ID | <pGJtM-7jc-11@gated-at.bofh.it> |
| In reply to | #1173879 |
Hi Tejun,
On Mon, Jun 29, 2015 at 5:28 PM, Tejun Heo <tj@kernel.org> wrote:
> On Mon, Jun 29, 2015 at 11:20:41AM +0200, Geert Uytterhoeven wrote:
>> On Wed, Apr 29, 2015 at 4:45 PM, Tejun Heo <tj@kernel.org> wrote:
>> > --- a/kernel/printk/printk.c
>> > +++ b/kernel/printk/printk.c
>>
>> > @@ -2196,6 +2227,7 @@ out:
>> > */
>> > void console_unlock(void)
>> > {
>> > + static char ext_text[CONSOLE_EXT_LOG_MAX];
>>
>> Can you please
>> a) make this feature optional,
>
> netconsole itself is optional & modular. I'm not sure making further
> splits is called for, especially given the use cases.
It could be a hidden option, selected by its users (e.g. netconsole).
>> b) (de)allocate this buffer dynamically when the first/last console with
>> CON_EXTENDED set is (un)registered?
>
> But yeah, making the buffer allocated on demand should be simple
> enough. Will get to it.
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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/
[toc] | [prev] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2015-06-29 17:50 +0200 |
| Message-ID | <pGJtM-7jc-13@gated-at.bofh.it> |
| In reply to | #1173906 |
On Mon, Jun 29, 2015 at 05:47:49PM +0200, Geert Uytterhoeven wrote: > > netconsole itself is optional & modular. I'm not sure making further > > splits is called for, especially given the use cases. > > It could be a hidden option, selected by its users (e.g. netconsole). Hmmm... what do you mean? Thanks. -- tejun -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2015-06-30 01:40 +0200 |
| Subject | [PATCH v4.2-rc1] printk: make extended printk support conditional on netconsole |
| Message-ID | <pGQOC-1cM-5@gated-at.bofh.it> |
| In reply to | #1173907 |
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 <tj@kernel.org>
Reported-and-suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
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/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -195,6 +195,7 @@ config GENEVE
config NETCONSOLE
tristate "Network console logging support"
+ select PRINTK_CON_EXTENDED
---help---
If you want to log kernel messages over the network, enable this.
See <file:Documentation/networking/netconsole.txt> for details.
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1438,6 +1438,9 @@ config PRINTK
very difficult to diagnose system problems, saying N here is
strongly discouraged.
+config PRINTK_CON_EXTENDED
+ bool
+
config BUG
bool "BUG() support" if EXPERT
default y
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -84,6 +84,10 @@ static struct lockdep_map console_lock_d
};
#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,25 @@ static struct lockdep_map console_lock_d
*/
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) { }
+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.
@@ -2224,7 +2247,7 @@ out:
*/
void console_unlock(void)
{
- static char ext_text[CONSOLE_EXT_LOG_MAX];
+ static char ext_text[CONSOLE_EXT_LOG_BUF_LEN];
static char text[LOG_LINE_MAX + PREFIX_MAX];
static u64 seen_seq;
unsigned long flags;
@@ -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();
+ }
if (newcon->flags & CON_PRINTBUFFER) {
/*
@@ -2638,7 +2663,7 @@ int unregister_console(struct console *c
}
if (!res && (console->flags & CON_EXTENDED))
- nr_ext_console_drivers--;
+ dec_nr_ext_console_drivers();
/*
* If this isn't the last console and it has CON_CONSDEV set, we
--
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/
[toc] | [prev] | [next] | [standalone]
| From | Petr Mladek <pmladek@suse.com> |
|---|---|
| Date | 2015-07-03 16:10 +0200 |
| Subject | Re: [PATCH v2 v4.2-rc1] printk: make extended printk support conditional on netconsole |
| Message-ID | <pI9Pc-13T-13@gated-at.bofh.it> |
| In reply to | #1174142 |
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/
[toc] | [prev] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2015-07-03 17:30 +0200 |
| Subject | Re: [PATCH v2 v4.2-rc1] printk: make extended printk support conditional on netconsole |
| Message-ID | <pIb4C-1JT-7@gated-at.bofh.it> |
| In reply to | #1176592 |
On Fri, Jul 03, 2015 at 04:07:34PM +0200, Petr Mladek wrote:
> > @@ -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.
It doesn't make any difference as it gets compiled out anyway but yeah
moving it into the inc function makes more sense. Updating the patch.
Thanks.
--
tejun
--
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/
[toc] | [prev] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2015-07-03 18:30 +0200 |
| Subject | [PATCH v3 v4.2-rc1] printk: make extended printk support conditional on netconsole |
| Message-ID | <pIc0G-2mW-39@gated-at.bofh.it> |
| In reply to | #1174142 |
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.
v3: Moved ext console enable info messages into the inc function.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-and-suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
---
drivers/net/Kconfig | 1 +
init/Kconfig | 3 +++
kernel/printk/printk.c | 38 ++++++++++++++++++++++++++++++++++----
3 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 019fcef..39587f1 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -195,6 +195,7 @@ config GENEVE
config NETCONSOLE
tristate "Network console logging support"
+ select PRINTK_CON_EXTENDED
---help---
If you want to log kernel messages over the network, enable this.
See <file:Documentation/networking/netconsole.txt> for details.
diff --git a/init/Kconfig b/init/Kconfig
index bcc41bd..cd281ab 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1438,6 +1438,9 @@ config PRINTK
very difficult to diagnose system problems, saying N here is
strongly discouraged.
+config PRINTK_CON_EXTENDED
+ bool
+
config BUG
bool "BUG() support" if EXPERT
default y
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index cf8c242..841ea4d 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,33 @@ static struct lockdep_map console_lock_dep_map = {
*/
static int nr_ext_console_drivers;
+static void inc_nr_ext_console_drivers(void)
+{
+ if (!nr_ext_console_drivers++)
+ pr_info("printk: continuation disabled due to ext consoles, expect more fragments in /dev/kmsg\n");
+}
+
+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.
@@ -2224,7 +2255,7 @@ static void console_cont_flush(char *text, size_t size)
*/
void console_unlock(void)
{
- static char ext_text[CONSOLE_EXT_LOG_MAX];
+ static char ext_text[CONSOLE_EXT_LOG_BUF_LEN];
static char text[LOG_LINE_MAX + PREFIX_MAX];
static u64 seen_seq;
unsigned long flags;
@@ -2562,8 +2593,7 @@ void register_console(struct console *newcon)
}
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();
if (newcon->flags & CON_PRINTBUFFER) {
/*
@@ -2638,7 +2668,7 @@ int unregister_console(struct console *console)
}
if (!res && (console->flags & CON_EXTENDED))
- nr_ext_console_drivers--;
+ dec_nr_ext_console_drivers();
/*
* If this isn't the last console and it has CON_CONSDEV set, we
--
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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web