2002-12-10 19:12:15

by Randy.Dunlap

[permalink] [raw]
Subject: move LOG_BUF_SIZE to header file


Hi,

I'd like to see LOG_BUF_LEN from kernel/printk.c moved to a header file
so that some non-kernel (kernel-mode) tools can know the value being
used (tools like kmsgdump or lkcd etc.).

This patch moves LOG_BUF_LEN to include/linux/kernel.h .
Or it could go to a separate (new) header file...

Comments?

Thanks,
--
~Randy



--- ./include/linux/kernel.h%LOGBUF Wed Nov 27 14:35:46 2002
+++ ./include/linux/kernel.h Fri Dec 6 15:50:06 2002
@@ -38,6 +38,17 @@
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */

+#if defined(CONFIG_X86_NUMAQ) || defined(CONFIG_IA64)
+#define LOG_BUF_LEN (65536)
+#elif defined(CONFIG_ARCH_S390)
+#define LOG_BUF_LEN (131072)
+#elif defined(CONFIG_SMP)
+#define LOG_BUF_LEN (32768)
+#else
+#define LOG_BUF_LEN (16384) /* This must be a power of two */
+#endif
+#define LOG_BUF_MASK (LOG_BUF_LEN-1)
+
struct completion;

#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
--- ./kernel/printk.c%LOGBUF Wed Nov 27 14:36:23 2002
+++ ./kernel/printk.c Fri Dec 6 15:34:31 2002
@@ -16,6 +16,7 @@
* 01Mar01 Andrew Morton <[email protected]>
*/

+#include <linux/config.h>
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
@@ -24,24 +25,12 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/interrupt.h> /* For in_interrupt() */
-#include <linux/config.h>
+#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/delay.h>

#include <asm/uaccess.h>

-#if defined(CONFIG_X86_NUMAQ) || defined(CONFIG_IA64)
-#define LOG_BUF_LEN (65536)
-#elif defined(CONFIG_ARCH_S390)
-#define LOG_BUF_LEN (131072)
-#elif defined(CONFIG_SMP)
-#define LOG_BUF_LEN (32768)
-#else
-#define LOG_BUF_LEN (16384) /* This must be a power of two */
-#endif
-
-#define LOG_BUF_MASK (LOG_BUF_LEN-1)
-
#ifndef arch_consoles_callable
#define arch_consoles_callable() (1)
#endif


2002-12-10 19:33:59

by Andrew Morton

[permalink] [raw]
Subject: Re: move LOG_BUF_SIZE to header file

"Randy.Dunlap" wrote:
>
> Hi,
>
> I'd like to see LOG_BUF_LEN from kernel/printk.c moved to a header file
> so that some non-kernel (kernel-mode) tools can know the value being
> used (tools like kmsgdump or lkcd etc.).
>
> This patch moves LOG_BUF_LEN to include/linux/kernel.h .
> Or it could go to a separate (new) header file...
>
> ...
> -#if defined(CONFIG_X86_NUMAQ) || defined(CONFIG_IA64)
> -#define LOG_BUF_LEN (65536)
> -#elif defined(CONFIG_ARCH_S390)
> -#define LOG_BUF_LEN (131072)
> -#elif defined(CONFIG_SMP)
> -#define LOG_BUF_LEN (32768)
> -#else
> -#define LOG_BUF_LEN (16384) /* This must be a power of two */
> -#endif
> -
> -#define LOG_BUF_MASK (LOG_BUF_LEN-1)

It's probably better to move all this gunk into the config
system. Then your app can use CONFIG_LOG_BUF_LEN, too.

2002-12-17 06:08:43

by Randy.Dunlap

[permalink] [raw]
Subject: [PATCH] move LOG_BUF_SIZE to header file

On Tue, 10 Dec 2002, Andrew Morton wrote:

| "Randy.Dunlap" wrote:
| >
| > I'd like to see LOG_BUF_LEN from kernel/printk.c moved to a header file
| > so that some non-kernel (kernel-mode) tools can know the value being
| > used (tools like kmsgdump or lkcd etc.).
| >
| > This patch moves LOG_BUF_LEN to include/linux/kernel.h .
| > Or it could go to a separate (new) header file...
| >
| > ...
| > -#if defined(CONFIG_X86_NUMAQ) || defined(CONFIG_IA64)
| > -#define LOG_BUF_LEN (65536)
| > -#elif defined(CONFIG_ARCH_S390)
| > -#define LOG_BUF_LEN (131072)
| > -#elif defined(CONFIG_SMP)
| > -#define LOG_BUF_LEN (32768)
| > -#else
| > -#define LOG_BUF_LEN (16384) /* This must be a power of two */
| > -#endif
| > -
| > -#define LOG_BUF_MASK (LOG_BUF_LEN-1)
|
| It's probably better to move all this gunk into the config
| system. Then your app can use CONFIG_LOG_BUF_LEN, too.

Hi, [after some delay]

I did think of that and agree that it makes some sense.
I don't really mind how it's done, so if that will help move along
the change, I'm for it.

