LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/6] init: Shrink early messages to prevent overflowing the kernel log buffer
@ 2011-01-19 23:01 Mike Travis
2011-01-19 23:01 ` [PATCH 1/6] printk: Allocate kernel log buffer earlier Mike Travis
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Mike Travis @ 2011-01-19 23:01 UTC (permalink / raw)
To: Ingo Molnar, Len Brown, H. Peter Anvin
Cc: Thomas Gleixner, Jack Steiner, Robin Holt, Lori Gilbertson, x86,
linux-kernel, linux-acpi
On larger systems, information in the kernel log is lost because
there is so much early text printed, that it overflows the static
log buffer before the log_buf_len kernel parameter can be processed,
and a bigger log buffer allocated.
Distros are relunctant to increase memory usage by increasing the
size of the static log buffer, so minimize the problem by allocating
the new log buffer as early as possible, and reducing the amount
of characters those early messages generate.
Some stats from testing these changes on our current lab UV systems.
(Both of these systems lost all of the e820 and EFI memmap ranges
before the changes.)
System X:
8,793,945,145,344 bytes of system memory
256 nodes
599 EFI Mem ranges
4096 cpu_ids
43% of static log buffer unused
System Y:
11,779,115,188,224 bytes of system memory
492 Nodes
976 EFI Mem ranges
1968 cpu_ids
17% of static log buffer unused
The last stat is how close the static log buffer came
to overflowing. While these resources are fairly close
to today's max limits, there is not a lot of head room
for growth.
An alternative for the future might be to create a larger
static log buffer in the __initdata section, and then
always allocate a dynamically sized log buffer to replace
it. This would also allow shrinking the log buffer for
memory tight situations. But it would add complexity to
the code.
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/6] printk: Allocate kernel log buffer earlier
2011-01-19 23:01 [PATCH 0/6] init: Shrink early messages to prevent overflowing the kernel log buffer Mike Travis
@ 2011-01-19 23:01 ` Mike Travis
2011-01-20 23:50 ` Andrew Morton
2011-01-19 23:01 ` [PATCH 2/6] ACPI: Minimize X2APIC initial messages Mike Travis
` (4 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Mike Travis @ 2011-01-19 23:01 UTC (permalink / raw)
To: Ingo Molnar, Len Brown, H. Peter Anvin
Cc: Thomas Gleixner, Jack Steiner, Robin Holt, Lori Gilbertson, x86,
linux-kernel, linux-acpi
[-- Attachment #1: get_log_buff_early --]
[-- Type: text/plain, Size: 4043 bytes --]
On larger systems, because of the numerous ACPI, Bootmem and EFI
messages, the static log buffer overflows before the larger one
specified by the log_buf_len param is allocated. Minimize the
overflow by allocating the new log buffer as soon as possible.
All arch's are covered by the "setup_log_buf" in start_kernel().
The x86 arch allocates it right after bootmem is created.
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Jack Steiner <steiner@sgi.com>
Reviewed-by: Robin Holt <holt@sgi.com>
---
arch/x86/kernel/setup.c | 5 ++
include/linux/kernel.h | 2 +
init/main.c | 1
kernel/printk.c | 82 +++++++++++++++++++++++++++++-------------------
4 files changed, 59 insertions(+), 31 deletions(-)
--- linux-2.6.32.orig/arch/x86/kernel/setup.c
+++ linux-2.6.32/arch/x86/kernel/setup.c
@@ -966,6 +966,11 @@ void __init setup_arch(char **cmdline_p)
initmem_init(0, max_pfn);
+ /*
+ * Allocate bigger log buffer as early as possible
+ */
+ setup_log_buf();
+
#ifdef CONFIG_ACPI_SLEEP
/*
* Reserve low memory region for sleep support.
--- linux-2.6.32.orig/include/linux/kernel.h
+++ linux-2.6.32/include/linux/kernel.h
@@ -281,6 +281,8 @@ static inline void log_buf_kexec_setup(v
}
#endif
+void setup_log_buf(void);
+
extern int printk_needs_cpu(int cpu);
extern void printk_tick(void);
--- linux-2.6.32.orig/init/main.c
+++ linux-2.6.32/init/main.c
@@ -589,6 +589,7 @@ asmlinkage void __init start_kernel(void
* These use large bootmem allocations and must precede
* kmem_cache_init()
*/
+ setup_log_buf();
pidhash_init();
vfs_caches_init_early();
sort_main_extable();
--- linux-2.6.32.orig/kernel/printk.c
+++ linux-2.6.32/kernel/printk.c
@@ -167,46 +167,66 @@ void log_buf_kexec_setup(void)
}
#endif
+static unsigned long __initdata new_log_buf_len;
+
static int __init log_buf_len_setup(char *str)
{
unsigned size = memparse(str, &str);
- unsigned long flags;
if (size)
size = roundup_pow_of_two(size);
- if (size > log_buf_len) {
- unsigned start, dest_idx, offset;
- char *new_log_buf;
-
- new_log_buf = alloc_bootmem(size);
- if (!new_log_buf) {
- printk(KERN_WARNING "log_buf_len: allocation failed\n");
- goto out;
- }
-
- spin_lock_irqsave(&logbuf_lock, flags);
- log_buf_len = size;
- log_buf = new_log_buf;
-
- offset = start = min(con_start, log_start);
- dest_idx = 0;
- while (start != log_end) {
- log_buf[dest_idx] = __log_buf[start & (__LOG_BUF_LEN - 1)];
- start++;
- dest_idx++;
- }
- log_start -= offset;
- con_start -= offset;
- log_end -= offset;
- spin_unlock_irqrestore(&logbuf_lock, flags);
+ if (size > log_buf_len)
+ new_log_buf_len = size;
- printk(KERN_NOTICE "log_buf_len: %d\n", log_buf_len);
- }
-out:
- return 1;
+ return 0;
}
+early_param("log_buf_len", log_buf_len_setup);
-__setup("log_buf_len=", log_buf_len_setup);
+void __init setup_log_buf(void)
+{
+ unsigned long flags;
+ unsigned start, dest_idx, offset;
+ char *new_log_buf;
+ char first_line[64], *first_nl;
+
+ if (!new_log_buf_len)
+ return;
+
+ new_log_buf = alloc_bootmem(new_log_buf_len);
+ memset(first_line, 0, sizeof(first_line));
+
+ spin_lock_irqsave(&logbuf_lock, flags);
+ log_buf_len = new_log_buf_len;
+ log_buf = new_log_buf;
+ new_log_buf_len = 0;
+
+ offset = start = min(con_start, log_start);
+ dest_idx = 0;
+ while (start != log_end) {
+ unsigned log_idx_mask = start & (__LOG_BUF_LEN - 1);
+
+ log_buf[dest_idx] = __log_buf[log_idx_mask];
+ if (dest_idx < sizeof(first_line) - 1)
+ first_line[dest_idx] = __log_buf[log_idx_mask];
+ start++;
+ dest_idx++;
+ }
+ log_start -= offset;
+ con_start -= offset;
+ log_end -= offset;
+ spin_unlock_irqrestore(&logbuf_lock, flags);
+
+ first_nl = strchr(first_line, '\n');
+ if (first_nl)
+ *first_nl = '\0';
+
+ pr_info("log_buf_len: %d, first line: %s\n",
+ log_buf_len, first_line);
+
+ pr_debug("bu: %d/%d (%d%%)\n",
+ dest_idx, __LOG_BUF_LEN - dest_idx,
+ (dest_idx * 100) / __LOG_BUF_LEN);
+}
#ifdef CONFIG_BOOT_PRINTK_DELAY
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/6] ACPI: Minimize X2APIC initial messages
2011-01-19 23:01 [PATCH 0/6] init: Shrink early messages to prevent overflowing the kernel log buffer Mike Travis
2011-01-19 23:01 ` [PATCH 1/6] printk: Allocate kernel log buffer earlier Mike Travis
@ 2011-01-19 23:01 ` Mike Travis
2011-01-19 23:01 ` [PATCH 3/6] x86: Minimize initial Bootmem messages Mike Travis
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Mike Travis @ 2011-01-19 23:01 UTC (permalink / raw)
To: Ingo Molnar, Len Brown, H. Peter Anvin
Cc: Thomas Gleixner, Jack Steiner, Robin Holt, Lori Gilbertson, x86,
linux-kernel, linux-acpi
[-- Attachment #1: minimize-x2apic-msgs --]
[-- Type: text/plain, Size: 1591 bytes --]
Minimize X2APIC messages by printing 8 per line and dropping
the "enabled" flag since that's assumed. It will still print
"disabled" if necessary.
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Jack Steiner <steiner@sgi.com>
Reviewed-by: Robin Holt <holt@sgi.com>
---
arch/x86/kernel/acpi/boot.c | 3 +++
drivers/acpi/tables.c | 13 +++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
--- linux-2.6.32.orig/arch/x86/kernel/acpi/boot.c
+++ linux-2.6.32/arch/x86/kernel/acpi/boot.c
@@ -848,6 +848,9 @@ static int __init acpi_parse_madt_lapic_
if (!count) {
x2count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC,
acpi_parse_x2apic, MAX_APICS);
+ /* insure trailing newline is output */
+ pr_cont("\n");
+
count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC,
acpi_parse_lapic, MAX_APICS);
}
--- linux-2.6.32.orig/drivers/acpi/tables.c
+++ linux-2.6.32/drivers/acpi/tables.c
@@ -66,11 +66,16 @@ void acpi_table_print_madt_entry(struct
{
struct acpi_madt_local_x2apic *p =
(struct acpi_madt_local_x2apic *)header;
- printk(KERN_INFO PREFIX
- "X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
+
+ if ((p->uid & 7) == 0)
+ pr_info(PREFIX "X2APIC apic_id=uid:");
+
+ pr_cont(" %02x=%02x%s%s",
p->local_apic_id, p->uid,
- (p->lapic_flags & ACPI_MADT_ENABLED) ?
- "enabled" : "disabled");
+ /* assume "enabled" unless "disabled" */
+ (p->lapic_flags & ACPI_MADT_ENABLED) ?
+ "" : " disabled",
+ (p->uid & 7) == 7 ? "\n" : "");
}
break;
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/6] x86: Minimize initial Bootmem messages
2011-01-19 23:01 [PATCH 0/6] init: Shrink early messages to prevent overflowing the kernel log buffer Mike Travis
2011-01-19 23:01 ` [PATCH 1/6] printk: Allocate kernel log buffer earlier Mike Travis
2011-01-19 23:01 ` [PATCH 2/6] ACPI: Minimize X2APIC initial messages Mike Travis
@ 2011-01-19 23:01 ` Mike Travis
2011-01-19 23:01 ` [PATCH 4/6] x86: Minimize initial e820 messages Mike Travis
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Mike Travis @ 2011-01-19 23:01 UTC (permalink / raw)
To: Ingo Molnar, Len Brown, H. Peter Anvin
Cc: Thomas Gleixner, Jack Steiner, Robin Holt, Lori Gilbertson, x86,
linux-kernel, linux-acpi
[-- Attachment #1: minimize-bootmem-msgs --]
[-- Type: text/plain, Size: 3424 bytes --]
The majority of Bootmem setup information is repeated for
every node. Minimize the output by showing early reservations
only once unless it changes for a specific node, and condense
the first three lines into one line.
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Jack Steiner <steiner@sgi.com>
Reviewed-by: Robin Holt <holt@sgi.com>
---
arch/x86/kernel/e820.c | 31 ++++++++++++++++++++++---------
arch/x86/mm/numa_64.c | 12 +++---------
2 files changed, 25 insertions(+), 18 deletions(-)
--- linux-2.6.32.orig/arch/x86/kernel/e820.c
+++ linux-2.6.32/arch/x86/kernel/e820.c
@@ -922,29 +922,42 @@ void __init free_early(u64 start, u64 en
void __init early_res_to_bootmem(u64 start, u64 end)
{
- int i, count;
+ int i, count, same = 1;
u64 final_start, final_end;
+ static struct early_res pres[MAX_EARLY_RES];
count = 0;
- for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++)
+ for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
+ /* remove redundant messages */
+ if (pres[i].start != early_res[i].start ||
+ pres[i].end != early_res[i].end) {
+ pres[i].start = early_res[i].start;
+ pres[i].end = early_res[i].end;
+ same = 0;
+ }
count++;
+ }
+ if (same) {
+ pr_cont("ER:%d %llx+%llx\n", count, start, end-start);
+ return;
+ }
+
+ pr_info("Early Reservations: %d [%llx+%llx]\n",
+ count, start, end-start);
- printk(KERN_INFO "(%d early reservations) ==> bootmem [%010llx - %010llx]\n",
- count, start, end);
for (i = 0; i < count; i++) {
struct early_res *r = &early_res[i];
- printk(KERN_INFO " #%d [%010llx - %010llx] %16s", i,
+ pr_info(" #%d [%010llx - %010llx] %16s", i,
r->start, r->end, r->name);
final_start = max(start, r->start);
final_end = min(end, r->end);
if (final_start >= final_end) {
- printk(KERN_CONT "\n");
+ pr_cont("\n");
continue;
}
- printk(KERN_CONT " ==> [%010llx - %010llx]\n",
- final_start, final_end);
+ pr_cont(" ==> [%010llx - %010llx]\n", final_start, final_end);
reserve_bootmem_generic(final_start, final_end - final_start,
- BOOTMEM_DEFAULT);
+ BOOTMEM_DEFAULT);
}
}
--- linux-2.6.32.orig/arch/x86/mm/numa_64.c
+++ linux-2.6.32/arch/x86/mm/numa_64.c
@@ -201,9 +201,6 @@ setup_node_bootmem(int nodeid, unsigned
start = roundup(start, ZONE_ALIGN);
- printk(KERN_INFO "Bootmem setup node %d %016lx-%016lx\n", nodeid,
- start, end);
-
start_pfn = start >> PAGE_SHIFT;
last_pfn = end >> PAGE_SHIFT;
@@ -219,8 +216,6 @@ setup_node_bootmem(int nodeid, unsigned
if (node_data[nodeid] == (void *)cache_alias_offset)
return;
nodedata_phys = __pa(node_data[nodeid]);
- printk(KERN_INFO " NODE_DATA [%016lx - %016lx]\n", nodedata_phys,
- nodedata_phys + pgdat_size - 1);
memset(NODE_DATA(nodeid), 0, sizeof(pg_data_t));
NODE_DATA(nodeid)->bdata = &bootmem_node_data[nodeid];
@@ -258,12 +253,11 @@ setup_node_bootmem(int nodeid, unsigned
bootmap_start >> PAGE_SHIFT,
start_pfn, last_pfn);
- printk(KERN_INFO " bootmap [%016lx - %016lx] pages %lx\n",
- bootmap_start, bootmap_start + bootmap_size - 1,
- bootmap_pages);
-
free_bootmem_with_active_regions(nodeid, end);
+ pr_info("Bootmem Node %d: data %lx map %lx+%lx pgs %lx ",
+ nodeid, start, bootmap_start, bootmap_size, bootmap_pages);
+
/*
* convert early reserve to bootmem reserve earlier
* otherwise early_node_mem could use early reserved mem
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/6] x86: Minimize initial e820 messages
2011-01-19 23:01 [PATCH 0/6] init: Shrink early messages to prevent overflowing the kernel log buffer Mike Travis
` (2 preceding siblings ...)
2011-01-19 23:01 ` [PATCH 3/6] x86: Minimize initial Bootmem messages Mike Travis
@ 2011-01-19 23:01 ` Mike Travis
2011-01-19 23:01 ` [PATCH 5/6] x86: Minimize SRAT messages Mike Travis
2011-01-19 23:01 ` [PATCH 6/6] printk: Minimize time zero output Mike Travis
5 siblings, 0 replies; 10+ messages in thread
From: Mike Travis @ 2011-01-19 23:01 UTC (permalink / raw)
To: Ingo Molnar, Len Brown, H. Peter Anvin
Cc: Thomas Gleixner, Jack Steiner, Robin Holt, Lori Gilbertson, x86,
linux-kernel, linux-acpi
[-- Attachment #1: minimize-e820-msgs --]
[-- Type: text/plain, Size: 5609 bytes --]
Minimize the early e820 messages by printing less characters
for the address range as well as not expanding the type info
for each entry.
Also the "modified physical RAM map" was mostly a duplicate of
the original e820 memory map printout. Minimize the output
by only printing those entries that were actually modified.
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Jack Steiner <steiner@sgi.com>
Reviewed-by: Robin Holt <holt@sgi.com>
---
arch/x86/kernel/e820.c | 107 +++++++++++++++++++++++++++----------------------
arch/x86/kernel/efi.c | 10 ++--
2 files changed, 66 insertions(+), 51 deletions(-)
--- linux-2.6.32.orig/arch/x86/kernel/e820.c
+++ linux-2.6.32/arch/x86/kernel/e820.c
@@ -44,6 +44,8 @@
*/
struct e820map e820;
struct e820map e820_saved;
+struct e820map e820_prev __initdata;
+int e820_prev_saved __initdata;
/* For PCI or other memory-mapped resources */
unsigned long pci_mem_start = 0xaeedbabe;
@@ -137,42 +139,69 @@ void __init e820_saved_add_region(u64 st
__e820_add_region(&e820_saved, start, size, type);
}
-static void __init e820_print_type(u32 type)
+static inline const char *e820_type_to_string(int e820_type)
{
- switch (type) {
- case E820_RAM:
+ switch (e820_type) {
case E820_RESERVED_KERN:
- printk(KERN_CONT "(usable)");
- break;
- case E820_RESERVED:
- printk(KERN_CONT "(reserved)");
- break;
- case E820_ACPI:
- printk(KERN_CONT "(ACPI data)");
- break;
- case E820_NVS:
- printk(KERN_CONT "(ACPI NVS)");
- break;
- case E820_UNUSABLE:
- printk(KERN_CONT "(unusable)");
- break;
- default:
- printk(KERN_CONT "type %u", type);
- break;
+ case E820_RAM: return "System RAM";
+ case E820_ACPI: return "ACPI Tables";
+ case E820_NVS: return "ACPI Non-volatile Storage";
+ case E820_UNUSABLE: return "Unusable memory";
+ default: return "reserved";
+ }
+}
+
+/* compare new entry with old */
+static inline int not_modified(int i, int j)
+{
+ for (; j < e820_prev.nr_map &&
+ e820_prev.map[j].addr <= e820.map[i].addr; j++) {
+
+ if (e820.map[i].addr == e820_prev.map[j].addr &&
+ e820.map[i].size == e820_prev.map[j].size &&
+ e820.map[i].type == e820_prev.map[j].type)
+ return j;
}
+ return 0;
+}
+
+static inline void e820_print_header(void)
+{
+ pr_info("types: (%d)=%s (%d)=%s (%d)=%s (%d)=%s (%d)=%s\n",
+ E820_RAM, e820_type_to_string(E820_RAM),
+ E820_RESERVED, e820_type_to_string(E820_RESERVED),
+ E820_ACPI, e820_type_to_string(E820_ACPI),
+ E820_NVS, e820_type_to_string(E820_NVS),
+ E820_UNUSABLE, e820_type_to_string(E820_UNUSABLE));
}
void __init e820_print_map(char *who)
{
- int i;
+ int i, j = 0;
+ int hdr = 0;
+ int mod = strcmp(who, "modified") == 0;
for (i = 0; i < e820.nr_map; i++) {
- printk(KERN_INFO " %s: %016Lx - %016Lx ", who,
- (unsigned long long) e820.map[i].addr,
- (unsigned long long)
- (e820.map[i].addr + e820.map[i].size));
- e820_print_type(e820.map[i].type);
- printk(KERN_CONT "\n");
+ /* only print those entries that were really modified */
+ if (mod)
+ j = not_modified(i, j);
+
+ if (!j) {
+ if (!hdr++)
+ e820_print_header();
+
+ pr_info("%s: %Lx+%Lx (%d)\n", who,
+ (unsigned long long) e820.map[i].addr,
+ (unsigned long long) e820.map[i].size,
+ e820.map[i].type);
+ }
+ }
+ if (!hdr)
+ pr_info("<none>\n");
+
+ if (!e820_prev_saved) {
+ memcpy(&e820_prev, &e820, sizeof(struct e820map));
+ e820_prev_saved = 1;
}
}
@@ -449,13 +478,11 @@ static u64 __init __e820_update_range(st
size = ULLONG_MAX - start;
end = start + size;
- printk(KERN_DEBUG "e820 update range: %016Lx - %016Lx ",
+ pr_debug("e820 update range: %Lx+%Lx %s ==> %s\n",
(unsigned long long) start,
- (unsigned long long) end);
- e820_print_type(old_type);
- printk(KERN_CONT " ==> ");
- e820_print_type(new_type);
- printk(KERN_CONT "\n");
+ (unsigned long long) size,
+ e820_type_to_string(old_type),
+ e820_type_to_string(new_type));
for (i = 0; i < e820x->nr_map; i++) {
struct e820entry *ei = &e820x->map[i];
@@ -564,7 +591,7 @@ void __init update_e820(void)
if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr_map))
return;
e820.nr_map = nr_map;
- printk(KERN_INFO "modified physical RAM map:\n");
+ printk(KERN_INFO "physical RAM map entries that were modified:\n");
e820_print_map("modified");
}
static void __init update_e820_saved(void)
@@ -1328,18 +1355,6 @@ void __init finish_e820_parsing(void)
}
}
-static inline const char *e820_type_to_string(int e820_type)
-{
- switch (e820_type) {
- case E820_RESERVED_KERN:
- case E820_RAM: return "System RAM";
- case E820_ACPI: return "ACPI Tables";
- case E820_NVS: return "ACPI Non-volatile Storage";
- case E820_UNUSABLE: return "Unusable memory";
- default: return "reserved";
- }
-}
-
/*
* Mark e820 reserved areas as busy for the resource manager.
*/
--- linux-2.6.32.orig/arch/x86/kernel/efi.c
+++ linux-2.6.32/arch/x86/kernel/efi.c
@@ -306,11 +306,11 @@ static void __init print_efi_memmap(void
p < memmap.map_end;
p += memmap.desc_size, i++) {
md = p;
- printk(KERN_INFO PFX "mem%02u: type=%u, attr=0x%llx, "
- "range=[0x%016llx-0x%016llx) (%lluMB)\n",
- i, md->type, md->attribute, md->phys_addr,
- md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
- (md->num_pages >> (20 - EFI_PAGE_SHIFT)));
+ pr_info(PFX
+ "mem%u: range %llx+%llx (%lluMB) type %u attr %llx\n",
+ i, md->phys_addr, md->num_pages << EFI_PAGE_SHIFT,
+ (md->num_pages >> (20 - EFI_PAGE_SHIFT)),
+ md->type, md->attribute);
}
}
#endif /* EFI_DEBUG */
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/6] x86: Minimize SRAT messages
2011-01-19 23:01 [PATCH 0/6] init: Shrink early messages to prevent overflowing the kernel log buffer Mike Travis
` (3 preceding siblings ...)
2011-01-19 23:01 ` [PATCH 4/6] x86: Minimize initial e820 messages Mike Travis
@ 2011-01-19 23:01 ` Mike Travis
2011-01-19 23:01 ` [PATCH 6/6] printk: Minimize time zero output Mike Travis
5 siblings, 0 replies; 10+ messages in thread
From: Mike Travis @ 2011-01-19 23:01 UTC (permalink / raw)
To: Ingo Molnar, Len Brown, H. Peter Anvin
Cc: Thomas Gleixner, Jack Steiner, Robin Holt, Lori Gilbertson, x86,
linux-kernel, linux-acpi
[-- Attachment #1: minimize-srat-msgs --]
[-- Type: text/plain, Size: 2036 bytes --]
Condense the SRAT: messages to show all APIC id's for the
node on a single line.
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Jack Steiner <steiner@sgi.com>
Reviewed-by: Robin Holt <holt@sgi.com>
---
arch/x86/mm/srat_64.c | 16 ++++++++++++----
drivers/acpi/numa.c | 3 +++
2 files changed, 15 insertions(+), 4 deletions(-)
--- linux-2.6.32.orig/arch/x86/mm/srat_64.c
+++ linux-2.6.32/arch/x86/mm/srat_64.c
@@ -115,6 +115,7 @@ acpi_numa_x2apic_affinity_init(struct ac
{
int pxm, node;
int apic_id;
+ static int last_node = -1, last_pxm = -1;
if (srat_disabled())
return;
@@ -136,8 +137,16 @@ acpi_numa_x2apic_affinity_init(struct ac
apicid_to_node[apic_id] = node;
node_set(node, cpu_nodes_parsed);
acpi_numa = 1;
- printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n",
- pxm, apic_id, node);
+ if (node != last_node) {
+ pr_info("SRAT: Node %u: PXM:APIC %u:%u",
+ node, pxm, apic_id);
+ last_node = node;
+ last_pxm = pxm;
+ } else if (pxm != last_pxm) {
+ pr_cont(" %u:%u", pxm, apic_id);
+ last_pxm = pxm;
+ } else
+ pr_cont(" :%u", apic_id);
}
/* Callback for Proximity Domain -> LAPIC mapping */
@@ -294,8 +303,7 @@ acpi_numa_memory_affinity_init(struct ac
nd->end = end;
}
- printk(KERN_INFO "SRAT: Node %u PXM %u %lx-%lx\n", node, pxm,
- start, end);
+ pr_info("SRAT: Node %u PXM %u %lx+%lx\n", node, pxm, start, end-start);
e820_register_active_regions(node, start >> PAGE_SHIFT,
end >> PAGE_SHIFT);
--- linux-2.6.32.orig/drivers/acpi/numa.c
+++ linux-2.6.32/drivers/acpi/numa.c
@@ -290,6 +290,9 @@ int __init acpi_numa_init(void)
if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY,
acpi_parse_x2apic_affinity, NR_CPUS);
+ /* insure trailing newline is output */
+ pr_cont("\n");
+
acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
acpi_parse_processor_affinity, NR_CPUS);
acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6/6] printk: Minimize time zero output
2011-01-19 23:01 [PATCH 0/6] init: Shrink early messages to prevent overflowing the kernel log buffer Mike Travis
` (4 preceding siblings ...)
2011-01-19 23:01 ` [PATCH 5/6] x86: Minimize SRAT messages Mike Travis
@ 2011-01-19 23:01 ` Mike Travis
5 siblings, 0 replies; 10+ messages in thread
From: Mike Travis @ 2011-01-19 23:01 UTC (permalink / raw)
To: Ingo Molnar, Len Brown, H. Peter Anvin
Cc: Thomas Gleixner, Jack Steiner, Robin Holt, Lori Gilbertson, x86,
linux-kernel, linux-acpi
[-- Attachment #1: minimize-time-zero-msgs --]
[-- Type: text/plain, Size: 890 bytes --]
Reduce the length for time zero messages by only printing "[0] ".
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Jack Steiner <steiner@sgi.com>
Reviewed-by: Robin Holt <holt@sgi.com>
---
kernel/printk.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- linux-2.6.32.orig/kernel/printk.c
+++ linux-2.6.32/kernel/printk.c
@@ -806,11 +806,14 @@ asmlinkage int vprintk(const char *fmt,
unsigned long nanosec_rem;
t = cpu_clock(printk_cpu);
- nanosec_rem = do_div(t, 1000000000);
- tlen = sprintf(tbuf, "[%5lu.%06lu] ",
+ if (likely(t)) {
+ nanosec_rem = do_div(t, 1000000000);
+ tlen = sprintf(tbuf, "[%5lu.%06lu] ",
(unsigned long) t,
nanosec_rem / 1000);
-
+ } else {
+ tlen = sprintf(tbuf, "[0] ");
+ }
for (tp = tbuf; tp < tbuf + tlen; tp++)
emit_log_char(*tp);
printed_len += tlen;
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/6] printk: Allocate kernel log buffer earlier
2011-01-19 23:01 ` [PATCH 1/6] printk: Allocate kernel log buffer earlier Mike Travis
@ 2011-01-20 23:50 ` Andrew Morton
2011-01-20 23:55 ` Mike Travis
0 siblings, 1 reply; 10+ messages in thread
From: Andrew Morton @ 2011-01-20 23:50 UTC (permalink / raw)
To: Mike Travis
Cc: Ingo Molnar, Len Brown, H. Peter Anvin, Thomas Gleixner,
Jack Steiner, Robin Holt, Lori Gilbertson, x86, linux-kernel,
linux-acpi
On Wed, 19 Jan 2011 17:01:07 -0600
Mike Travis <travis@sgi.com> wrote:
> On larger systems, because of the numerous ACPI, Bootmem and EFI
> messages, the static log buffer overflows before the larger one
> specified by the log_buf_len param is allocated. Minimize the
> overflow by allocating the new log buffer as soon as possible.
>
> All arch's are covered by the "setup_log_buf" in start_kernel().
> The x86 arch allocates it right after bootmem is created.
>
> ...
>
> +void setup_log_buf(void);
>
> ...
>
> +void __init setup_log_buf(void)
>
It's a PITA but the declaration should have the __init tag as well. We
have had at least one instance where failing to do this caused an arch
(arm) to emit a short-mode address offset to a function which it
thought was in the same section as the callsite. Only the target was
in a different section from the callsite and the linker couldn't fit
the needed offset into the operand.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/6] printk: Allocate kernel log buffer earlier
2011-01-20 23:50 ` Andrew Morton
@ 2011-01-20 23:55 ` Mike Travis
2011-01-21 0:07 ` Andrew Morton
0 siblings, 1 reply; 10+ messages in thread
From: Mike Travis @ 2011-01-20 23:55 UTC (permalink / raw)
To: Andrew Morton
Cc: Ingo Molnar, Len Brown, H. Peter Anvin, Thomas Gleixner,
Jack Steiner, Robin Holt, Lori Gilbertson, x86, linux-kernel,
linux-acpi
Andrew Morton wrote:
> On Wed, 19 Jan 2011 17:01:07 -0600
> Mike Travis <travis@sgi.com> wrote:
>
>> On larger systems, because of the numerous ACPI, Bootmem and EFI
>> messages, the static log buffer overflows before the larger one
>> specified by the log_buf_len param is allocated. Minimize the
>> overflow by allocating the new log buffer as soon as possible.
>>
>> All arch's are covered by the "setup_log_buf" in start_kernel().
>> The x86 arch allocates it right after bootmem is created.
>>
>> ...
>>
>> +void setup_log_buf(void);
>>
>> ...
>>
>> +void __init setup_log_buf(void)
>>
>
> It's a PITA but the declaration should have the __init tag as well. We
> have had at least one instance where failing to do this caused an arch
> (arm) to emit a short-mode address offset to a function which it
> thought was in the same section as the callsite. Only the target was
> in a different section from the callsite and the linker couldn't fit
> the needed offset into the operand.
>
That reminds me of another question. If I have:
void __init setup(void)
{
static int data;
...
Does data automatically get put into the initdata section? Or does
it need the __initdata tag as well?
Thanks,
Mike
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/6] printk: Allocate kernel log buffer earlier
2011-01-20 23:55 ` Mike Travis
@ 2011-01-21 0:07 ` Andrew Morton
0 siblings, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2011-01-21 0:07 UTC (permalink / raw)
To: Mike Travis
Cc: Ingo Molnar, Len Brown, H. Peter Anvin, Thomas Gleixner,
Jack Steiner, Robin Holt, Lori Gilbertson, x86, linux-kernel,
linux-acpi
On Thu, 20 Jan 2011 15:55:30 -0800
Mike Travis <travis@sgi.com> wrote:
> If I have:
>
> void __init setup(void)
> {
> static int data;
> ...
>
> Does data automatically get put into the initdata section? Or does
> it need the __initdata tag as well?
It needs __initdata. gcc doesn't know that __init and __initdata are
related things - as far as the compiler is concerned, they're all just
sections.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-01-21 0:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-19 23:01 [PATCH 0/6] init: Shrink early messages to prevent overflowing the kernel log buffer Mike Travis
2011-01-19 23:01 ` [PATCH 1/6] printk: Allocate kernel log buffer earlier Mike Travis
2011-01-20 23:50 ` Andrew Morton
2011-01-20 23:55 ` Mike Travis
2011-01-21 0:07 ` Andrew Morton
2011-01-19 23:01 ` [PATCH 2/6] ACPI: Minimize X2APIC initial messages Mike Travis
2011-01-19 23:01 ` [PATCH 3/6] x86: Minimize initial Bootmem messages Mike Travis
2011-01-19 23:01 ` [PATCH 4/6] x86: Minimize initial e820 messages Mike Travis
2011-01-19 23:01 ` [PATCH 5/6] x86: Minimize SRAT messages Mike Travis
2011-01-19 23:01 ` [PATCH 6/6] printk: Minimize time zero output Mike Travis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).