I want to thank Roman Zippel for helping me thru this and with
enabling Kconfig with code to support this (that was already
in progress). This patch requires Kconfig changes in 2.5.52.

Here's what I have, tested with
make ARCH=<all 20 of them in succession> menuconfig
This puts the 'Kernel log buffer size' under Kernel hacking.
General Setup was too early for it since this needs processor
type/SMP info.

One other thing that I considered doing was using a common
Kconfig file for all 20 arch'es by adding a
source "kernel/Kconfig"
at the end of each <arch>/Kconfig file. This would provide
a common "General setup (more)" that could be used after most
config options are set instead of near the top of the menu.
Does that make sense to anybody?

More comments, feedback?

Thanks,
~Randy


patch_name: logbuf-2552b.patch
patch_version: 2002.12.16
author: Randy Dunlap <[email protected]>
description: change LOG_BUF_SIZE to a config option
product: linux
product_versions: 2.5.52
changelog:
URL:
requires: kconfig in 2.5.52
conflicts:
diffstat:
arch/alpha/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/arm/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/cris/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/i386/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/ia64/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/m68k/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/m68knommu/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/mips/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/mips64/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/parisc/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/ppc/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/ppc64/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/s390/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/s390x/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/sh/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/sparc/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/sparc64/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/um/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/v850/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
arch/x86_64/Kconfig | 37 +++++++++++++++++++++++++++++++++++++
kernel/printk.c | 34 ++++++++++++----------------------
21 files changed, 752 insertions(+), 22 deletions(-)

--- ./arch/i386/Kconfig%LOGBUF Sun Dec 15 18:07:47 2002
+++ ./arch/i386/Kconfig Sun Dec 15 20:45:09 2002
@@ -1573,6 +1573,43 @@
If you don't debug the kernel, you can say N, but we may not be able
to solve problems without frame pointers.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
config X86_EXTRA_IRQS
bool
depends on X86_LOCAL_APIC
--- ./kernel/printk.c%LOGBUF Sun Dec 15 18:08:24 2002
+++ ./kernel/printk.c Sun Dec 15 20:49:49 2002
@@ -30,17 +30,7 @@

#include <asm/uaccess.h>

-#if defined(CONFIG_X86_NUMAQ) || defined(CONFIG_IA64)
-#define LOG_BUF_LEN (65536)
-#elif defined(CONFIG_ARCH_S390)
-#define LOG_BUF_LEN (131072)
-#elif defined(CONFIG_SMP)
-#define LOG_BUF_LEN (32768)
-#else
-#define LOG_BUF_LEN (16384) /* This must be a power of two */
-#endif
-
-#define LOG_BUF_MASK (LOG_BUF_LEN-1)
+#define LOG_BUF_MASK (CONFIG_LOG_BUF_LEN-1)

#ifndef arch_consoles_callable
#define arch_consoles_callable() (1)
@@ -79,11 +69,11 @@
*/
static spinlock_t logbuf_lock = SPIN_LOCK_UNLOCKED;

-static char log_buf[LOG_BUF_LEN];
+static char log_buf[CONFIG_LOG_BUF_LEN];
#define LOG_BUF(idx) (log_buf[(idx) & LOG_BUF_MASK])

/*
- * The indices into log_buf are not constrained to LOG_BUF_LEN - they
+ * The indices into log_buf are not constrained to CONFIG_LOG_BUF_LEN - they
* must be masked before subscripting
*/
static unsigned long log_start; /* Index into log_buf: next char to be read by syslog() */
@@ -219,8 +209,8 @@
if (error)
goto out;
count = len;
- if (count > LOG_BUF_LEN)
- count = LOG_BUF_LEN;
+ if (count > CONFIG_LOG_BUF_LEN)
+ count = CONFIG_LOG_BUF_LEN;
spin_lock_irq(&logbuf_lock);
if (count > logged_chars)
count = logged_chars;
@@ -235,7 +225,7 @@
*/
for(i=0;i < count;i++) {
j = limit-1-i;
- if (j+LOG_BUF_LEN < log_end)
+ if (j+CONFIG_LOG_BUF_LEN < log_end)
break;
c = LOG_BUF(j);
spin_unlock_irq(&logbuf_lock);
@@ -321,7 +311,7 @@
if (msg_log_level < console_loglevel && console_drivers && start != end) {
if ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) {
/* wrapped write */
- __call_console_drivers(start & LOG_BUF_MASK, LOG_BUF_LEN);
+ __call_console_drivers(start & LOG_BUF_MASK, CONFIG_LOG_BUF_LEN);
__call_console_drivers(0, end & LOG_BUF_MASK);
} else {
__call_console_drivers(start, end);
@@ -384,11 +374,11 @@
{
LOG_BUF(log_end) = c;
log_end++;
- if (log_end - log_start > LOG_BUF_LEN)
- log_start = log_end - LOG_BUF_LEN;
- if (log_end - con_start > LOG_BUF_LEN)
- con_start = log_end - LOG_BUF_LEN;
- if (logged_chars < LOG_BUF_LEN)
+ if (log_end - log_start > CONFIG_LOG_BUF_LEN)
+ log_start = log_end - CONFIG_LOG_BUF_LEN;
+ if (log_end - con_start > CONFIG_LOG_BUF_LEN)
+ con_start = log_end - CONFIG_LOG_BUF_LEN;
+ if (logged_chars < CONFIG_LOG_BUF_LEN)
logged_chars++;
}

--- ./arch/m68k/Kconfig%LOGBUF Sun Dec 15 18:08:11 2002
+++ ./arch/m68k/Kconfig Mon Dec 16 21:07:31 2002
@@ -2338,6 +2338,43 @@
bool "Verbose BUG() reporting"
depends on DEBUG_KERNEL

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/sparc/Kconfig%LOGBUF Sun Dec 15 18:07:42 2002
+++ ./arch/sparc/Kconfig Mon Dec 16 21:17:40 2002
@@ -1414,6 +1414,43 @@
If you say Y here, various routines which may sleep will become very
noisy if they are called with a spinlock held.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/sparc64/Kconfig%LOGBUF Sun Dec 15 18:08:16 2002
+++ ./arch/sparc64/Kconfig Mon Dec 16 21:18:14 2002
@@ -1702,6 +1702,43 @@
depends on STACK_DEBUG
default y

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/ppc/Kconfig%LOGBUF Sun Dec 15 18:08:23 2002
+++ ./arch/ppc/Kconfig Mon Dec 16 21:10:24 2002
@@ -1866,6 +1866,43 @@
bool "Support for early boot texts over serial port"
depends on 4xx || GT64260 || LOPEC || MCPN765 || PPLUS || PRPMC800 || SANDPOINT || ZX4500

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/m68knommu/Kconfig%LOGBUF Sun Dec 15 18:08:13 2002
+++ ./arch/m68knommu/Kconfig Mon Dec 16 21:07:56 2002
@@ -751,6 +751,43 @@
help
Disable the CPU's BDM signals.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/alpha/Kconfig%LOGBUF Sun Dec 15 18:08:14 2002
+++ ./arch/alpha/Kconfig Mon Dec 16 21:00:23 2002
@@ -1022,6 +1022,43 @@
verbose debugging messages. If you suspect a semaphore problem or a
kernel hacker asks for this option then say Y. Otherwise say N.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/cris/Kconfig%LOGBUF Sun Dec 15 18:08:19 2002
+++ ./arch/cris/Kconfig Mon Dec 16 21:06:09 2002
@@ -751,6 +751,43 @@
depends on PROFILE
default "2"

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/mips/Kconfig%LOGBUF Sun Dec 15 18:07:56 2002
+++ ./arch/mips/Kconfig Mon Dec 16 21:08:44 2002
@@ -1276,6 +1276,43 @@
depends on SMP
default "32"

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/x86_64/Kconfig%LOGBUF Sun Dec 15 18:08:14 2002
+++ ./arch/x86_64/Kconfig Mon Dec 16 21:20:19 2002
@@ -692,6 +692,43 @@
symbolic stack backtraces. This increases the size of the kernel
somewhat, as all symbols have to be loaded into the kernel image.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/ppc64/Kconfig%LOGBUF Sun Dec 15 18:08:09 2002
+++ ./arch/ppc64/Kconfig Mon Dec 16 21:10:33 2002
@@ -551,6 +551,43 @@
bool "Include PPCDBG realtime debugging"
depends on DEBUG_KERNEL

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/um/Kconfig%LOGBUF Sun Dec 15 18:07:57 2002
+++ ./arch/um/Kconfig Mon Dec 16 21:18:35 2002
@@ -169,5 +169,42 @@
bool "Enable gcov support"
depends on DEBUGSYM

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

--- ./arch/arm/Kconfig%LOGBUF Sun Dec 15 18:08:09 2002
+++ ./arch/arm/Kconfig Mon Dec 16 21:05:34 2002
@@ -1220,6 +1220,43 @@
output to the second serial port on these devices. Saying N will
cause the debug messages to appear on the first serial port.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/parisc/Kconfig%LOGBUF Sun Dec 15 18:08:11 2002
+++ ./arch/parisc/Kconfig Mon Dec 16 21:09:21 2002
@@ -415,6 +415,43 @@
symbolic stack backtraces. This increases the size of the kernel
somewhat, as all symbols have to be loaded into the kernel image.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/ia64/Kconfig%LOGBUF Sun Dec 15 18:08:21 2002
+++ ./arch/ia64/Kconfig Mon Dec 16 21:07:20 2002
@@ -886,6 +886,43 @@
and restore instructions. It's useful for tracking down spinlock
problems, but slow! If you're unsure, select N.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/mips64/Kconfig%LOGBUF Sun Dec 15 18:07:52 2002
+++ ./arch/mips64/Kconfig Mon Dec 16 21:09:00 2002
@@ -719,6 +719,43 @@
depends on SMP
default "64"

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/s390x/Kconfig%LOGBUF Sun Dec 15 18:07:59 2002
+++ ./arch/s390x/Kconfig Mon Dec 16 21:10:59 2002
@@ -338,6 +338,43 @@
If you say Y here, various routines which may sleep will become very
noisy if they are called with a spinlock held.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/v850/Kconfig%LOGBUF Sun Dec 15 18:07:56 2002
+++ ./arch/v850/Kconfig Mon Dec 16 21:19:06 2002
@@ -444,6 +444,43 @@
help
Disable the CPU's BDM signals.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/sh/Kconfig%LOGBUF Sun Dec 15 18:08:23 2002
+++ ./arch/sh/Kconfig Mon Dec 16 21:17:31 2002
@@ -1268,6 +1268,43 @@
when the kernel may crash or hang before the serial console is
initialised. If unsure, say N.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"
--- ./arch/s390/Kconfig%LOGBUF Sun Dec 15 18:07:54 2002
+++ ./arch/s390/Kconfig Mon Dec 16 21:10:49 2002
@@ -329,6 +329,43 @@
If you say Y here, various routines which may sleep will become very
noisy if they are called with a spinlock held.

+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_128KB if ARCH_S390
+ default LOG_BUF_64KB if X86_NUMAQ || IA64
+ default LOG_BUF_32KB if SMP
+ default LOG_BUF_16KB
+ help
+ Select kernel log buffer size from this list.
+ Defaults: 16 KB for uniprocessor
+ 32 KB for SMP
+ 64 KB for x86 NUMAQ or IA-64
+ 128 KB for S/390
+
+config LOG_BUF_128KB
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_64KB
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_32KB
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_16KB
+ bool "16 KB"
+
+endchoice
+
+config LOG_BUF_LEN
+ int
+ default 131072 if LOG_BUF_128KB
+ default 65536 if LOG_BUF_64KB
+ default 32768 if LOG_BUF_32KB
+ default 16384 if LOG_BUF_16KB
+
endmenu

source "security/Kconfig"

2002-12-17 06:33:06

by James Cloos

[permalink] [raw]
Subject: Re: [PATCH] move LOG_BUF_SIZE to header file

I was just looking at doing that.

I'd suggest including CONFIG_CRYPTO_TEST in the default size
determination, and allowing both smaller sizes (for low ram
applications, such as embedded systems) and larger ones.

With all of the crypto =y, the test wipes everything before ACPI out
of the buffer before syslogd gets to start and log the buffer to disk.
Even with a 64k buffer.

-JimC

2002-12-17 09:33:58

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] move LOG_BUF_SIZE to header file

On Mon, Dec 16, 2002 at 10:11:42PM -0800, Randy.Dunlap wrote:
> --- ./arch/i386/Kconfig%LOGBUF Sun Dec 15 18:07:47 2002
> +++ ./arch/i386/Kconfig Sun Dec 15 20:45:09 2002
> @@ -1573,6 +1573,43 @@
> If you don't debug the kernel, you can say N, but we may not be able
> to solve problems without frame pointers.
>
> +choice
> + prompt "Kernel log buffer size"
> + default LOG_BUF_128KB if ARCH_S390
> + default LOG_BUF_64KB if X86_NUMAQ || IA64
> + default LOG_BUF_32KB if SMP
> + default LOG_BUF_16KB

yuck. Why don't you just add and integer LOG_BUG_SHIFT symbol that can
be freely choosen?

2002-12-17 17:11:05

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [PATCH] move LOG_BUF_SIZE to header file

On Tue, 17 Dec 2002, Christoph Hellwig wrote:

| On Mon, Dec 16, 2002 at 10:11:42PM -0800, Randy.Dunlap wrote:
| > --- ./arch/i386/Kconfig%LOGBUF Sun Dec 15 18:07:47 2002
| > +++ ./arch/i386/Kconfig Sun Dec 15 20:45:09 2002
| > @@ -1573,6 +1573,43 @@
| > If you don't debug the kernel, you can say N, but we may not be able
| > to solve problems without frame pointers.
| >
| > +choice
| > + prompt "Kernel log buffer size"
| > + default LOG_BUF_128KB if ARCH_S390
| > + default LOG_BUF_64KB if X86_NUMAQ || IA64
| > + default LOG_BUF_32KB if SMP
| > + default LOG_BUF_16KB
|
| yuck. Why don't you just add and integer LOG_BUG_SHIFT symbol that can
| be freely choosen?

I'll think about that, see how it works out.
LOG_BUF_SHIFT seems reasonable (for developers, not for users), but I
think that there should be some decent defaults also.

--
~Randy

2002-12-17 17:19:40

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [PATCH] move LOG_BUF_SIZE to header file

On 17 Dec 2002, James H. Cloos Jr. wrote:

| I was just looking at doing that.

Did you have any ideas for a better solution?

| I'd suggest including CONFIG_CRYPTO_TEST in the default size
| determination, and allowing both smaller sizes (for low ram
| applications, such as embedded systems) and larger ones.

and I'd agree with the latter half of this, but I think that if
one <quote> Quick & dirty crypto test module </quote> causes a
log buffer overrun, the general kernel config doesn't need to provide
a solution for it.

| With all of the crypto =y, the test wipes everything before ACPI out
| of the buffer before syslogd gets to start and log the buffer to disk.
| Even with a 64k buffer.

Use a larger buffer or reduce the output?

--
~Randy

2002-12-17 17:20:06

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] move LOG_BUF_SIZE to header file

"Randy.Dunlap" wrote:
>
> ...
> One other thing that I considered doing was using a common
> Kconfig file for all 20 arch'es by adding a
> source "kernel/Kconfig"
> at the end of each <arch>/Kconfig file. This would provide
> a common "General setup (more)" that could be used after most
> config options are set instead of near the top of the menu.
> Does that make sense to anybody?
>

I think so. There are times when one wants to add arch-neutral
config items which just don't logically fit into any of the
existing menus. The right place to put the item is into each
and every architecture's arch/<arch>/Kconfig, and that's plain
silly.

2002-12-17 22:30:55

by Randy.Dunlap

[permalink] [raw]
Subject: [PATCH] (v3) move LOG_BUF_SIZE to header/config


Changes from yesterday:

a. use a shift value (suggested by HCH); probably still not as quite
as free and open as he suggested, but I had user-friendliness
problems with that.

b. allow a wider range of values (HCH and James Cloos):
smaller added, larger can be added as needed.

c. put common config into kernel/Kconfig and include that in each
arch/*/Kconfig


More comments?

--
~Randy



patch_name: logbuf-config-2552.patch
patch_version: 2002.12.17
author: Randy Dunlap <[email protected]>
description: change LOG_BUF_SIZE to a config option (LOG_BUF_SHIFT)
product: linux
product_versions: 2.5.52
changelog: (a) move to a common kernel/Kconfig;
(b) use a SHIFT value (enforces power of 2, gives more choices)
URL:
requires: kconfig in 2.5.52
conflicts:
diffstat:
arch/alpha/Kconfig | 2 +
arch/arm/Kconfig | 2 +
arch/cris/Kconfig | 2 +
arch/ia64/Kconfig | 3 ++
arch/m68k/Kconfig | 2 +
arch/m68knommu/Kconfig | 2 +
arch/mips/Kconfig | 2 +
arch/mips64/Kconfig | 2 +
arch/parisc/Kconfig | 2 +
arch/ppc/Kconfig | 2 +
arch/ppc64/Kconfig | 2 +
arch/s390/Kconfig | 2 +
arch/s390x/Kconfig | 2 +
arch/sh/Kconfig | 2 +
arch/sparc/Kconfig | 2 +
arch/sparc64/Kconfig | 2 +
arch/um/Kconfig | 2 +
arch/v850/Kconfig | 2 +
arch/x86_64/Kconfig | 2 +
kernel/Kconfig | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
kernel/printk.c | 11 ---------
21 files changed, 95 insertions(+), 10 deletions(-)


--- ./arch/m68k/Kconfig%LOGBUF Sun Dec 15 18:08:11 2002
+++ ./arch/m68k/Kconfig Tue Dec 17 14:08:33 2002
@@ -2346,3 +2346,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/sparc/Kconfig%LOGBUF Sun Dec 15 18:07:42 2002
+++ ./arch/sparc/Kconfig Tue Dec 17 14:11:06 2002
@@ -1422,3 +1422,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/sparc64/Kconfig%LOGBUF Sun Dec 15 18:08:16 2002
+++ ./arch/sparc64/Kconfig Tue Dec 17 14:11:13 2002
@@ -1710,3 +1710,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/ppc/Kconfig%LOGBUF Sun Dec 15 18:08:23 2002
+++ ./arch/ppc/Kconfig Tue Dec 17 14:10:18 2002
@@ -1872,3 +1872,5 @@

source "crypto/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/m68knommu/Kconfig%LOGBUF Sun Dec 15 18:08:13 2002
+++ ./arch/m68knommu/Kconfig Tue Dec 17 14:08:52 2002
@@ -759,3 +759,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/alpha/Kconfig%LOGBUF Sun Dec 15 18:08:14 2002
+++ ./arch/alpha/Kconfig Tue Dec 17 14:07:34 2002
@@ -1030,3 +1030,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/cris/Kconfig%LOGBUF Sun Dec 15 18:08:19 2002
+++ ./arch/cris/Kconfig Tue Dec 17 14:08:06 2002
@@ -759,3 +759,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/mips/Kconfig%LOGBUF Sun Dec 15 18:07:56 2002
+++ ./arch/mips/Kconfig Tue Dec 17 14:08:59 2002
@@ -1284,3 +1284,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/x86_64/Kconfig%LOGBUF Sun Dec 15 18:08:14 2002
+++ ./arch/x86_64/Kconfig Tue Dec 17 14:11:54 2002
@@ -700,3 +700,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/ppc64/Kconfig%LOGBUF Sun Dec 15 18:08:09 2002
+++ ./arch/ppc64/Kconfig Tue Dec 17 14:10:25 2002
@@ -559,3 +559,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/um/Kconfig%LOGBUF Sun Dec 15 18:07:57 2002
+++ ./arch/um/Kconfig Tue Dec 17 14:11:35 2002
@@ -171,3 +171,5 @@

endmenu

+source "kernel/Kconfig"
+
--- ./arch/arm/Kconfig%LOGBUF Sun Dec 15 18:08:09 2002
+++ ./arch/arm/Kconfig Tue Dec 17 14:07:56 2002
@@ -1228,3 +1228,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/parisc/Kconfig%LOGBUF Sun Dec 15 18:08:11 2002
+++ ./arch/parisc/Kconfig Tue Dec 17 14:10:11 2002
@@ -423,3 +423,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/ia64/Kconfig%LOGBUF Sun Dec 15 18:08:21 2002
+++ ./arch/ia64/Kconfig Tue Dec 17 14:08:24 2002
@@ -891,3 +891,6 @@
source "security/Kconfig"

source "crypto/Kconfig"
+
+source "kernel/Kconfig"
+
--- ./arch/mips64/Kconfig%LOGBUF Sun Dec 15 18:07:52 2002
+++ ./arch/mips64/Kconfig Tue Dec 17 14:09:07 2002
@@ -727,3 +727,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/s390x/Kconfig%LOGBUF Sun Dec 15 18:07:59 2002
+++ ./arch/s390x/Kconfig Tue Dec 17 14:10:41 2002
@@ -346,3 +346,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/v850/Kconfig%LOGBUF Sun Dec 15 18:07:56 2002
+++ ./arch/v850/Kconfig Tue Dec 17 14:11:46 2002
@@ -452,4 +452,6 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
#############################################################################
--- ./arch/sh/Kconfig%LOGBUF Sun Dec 15 18:08:23 2002
+++ ./arch/sh/Kconfig Tue Dec 17 14:10:52 2002
@@ -1276,3 +1276,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/s390/Kconfig%LOGBUF Sun Dec 15 18:07:54 2002
+++ ./arch/s390/Kconfig Tue Dec 17 14:10:33 2002
@@ -337,3 +337,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./kernel/Kconfig%LOGBUF Tue Dec 17 14:00:31 2002
+++ ./kernel/Kconfig Tue Dec 17 14:16:36 2002
@@ -0,0 +1,55 @@
+# This general setup config file is read _after_ all other config files.
+# It is for generic kernel options that cannot be handled elsewhere,
+# including some generic options that are processor-dependent.
+# This is also _not_ for device driver options.
+# They should be handled in their driver subsystem areas.
+
+menu "Common kernel setup (more)"
+
+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_SHIFT_17 if ARCH_S390
+ default LOG_BUF_SHIFT_16 if X86_NUMAQ || IA64
+ default LOG_BUF_SHIFT_15 if SMP
+ default LOG_BUF_SHIFT_14
+ help
+ Select kernel log buffer size from this list (power of 2).
+ Defaults: 17 (=> 128 KB for S/390)
+ 16 (=> 64 KB for x86 NUMAQ or IA-64)
+ 15 (=> 32 KB for SMP)
+ 14 (=> 16 KB for uniprocessor)
+
+config LOG_BUF_SHIFT_17
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_SHIFT_16
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_SHIFT_15
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_SHIFT_14
+ bool "16 KB"
+
+config LOG_BUF_SHIFT_13
+ bool "8 KB"
+
+config LOG_BUF_SHIFT_12
+ bool "4 KB"
+
+endchoice
+
+config LOG_BUF_SHIFT
+ int
+ default 17 if LOG_BUF_SHIFT_17=y
+ default 16 if LOG_BUF_SHIFT_16=y
+ default 15 if LOG_BUF_SHIFT_15=y
+ default 14 if LOG_BUF_SHIFT_14=y
+ default 13 if LOG_BUF_SHIFT_13=y
+ default 12 if LOG_BUF_SHIFT_12=y
+
+endmenu
+
--- ./kernel/printk.c%LOGBUF Sun Dec 15 18:08:24 2002
+++ ./kernel/printk.c Tue Dec 17 14:01:50 2002
@@ -30,16 +30,7 @@

#include <asm/uaccess.h>

-#if defined(CONFIG_X86_NUMAQ) || defined(CONFIG_IA64)
-#define LOG_BUF_LEN (65536)
-#elif defined(CONFIG_ARCH_S390)
-#define LOG_BUF_LEN (131072)
-#elif defined(CONFIG_SMP)
-#define LOG_BUF_LEN (32768)
-#else
-#define LOG_BUF_LEN (16384) /* This must be a power of two */
-#endif
-
+#define LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
#define LOG_BUF_MASK (LOG_BUF_LEN-1)

#ifndef arch_consoles_callable

2002-12-18 01:06:44

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] (v3) move LOG_BUF_SIZE to header/config

"Randy.Dunlap" wrote:
>
> Changes from yesterday:
>
> a. use a shift value (suggested by HCH); probably still not as quite
> as free and open as he suggested, but I had user-friendliness
> problems with that.
>
> b. allow a wider range of values (HCH and James Cloos):
> smaller added, larger can be added as needed.
>
> c. put common config into kernel/Kconfig and include that in each
> arch/*/Kconfig
>
> More comments?
>

Well I like it. You were missing the arch/ia32/Kconfig include btw...

2002-12-18 04:00:19

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [PATCH] (v3) move LOG_BUF_SIZE to header/config

On Tue, 17 Dec 2002, Andrew Morton wrote:

| "Randy.Dunlap" wrote:
| >
| > Changes from yesterday:
| >
| > a. use a shift value (suggested by HCH); probably still not as quite
| > as free and open as he suggested, but I had user-friendliness
| > problems with that.
| >
| > b. allow a wider range of values (HCH and James Cloos):
| > smaller added, larger can be added as needed.
| >
| > c. put common config into kernel/Kconfig and include that in each
| > arch/*/Kconfig
| >
| > More comments?
| >
|
| Well I like it. You were missing the arch/ia32/Kconfig include btw...

Ack, I've corrected that (added arch/i386/Kconfig).
Entire patch is below.

Thanks,
--
~Randy



patch_name: logbuf-configs-2552b.patch
patch_version: 2002.12.17
author: Randy Dunlap <[email protected]>
description: change LOG_BUF_SIZE to a config option (LOG_BUF_SHIFT)
product: linux
product_versions: 2.5.52
changelog: (a) move to a common kernel/Kconfig;
(b) use a SHIFT value (enforces power of 2, gives more choices)
URL:
requires: kconfig in 2.5.52
conflicts:
diffstat:
arch/alpha/Kconfig | 2 +
arch/arm/Kconfig | 2 +
arch/cris/Kconfig | 2 +
arch/i386/Kconfig | 2 +
arch/ia64/Kconfig | 3 ++
arch/m68k/Kconfig | 2 +
arch/m68knommu/Kconfig | 2 +
arch/mips/Kconfig | 2 +
arch/mips64/Kconfig | 2 +
arch/parisc/Kconfig | 2 +
arch/ppc/Kconfig | 2 +
arch/ppc64/Kconfig | 2 +
arch/s390/Kconfig | 2 +
arch/s390x/Kconfig | 2 +
arch/sh/Kconfig | 2 +
arch/sparc/Kconfig | 2 +
arch/sparc64/Kconfig | 2 +
arch/um/Kconfig | 2 +
arch/v850/Kconfig | 2 +
arch/x86_64/Kconfig | 2 +
kernel/Kconfig | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
kernel/printk.c | 11 ---------
22 files changed, 97 insertions(+), 10 deletions(-)


--- ./arch/m68k/Kconfig%LOGBUF Sun Dec 15 18:08:11 2002
+++ ./arch/m68k/Kconfig Tue Dec 17 14:08:33 2002
@@ -2346,3 +2346,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/sparc/Kconfig%LOGBUF Sun Dec 15 18:07:42 2002
+++ ./arch/sparc/Kconfig Tue Dec 17 14:11:06 2002
@@ -1422,3 +1422,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/sparc64/Kconfig%LOGBUF Sun Dec 15 18:08:16 2002
+++ ./arch/sparc64/Kconfig Tue Dec 17 14:11:13 2002
@@ -1710,3 +1710,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/i386/Kconfig%LOGBUF Sun Dec 15 18:07:47 2002
+++ ./arch/i386/Kconfig Tue Dec 17 11:38:46 2002
@@ -1610,3 +1610,5 @@
bool
default y

+source "kernel/Kconfig"
+
--- ./arch/ppc/Kconfig%LOGBUF Sun Dec 15 18:08:23 2002
+++ ./arch/ppc/Kconfig Tue Dec 17 14:10:18 2002
@@ -1872,3 +1872,5 @@

source "crypto/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/m68knommu/Kconfig%LOGBUF Sun Dec 15 18:08:13 2002
+++ ./arch/m68knommu/Kconfig Tue Dec 17 14:08:52 2002
@@ -759,3 +759,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/alpha/Kconfig%LOGBUF Sun Dec 15 18:08:14 2002
+++ ./arch/alpha/Kconfig Tue Dec 17 14:07:34 2002
@@ -1030,3 +1030,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/cris/Kconfig%LOGBUF Sun Dec 15 18:08:19 2002
+++ ./arch/cris/Kconfig Tue Dec 17 14:08:06 2002
@@ -759,3 +759,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/mips/Kconfig%LOGBUF Sun Dec 15 18:07:56 2002
+++ ./arch/mips/Kconfig Tue Dec 17 14:08:59 2002
@@ -1284,3 +1284,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/x86_64/Kconfig%LOGBUF Sun Dec 15 18:08:14 2002
+++ ./arch/x86_64/Kconfig Tue Dec 17 14:11:54 2002
@@ -700,3 +700,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/ppc64/Kconfig%LOGBUF Sun Dec 15 18:08:09 2002
+++ ./arch/ppc64/Kconfig Tue Dec 17 14:10:25 2002
@@ -559,3 +559,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/um/Kconfig%LOGBUF Sun Dec 15 18:07:57 2002
+++ ./arch/um/Kconfig Tue Dec 17 14:11:35 2002
@@ -171,3 +171,5 @@

endmenu

+source "kernel/Kconfig"
+
--- ./arch/arm/Kconfig%LOGBUF Sun Dec 15 18:08:09 2002
+++ ./arch/arm/Kconfig Tue Dec 17 14:07:56 2002
@@ -1228,3 +1228,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/parisc/Kconfig%LOGBUF Sun Dec 15 18:08:11 2002
+++ ./arch/parisc/Kconfig Tue Dec 17 14:10:11 2002
@@ -423,3 +423,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/ia64/Kconfig%LOGBUF Sun Dec 15 18:08:21 2002
+++ ./arch/ia64/Kconfig Tue Dec 17 14:08:24 2002
@@ -891,3 +891,6 @@
source "security/Kconfig"

source "crypto/Kconfig"
+
+source "kernel/Kconfig"
+
--- ./arch/mips64/Kconfig%LOGBUF Sun Dec 15 18:07:52 2002
+++ ./arch/mips64/Kconfig Tue Dec 17 14:09:07 2002
@@ -727,3 +727,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/s390x/Kconfig%LOGBUF Sun Dec 15 18:07:59 2002
+++ ./arch/s390x/Kconfig Tue Dec 17 14:10:41 2002
@@ -346,3 +346,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/v850/Kconfig%LOGBUF Sun Dec 15 18:07:56 2002
+++ ./arch/v850/Kconfig Tue Dec 17 14:11:46 2002
@@ -452,4 +452,6 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
#############################################################################
--- ./arch/sh/Kconfig%LOGBUF Sun Dec 15 18:08:23 2002
+++ ./arch/sh/Kconfig Tue Dec 17 14:10:52 2002
@@ -1276,3 +1276,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./arch/s390/Kconfig%LOGBUF Sun Dec 15 18:07:54 2002
+++ ./arch/s390/Kconfig Tue Dec 17 14:10:33 2002
@@ -337,3 +337,5 @@

source "lib/Kconfig"

+source "kernel/Kconfig"
+
--- ./kernel/Kconfig%LOGBUF Tue Dec 17 14:00:31 2002
+++ ./kernel/Kconfig Tue Dec 17 14:28:52 2002
@@ -0,0 +1,55 @@
+# This general setup config file is read _after_ all other config files.
+# It is for generic kernel options that cannot be handled elsewhere,
+# including some generic options that are processor-dependent.
+# This is also _not_ for device driver options.
+# They should be handled in their driver subsystem areas.
+
+menu "Common kernel setup (more)"
+
+choice
+ prompt "Kernel log buffer size"
+ default LOG_BUF_SHIFT_17 if ARCH_S390
+ default LOG_BUF_SHIFT_16 if X86_NUMAQ || IA64
+ default LOG_BUF_SHIFT_15 if SMP
+ default LOG_BUF_SHIFT_14
+ help
+ Select kernel log buffer size from this list (power of 2).
+ Defaults: 17 (=> 128 KB for S/390)
+ 16 (=> 64 KB for x86 NUMAQ or IA-64)
+ 15 (=> 32 KB for SMP)
+ 14 (=> 16 KB for uniprocessor)
+
+config LOG_BUF_SHIFT_17
+ bool "128 KB"
+ default y if ARCH_S390
+
+config LOG_BUF_SHIFT_16
+ bool "64 KB"
+ default y if X86_NUMAQ || IA64
+
+config LOG_BUF_SHIFT_15
+ bool "32 KB"
+ default y if SMP
+
+config LOG_BUF_SHIFT_14
+ bool "16 KB"
+
+config LOG_BUF_SHIFT_13
+ bool "8 KB"
+
+config LOG_BUF_SHIFT_12
+ bool "4 KB"
+
+endchoice
+
+config LOG_BUF_SHIFT
+ int
+ default 17 if LOG_BUF_SHIFT_17=y
+ default 16 if LOG_BUF_SHIFT_16=y
+ default 15 if LOG_BUF_SHIFT_15=y
+ default 14 if LOG_BUF_SHIFT_14=y
+ default 13 if LOG_BUF_SHIFT_13=y
+ default 12 if LOG_BUF_SHIFT_12=y
+
+endmenu
+
--- ./kernel/printk.c%LOGBUF Sun Dec 15 18:08:24 2002
+++ ./kernel/printk.c Tue Dec 17 14:01:50 2002
@@ -30,16 +30,7 @@

#include <asm/uaccess.h>

-#if defined(CONFIG_X86_NUMAQ) || defined(CONFIG_IA64)
-#define LOG_BUF_LEN (65536)
-#elif defined(CONFIG_ARCH_S390)
-#define LOG_BUF_LEN (131072)
-#elif defined(CONFIG_SMP)
-#define LOG_BUF_LEN (32768)
-#else
-#define LOG_BUF_LEN (16384) /* This must be a power of two */
-#endif
-
+#define LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) /* This must be a power of two */
#define LOG_BUF_MASK (LOG_BUF_LEN-1)

#ifndef arch_consoles_callable