Skip to contentSkip to conversation

Limit console output by suppressing repetitious messages

PATCH In review Mike Travis 3 participants 13 messages Nov 18, 2009 – Nov 27, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Limit console output by suppressing repetitious messages

Fifth version...

- Print Processor and Core ID's only for first cpu booted.

Fourth version...

- Make the cpu bootup message a static (inlinable) function.

- Remove the reference of smp_processor_id == 0 indicating the boot cpu.

- Moved Hidetoshi's latest patch (with mods to not use pr_cont()) to separate thread.

Third version...

- Remove Processor Summary at end of bootup sequence and added '#' to CPU numbers. This makes it a bit easier to pick up the context if an error message disrupts the single output line of cpus.

- Remove cacheline size printout changes (dealt with in other patches)

- Modify MCE handler to send msgs to kernel debug log buffer and to not output an extra '\n' per cpu.

- ACPI messages moved to separate thread since they need to be submitted via the acpi group.

#1 lore raw

PATCH 1/5 x86: Limit the number of processor bootup messages

When there are a large number of processors in a system, there is an excessive amount of messages sent to the system console. It's estimated that with 4096 processors in a system, and the console baudrate set to 56K, the startup messages will take about 84 minutes to clear the serial port.

This set of patches limits the number of repetitious messages which contain no additional information. Much of this information
is obtainable from the /proc and /sysfs. Some of the messages
are also sent to the kernel log buffer as KERN_DEBUG messages so dmesg can be used to examine more closely any details specific to a problem.

The new cpu bootup sequence for system_state == SYSTEM_BOOTING:

Booting Node   0, Processors  #1 #2 #3 #4 #5 #6 #7 Ok.
Booting Node   1, Processors  #8 #9 #10 #11 #12 #13 #14 #15 Ok.

..
Booting Node 3, Processors #56 #57 #58 #59 #60 #61 #62 #63 Ok.
Brought up 64 CPUs

After the system is running, the standard Boot message is displayed:

    Booting Processor %d APIC 0x%x

Status of the following lines:

CPU: Physical Processor ID: printed once (for boot cpu)
CPU: Processor Core ID: printed once (for boot cpu)
CPU: Hyper-Threading is disabled printed once (for boot cpu)
CPU: Thermal monitoring enabled printed once (for boot cpu)
CPU %d/0x%x -> Node %d: removed
CPU %d is now offline: only if system_state == RUNNING
Initializing CPU#%d: KERN_DEBUG

---
 arch/x86/kernel/cpu/addon_cpuid_features.c |   15 +++++----
 arch/x86/kernel/cpu/amd.c                  |    2 -
 arch/x86/kernel/cpu/common.c               |   12 ++++---
 arch/x86/kernel/cpu/intel.c                |    2 -
 arch/x86/kernel/cpu/mcheck/therm_throt.c   |    8 +++--
 arch/x86/kernel/smpboot.c                  |   46 ++++++++++++++++++++---------
 6 files changed, 54 insertions(+), 31 deletions(-)
arch/x86/kernel/cpu/addon_cpuid_features.c +9 -6
@@ -74,6 +74,7 @@
 	unsigned int eax, ebx, ecx, edx, sub_index;
 	unsigned int ht_mask_width, core_plus_mask_width;
 	unsigned int core_select_mask, core_level_siblings;
+	static bool printed;
 
 	if (c->cpuid_level < 0xb)
 		return;
@@ -127,12 +128,14 @@
 
 	c->x86_max_cores = (core_level_siblings / smp_num_siblings);
 
-
-	printk(KERN_INFO  "CPU: Physical Processor ID: %d\n",
-	       c->phys_proc_id);
-	if (c->x86_max_cores > 1)
-		printk(KERN_INFO  "CPU: Processor Core ID: %d\n",
-		       c->cpu_core_id);
+	if (!printed) {
+		printk(KERN_INFO  "CPU: Physical Processor ID: %d\n",
+		       c->phys_proc_id);
+		if (c->x86_max_cores > 1)
+			printk(KERN_INFO  "CPU: Processor Core ID: %d\n",
+			       c->cpu_core_id);
+		printed = 1;
+	}
 	return;
 #endif
 }
arch/x86/kernel/cpu/amd.c +0 -2
@@ -375,8 +375,6 @@
 			node = nearby_node(apicid);
 	}
 	numa_set_node(cpu, node);
-
-	printk(KERN_INFO "CPU %d/0x%x -> Node %d\n", cpu, apicid, node);
 #endif
 }
 
arch/x86/kernel/cpu/common.c +7 -5
@@ -432,6 +432,7 @@
 #ifdef CONFIG_X86_HT
 	u32 eax, ebx, ecx, edx;
 	int index_msb, core_bits;
+	static bool printed;
 
 	if (!cpu_has(c, X86_FEATURE_HT))
 		return;
@@ -446,9 +447,9 @@
 
 	smp_num_siblings = (ebx & 0xff0000) >> 16;
 
-	if (smp_num_siblings == 1) {
-		printk(KERN_INFO  "CPU: Hyper-Threading is disabled\n");
-		goto out;
+	if (smp_num_siblings == 1 && c->cpu_index == 0) {
+		pr_info("CPU0: Hyper-Threading is disabled\n");
+		return;
 	}
 
 	if (smp_num_siblings <= 1)
@@ -474,11 +475,12 @@
 				       ((1 << core_bits) - 1);
 
 out:
-	if ((c->x86_max_cores * smp_num_siblings) > 1) {
+	if (!printed && (c->x86_max_cores * smp_num_siblings) > 1) {
 		printk(KERN_INFO  "CPU: Physical Processor ID: %d\n",
 		       c->phys_proc_id);
 		printk(KERN_INFO  "CPU: Processor Core ID: %d\n",
 		       c->cpu_core_id);
+		printed = 1;
 	}
 #endif
 }
@@ -1115,7 +1117,7 @@
 	if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask))
 		panic("CPU#%d already initialized!\n", cpu);
 
-	printk(KERN_INFO "Initializing CPU#%d\n", cpu);
+	pr_debug("Initializing CPU#%d\n", cpu);
 
 	clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
 
arch/x86/kernel/cpu/intel.c +0 -2
@@ -266,8 +266,6 @@
 	if (node == NUMA_NO_NODE || !node_online(node))
 		node = first_node(node_online_map);
 	numa_set_node(cpu, node);
-
-	printk(KERN_INFO "CPU %d/0x%x -> Node %d\n", cpu, apicid, node);
 #endif
 }
 
arch/x86/kernel/cpu/mcheck/therm_throt.c +6 -2
@@ -259,6 +259,7 @@
 	unsigned int cpu = smp_processor_id();
 	int tm2 = 0;
 	u32 l, h;
+	static bool printed;
 
 	/* Thermal monitoring depends on ACPI and clock modulation*/
 	if (!cpu_has(c, X86_FEATURE_ACPI) || !cpu_has(c, X86_FEATURE_ACC))
@@ -312,8 +313,11 @@
 	l = apic_read(APIC_LVTTHMR);
 	apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
 
-	printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n",
-	       cpu, tm2 ? "TM2" : "TM1");
+	if (!printed) {
+		printk(KERN_INFO "CPU0: Thermal monitoring enabled (%s)\n",
+		       tm2 ? "TM2" : "TM1");
+		printed = true;
+	}
 
 	/* enable thermal throttle processing */
 	atomic_set(&therm_throt_en, 1);
arch/x86/kernel/smpboot.c +32 -14

82 lines not on this page · raw message

#2 lore raw

Re: [PATCH 1/5] x86: Limit the number of processor bootup messages

Quoted 13 lines · Mike Travis

When there are a large number of processors in a system, there is an excessive amount of messages sent to the system console. It's estimated that with 4096 processors in a system, and the console baudrate set to 56K, the startup messages will take about 84 minutes to clear the serial port.

This set of patches limits the number of repetitious messages which contain no additional information.  Much of this information is obtainable from the /proc and /sysfs.   Some of the messages are also sent to the kernel log buffer as KERN_DEBUG messages so dmesg can be used to examine more closely any details specific to a problem.

Quoted 7 lines

The new cpu bootup sequence for system_state == SYSTEM_BOOTING:

Booting Node   0, Processors  #1 #2 #3 #4 #5 #6 #7 Ok. Booting Node   1, Processors  #8 #9 #10 #11 #12 #13 #14 #15 Ok. ..
Booting Node   3, Processors  #56 #57 #58 #59 #60 #61 #62 #63 Ok. Brought up 64 CPUs

how about
Booting Node 0, Processors #1/0x01 #2/0x02 #3....
append apic id in hex after the numbering.?

YH

#3 lore raw

Re: [PATCH 1/5] x86: Limit the number of processor bootup messages

Quoted 22 lines · Yinghai Lu
Quoted 13 lines · Mike Travis

When there are a large number of processors in a system, there is an excessive amount of messages sent to the system console. It's estimated that with 4096 processors in a system, and the console baudrate set to 56K, the startup messages will take about 84 minutes to clear the serial port.

This set of patches limits the number of repetitious messages which contain no additional information. Much of this information
is obtainable from the /proc and /sysfs. Some of the messages
are also sent to the kernel log buffer as KERN_DEBUG messages so dmesg can be used to examine more closely any details specific to a problem.

Quoted 7 lines

The new cpu bootup sequence for system_state == SYSTEM_BOOTING:

Booting Node   0, Processors  #1 #2 #3 #4 #5 #6 #7 Ok.
Booting Node   1, Processors  #8 #9 #10 #11 #12 #13 #14 #15 Ok.

..
Booting Node 3, Processors #56 #57 #58 #59 #60 #61 #62 #63 Ok.
Brought up 64 CPUs

Quoted 5 lines

how about
Booting Node 0, Processors #1/0x01 #2/0x02 #3....
append apic id in hex after the numbering.?

YH

The APIC id's are already listed earlier in the log. There are some other APIC patches to deal with making the output clearer as well as more/less verbose.

#4 lore raw

Re: [PATCH 1/5] x86: Limit the number of processor bootup messages

In reply to Mike Travis
Quoted 13 lines · Mike Travis

+++ linux/arch/x86/kernel/smpboot.c

arch/x86/kernel/smpboot.c +8 -0
@@ -671,6 +671,27 @@
 	complete(&c_idle->done);
 }
 
+/* reduce the number of lines printed when booting a large cpu count system */
+static void __cpuinit announce_cpu(int cpu, int apicid)
+{
+	if (system_state == SYSTEM_BOOTING) {
+#ifdef CONFIG_NUMA
+		static int current_node = -1;
+		int node = cpu_to_node(cpu);
+

arch/x86/kernel/smpboot.c line 691

Quoted 10 lines
arch/x86/kernel/smpboot.c +10 -0
+		if (node != current_node) {
+			if (current_node > (-1))
+				pr_cont(" Ok.\n");
+			current_node = node;
+			pr_info("Booting Node %3d, Processors ", node);
+		}
+		pr_cont(" #%d%s", cpu, cpu == (nr_cpu_ids - 1) ? " Ok.\n" : "");
+		return;
+#endif
+	}

That's pretty ugly. (the #ifdef is at the wrong nesting level to begin with)

Also, cannot we print out the same thing with no #ifdef variances? Users of UP systems wont be confused by a 'Node 0, CPU 0' message and in 5 years most x86 people will be running NUMA systems.

Ingo

#5 lore raw

PATCH 1/1 x86: Limit the number of processor bootup messages

x86: Limit the number of processor bootup messages

When there are a large number of processors in a system, there is an excessive amount of messages sent to the system console. It's estimated that with 4096 processors in a system, and the console baudrate set to 56K, the startup messages will take about 84 minutes to clear the serial port.

This set of patches limits the number of repetitious messages which contain no additional information. Much of this information
is obtainable from the /proc and /sysfs. Some of the messages
are also sent to the kernel log buffer as KERN_DEBUG messages so dmesg can be used to examine more closely any details specific to a problem.

The new cpu bootup sequence for system_state == SYSTEM_BOOTING:

Booting Node   0, Processors  #1 #2 #3 #4 #5 #6 #7 Ok.
Booting Node   1, Processors  #8 #9 #10 #11 #12 #13 #14 #15 Ok.

...
Booting Node 3, Processors #56 #57 #58 #59 #60 #61 #62 #63 Ok.
Brought up 64 CPUs

After the system is running, a single line boot message is displayed when CPU's are hotplugged on:

Booting Node %d Processor %d APIC 0x%x

Status of the following lines:

CPU: Physical Processor ID: printed once (for boot cpu)
CPU: Processor Core ID: printed once (for boot cpu)
CPU: Hyper-Threading is disabled printed once (for boot cpu)
CPU: Thermal monitoring enabled printed once (for boot cpu)
CPU %d/0x%x -> Node %d: removed
CPU %d is now offline: only if system_state == RUNNING
Initializing CPU#%d: KERN_DEBUG

---

Quoted 28 lines · Ingo Molnar
Quoted 13 lines · Mike Travis

+++ linux/arch/x86/kernel/smpboot.c

(quoted diff) +8 -0
@@ -671,6 +671,27 @@
 	complete(&c_idle->done);
 }
 
+/* reduce the number of lines printed when booting a large cpu count system */
+static void __cpuinit announce_cpu(int cpu, int apicid)
+{
+	if (system_state == SYSTEM_BOOTING) {
+#ifdef CONFIG_NUMA
+		static int current_node = -1;
+		int node = cpu_to_node(cpu);
+

Review line 691

Quoted 10 lines
(quoted diff) +10 -0
+		if (node != current_node) {
+			if (current_node > (-1))
+				pr_cont(" Ok.\n");
+			current_node = node;
+			pr_info("Booting Node %3d, Processors ", node);
+		}
+		pr_cont(" #%d%s", cpu, cpu == (nr_cpu_ids - 1) ? " Ok.\n" : "");
+		return;
+#endif
+	}

That's pretty ugly. (the #ifdef is at the wrong nesting level to begin with)

Quoted 3 lines

Also, cannot we print out the same thing with no #ifdef variances? Users of UP systems wont be confused by a 'Node 0, CPU 0' message and in 5 years most x86 people will be running NUMA systems.

Ingo

Sure thing, though note that the above is only for secondary processors. Boot CPU is still displayed as it was before (except for the cache line size removal in other patches.)

---

arch/x86/kernel/cpu/addon_cpuid_features.c |   15 +++++----
arch/x86/kernel/cpu/amd.c                  |    2 -
arch/x86/kernel/cpu/common.c               |   12 ++++---
arch/x86/kernel/cpu/intel.c                |    2 -
arch/x86/kernel/cpu/mcheck/therm_throt.c   |    8 +++--
arch/x86/kernel/smpboot.c                  |   45 +++++++++++++++++++----------
6 files changed, 53 insertions(+), 31 deletions(-)
arch/x86/kernel/cpu/addon_cpuid_features.c +0 -0
@@ -74,6 +74,7 @@
	unsigned int eax, ebx, ecx, edx, sub_index;
	unsigned int ht_mask_width, core_plus_mask_width;
	unsigned int core_select_mask, core_level_siblings;

+ static bool printed;

	if (c->cpuid_level < 0xb)
		return;

@@ -127,12 +128,14 @@

	c->x86_max_cores = (core_level_siblings / smp_num_siblings);

-
- printk(KERN_INFO "CPU: Physical Processor ID: %d\n",
- c->phys_proc_id);
- if (c->x86_max_cores > 1)
- printk(KERN_INFO "CPU: Processor Core ID: %d\n",
- c->cpu_core_id);
+ if (!printed) {
+ printk(KERN_INFO "CPU: Physical Processor ID: %d\n",
+ c->phys_proc_id);
+ if (c->x86_max_cores > 1)
+ printk(KERN_INFO "CPU: Processor Core ID: %d\n",
+ c->cpu_core_id);
+ printed = 1;
+ }

	return;

#endif
}

arch/x86/kernel/cpu/amd.c +0 -0
@@ -375,8 +375,6 @@
			node = nearby_node(apicid);
	}
	numa_set_node(cpu, node);

-
- printk(KERN_INFO "CPU %d/0x%x -> Node %d\n", cpu, apicid, node);
#endif
}

arch/x86/kernel/cpu/common.c +0 -0
@@ -432,6 +432,7 @@
#ifdef CONFIG_X86_HT
	u32 eax, ebx, ecx, edx;
	int index_msb, core_bits;

+ static bool printed;

	if (!cpu_has(c, X86_FEATURE_HT))
		return;

@@ -446,9 +447,9 @@

	smp_num_siblings = (ebx & 0xff0000) >> 16;

- if (smp_num_siblings == 1) {
- printk(KERN_INFO "CPU: Hyper-Threading is disabled\n");
- goto out;
+ if (smp_num_siblings == 1 && c->cpu_index == 0) {
+ pr_info("CPU0: Hyper-Threading is disabled\n");

+		return;
	}

	if (smp_num_siblings <= 1)
@@ -474,11 +475,12 @@
				       ((1 << core_bits) - 1);

out:
- if ((c->x86_max_cores * smp_num_siblings) > 1) {

+	if (!printed && (c->x86_max_cores * smp_num_siblings) > 1) {
		printk(KERN_INFO  "CPU: Physical Processor ID: %d\n",
		       c->phys_proc_id);
		printk(KERN_INFO  "CPU: Processor Core ID: %d\n",
		       c->cpu_core_id);
+		printed = 1;
	}
#endif
}
@@ -1115,7 +1117,7 @@
	if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask))
		panic("CPU#%d already initialized!\n", cpu);

- printk(KERN_INFO "Initializing CPU#%d\n", cpu);
+ pr_debug("Initializing CPU#%d\n", cpu);

	clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
arch/x86/kernel/cpu/intel.c +0 -0
@@ -266,8 +266,6 @@
	if (node == NUMA_NO_NODE || !node_online(node))
		node = first_node(node_online_map);
	numa_set_node(cpu, node);

-
- printk(KERN_INFO "CPU %d/0x%x -> Node %d\n", cpu, apicid, node);
#endif
}

arch/x86/kernel/cpu/mcheck/therm_throt.c +0 -0
@@ -259,6 +259,7 @@
	unsigned int cpu = smp_processor_id();
	int tm2 = 0;
	u32 l, h;

+ static bool printed;

	/* Thermal monitoring depends on ACPI and clock modulation*/
	if (!cpu_has(c, X86_FEATURE_ACPI) || !cpu_has(c, X86_FEATURE_ACC))
@@ -312,8 +313,11 @@
	l = apic_read(APIC_LVTTHMR);
	apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);

- printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n",
- cpu, tm2 ? "TM2" : "TM1");
+ if (!printed) {
+ printk(KERN_INFO "CPU0: Thermal monitoring enabled (%s)\n",
+ tm2 ? "TM2" : "TM1");
+ printed = true;
+ }

	/* enable thermal throttle processing */
	atomic_set(&therm_throt_en, 1);
arch/x86/kernel/smpboot.c +0 -0
@@ -671,6 +671,26 @@
	complete(&c_idle->done);
}

+/* reduce the number of lines printed when booting a large cpu count system */ +static void __cpuinit announce_cpu(int cpu, int apicid)
+{
+ static int current_node = -1;
+ int node = cpu_to_node(cpu);
+
+ if (system_state == SYSTEM_BOOTING) {
+ if (node != current_node) {
+ if (current_node > (-1))
+ pr_cont(" Ok.\n");
+ current_node = node;
+ pr_info("Booting Node %3d, Processors ", node);
+ }
+ pr_cont(" #%d%s", cpu, cpu == (nr_cpu_ids - 1) ? " Ok.\n" : "");
+ return;
+ } else
+ pr_info("Booting Node %d Processor %d APIC 0x%x\n",
+ node, cpu, apicid);
+}
+
/*
* NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad
* (ie clustered apic addressing mode), this is a LOGICAL apic ID.
@@ -736,9 +756,8 @@

	/* start_ip had better be page-aligned! */
	start_ip = setup_trampoline();

- /* So we see what's up */
- printk(KERN_INFO "Booting processor %d APIC 0x%x ip 0x%lx\n",
- cpu, apicid, start_ip);
+ /* So we see what's up */
+ announce_cpu(cpu, apicid);

	/*
	 * This grunge runs the startup process for
@@ -787,21 +806,17 @@
			udelay(100);
		}

- if (cpumask_test_cpu(cpu, cpu_callin_mask)) {
- /* number CPUs logically, starting from 1 (BSP is 0) */
- pr_debug("OK.\n");
- printk(KERN_INFO "CPU%d: ", cpu);
- print_cpu_info(&cpu_data(cpu));
- pr_debug("CPU has booted.\n");
- } else {
+ if (cpumask_test_cpu(cpu, cpu_callin_mask))
+ pr_debug("CPU%d: has booted.\n", cpu);

+		else {
			boot_error = 1;
			if (*((volatile unsigned char *)trampoline_base)
					== 0xA5)
				/* trampoline started but...? */
-				printk(KERN_ERR "Stuck ??\n");
+				pr_err("CPU%d: Stuck ??\n", cpu);
			else
				/* trampoline code not run */
-				printk(KERN_ERR "Not responding.\n");
+				pr_err("CPU%d: Not responding.\n", cpu);
			if (apic->inquire_remote_apic)
				apic->inquire_remote_apic(apicid);
		}
@@ -1300,14 +1315,16 @@
	for (i = 0; i < 10; i++) {
		/* They ack this in play_dead by setting CPU_DEAD */
		if (per_cpu(cpu_state, cpu) == CPU_DEAD) {

- printk(KERN_INFO "CPU %d is now offline\n", cpu);
+ if (system_state == SYSTEM_RUNNING)
+ pr_info("CPU %u is now offline\n", cpu);
+

			if (1 == num_online_cpus())
				alternatives_smp_switch(0);
			return;
		}
		msleep(100);
	}

- printk(KERN_ERR "CPU %u didn't die...\n", cpu);
+ pr_err("CPU %u didn't die...\n", cpu);
}

void play_dead_common(void)

#6 lore raw

PATCH 2/5 INIT: Limit the number of per cpu calibration bootup messages

In reply to Mike Travis

Limit the number of per cpu calibration messages by only printing out results for the first cpu to boot.

Don't print "CPUx is down" as this is expected, and we don't need 4096 reminders... ;-)

---
 init/calibrate.c |   24 +++++++++++++++---------
 kernel/cpu.c     |    5 ++---
 2 files changed, 17 insertions(+), 12 deletions(-)
init/calibrate.c +15 -9
@@ -123,23 +123,26 @@
 {
 	unsigned long ticks, loopbit;
 	int lps_precision = LPS_PREC;
+	static bool printed;
 
 	if (preset_lpj) {
 		loops_per_jiffy = preset_lpj;
-		printk(KERN_INFO
-			"Calibrating delay loop (skipped) preset value.. ");
-	} else if ((smp_processor_id() == 0) && lpj_fine) {
+		if (!printed)
+			pr_info("Calibrating delay loop (skipped) "
+				"preset value.. ");
+	} else if ((!printed) && lpj_fine) {
 		loops_per_jiffy = lpj_fine;
-		printk(KERN_INFO
-			"Calibrating delay loop (skipped), "
+		pr_info("Calibrating delay loop (skipped), "
 			"value calculated using timer frequency.. ");
 	} else if ((loops_per_jiffy = calibrate_delay_direct()) != 0) {
-		printk(KERN_INFO
-			"Calibrating delay using timer specific routine.. ");
+		if (!printed)
+			pr_info("Calibrating delay using timer "
+				"specific routine.. ");
 	} else {
 		loops_per_jiffy = (1<<12);
 
-		printk(KERN_INFO "Calibrating delay loop... ");
+		if (!printed)
+			pr_info("Calibrating delay loop... ");
 		while ((loops_per_jiffy <<= 1) != 0) {
 			/* wait for "start of" clock tick */
 			ticks = jiffies;
@@ -170,7 +173,10 @@
 				loops_per_jiffy &= ~loopbit;
 		}
 	}
-	printk(KERN_CONT "%lu.%02lu BogoMIPS (lpj=%lu)\n",
+	if (!printed)
+		pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n",
 			loops_per_jiffy/(500000/HZ),
 			(loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy);
+
+	printed = true;
 }
kernel/cpu.c +2 -3
@@ -392,10 +392,9 @@
 		if (cpu == first_cpu)
 			continue;
 		error = _cpu_down(cpu, 1);
-		if (!error) {
+		if (!error)
 			cpumask_set_cpu(cpu, frozen_cpus);
-			printk("CPU%d is down\n", cpu);
-		} else {
+		else {
 			printk(KERN_ERR "Error taking CPU%d down: %d\n",
 				cpu, error);
 			break;
#7 lore raw

[tip:timers/core] timers, init: Limit the number of per cpu calibration bootup messages

Commit-ID:  feae3203d711db0a9965300ee6d592257fdaae4f
Gitweb:     http://git.kernel.org/tip/feae3203d711db0a9965300ee6d592257fdaae4f
Author:     Mike Travis <[email protected]>
AuthorDate: Tue, 17 Nov 2009 18:22:13 -0600
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 26 Nov 2009 10:18:42 +0100

timers, init: Limit the number of per cpu calibration bootup messages

Limit the number of per cpu calibration messages by only printing out results for the first cpu to boot.

Also, don't print "CPUx is down" as this is expected, and we don't need 4096 reminders... ;-)

Cc Heiko Carstens <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Yinghai Lu <[email protected]>
Cc David Rientjes <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Hidetoshi Seto <[email protected]>
Cc Jack Steiner <[email protected]>
Cc Frederic Weisbecker <[email protected]>

LKML-Reference: <[email protected]>

---
 init/calibrate.c |   24 +++++++++++++++---------
 kernel/cpu.c     |    5 ++---
 2 files changed, 17 insertions(+), 12 deletions(-)
init/calibrate.c +15 -9
index a379c90..6eb48e5 100644
@@ -123,23 +123,26 @@ void __cpuinit calibrate_delay(void)
 {
 	unsigned long ticks, loopbit;
 	int lps_precision = LPS_PREC;
+	static bool printed;
 
 	if (preset_lpj) {
 		loops_per_jiffy = preset_lpj;
-		printk(KERN_INFO
-			"Calibrating delay loop (skipped) preset value.. ");
-	} else if ((smp_processor_id() == 0) && lpj_fine) {
+		if (!printed)
+			pr_info("Calibrating delay loop (skipped) "
+				"preset value.. ");
+	} else if ((!printed) && lpj_fine) {
 		loops_per_jiffy = lpj_fine;
-		printk(KERN_INFO
-			"Calibrating delay loop (skipped), "
+		pr_info("Calibrating delay loop (skipped), "
 			"value calculated using timer frequency.. ");
 	} else if ((loops_per_jiffy = calibrate_delay_direct()) != 0) {
-		printk(KERN_INFO
-			"Calibrating delay using timer specific routine.. ");
+		if (!printed)
+			pr_info("Calibrating delay using timer "
+				"specific routine.. ");
 	} else {
 		loops_per_jiffy = (1<<12);
 
-		printk(KERN_INFO "Calibrating delay loop... ");
+		if (!printed)
+			pr_info("Calibrating delay loop... ");
 		while ((loops_per_jiffy <<= 1) != 0) {
 			/* wait for "start of" clock tick */
 			ticks = jiffies;
@@ -170,7 +173,10 @@ void __cpuinit calibrate_delay(void)
 				loops_per_jiffy &= ~loopbit;
 		}
 	}
-	printk(KERN_CONT "%lu.%02lu BogoMIPS (lpj=%lu)\n",
+	if (!printed)
+		pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n",
 			loops_per_jiffy/(500000/HZ),
 			(loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy);
+
+	printed = true;
 }
kernel/cpu.c +2 -3
index 6ba0f1e..7c4e271 100644
@@ -392,10 +392,9 @@ int disable_nonboot_cpus(void)
 		if (cpu == first_cpu)
 			continue;
 		error = _cpu_down(cpu, 1);
-		if (!error) {
+		if (!error)
 			cpumask_set_cpu(cpu, frozen_cpus);
-			printk("CPU%d is down\n", cpu);
-		} else {
+		else {
 			printk(KERN_ERR "Error taking CPU%d down: %d\n",
 				cpu, error);
 			break;
#8 lore raw

PATCH 3/5 firmware: Limit the number of per cpu firmware messages during bootup

In reply to Mike Travis

Limit the number of per cpu firmware: messages by sending them only to the kernel debug log buffer.

	[  170.643130] firmware: requesting intel-ucode/06-2e-0
---
 drivers/base/firmware_class.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/firmware_class.c +1 -1
@@ -495,7 +495,7 @@
 	}
 
 	if (uevent)
-		dev_info(device, "firmware: requesting %s\n", name);
+		dev_dbg(device, "firmware: requesting %s\n", name);
 
 	retval = fw_setup_device(firmware, &f_dev, name, device, uevent);
 	if (retval)
#9 lore raw

PATCH 4/5 sched: Limit the number of scheduler debug messages

In reply to Mike Travis

Remove the verbose scheduler debug messages unless kernel parameter "sched_debug" set. /proc/sched_debug unchanged.

---
 Documentation/kernel-parameters.txt |    2 ++
 kernel/sched.c                      |   13 +++++++++++++
 2 files changed, 15 insertions(+)
Documentation/kernel-parameters.txt +2 -0
@@ -2182,6 +2182,8 @@
 
 	sbni=		[NET] Granch SBNI12 leased line adapter
 
+	sched_debug	[KNL] Enables verbose scheduler debug messages.
+
 	sc1200wdt=	[HW,WDT] SC1200 WDT (watchdog) driver
 			Format: <io>[,<timeout>[,<isapnp>]]
 
kernel/sched.c +13 -0
@@ -7743,6 +7743,16 @@
 
 #ifdef CONFIG_SCHED_DEBUG
 
+static __read_mostly int sched_domain_debug_enabled;
+
+static int __init sched_domain_debug_setup(char *str)
+{
+	sched_domain_debug_enabled = 1;
+
+	return 0;
+}
+early_param("sched_debug", sched_domain_debug_setup);
+
 static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
 				  struct cpumask *groupmask)
 {
@@ -7829,6 +7839,9 @@
 	cpumask_var_t groupmask;
 	int level = 0;
 
+	if (!sched_domain_debug_enabled)
+		return;
+
 	if (!sd) {
 		printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu);
 		return;
#10 lore raw

[tip:sched/core] sched: Limit the number of scheduler debug messages

Commit-ID:  f6630114d9198aa959ac95c131334c020038f253
Gitweb:     http://git.kernel.org/tip/f6630114d9198aa959ac95c131334c020038f253
Author:     Mike Travis <[email protected]>
AuthorDate: Tue, 17 Nov 2009 18:22:15 -0600
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 26 Nov 2009 10:17:30 +0100

sched: Limit the number of scheduler debug messages

Remove the verbose scheduler debug messages unless kernel parameter "sched_debug" set. /proc/sched_debug unchanged.

Cc Heiko Carstens <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Yinghai Lu <[email protected]>
Cc David Rientjes <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Hidetoshi Seto <[email protected]>
Cc Jack Steiner <[email protected]>
Cc Frederic Weisbecker <[email protected]>

LKML-Reference: <[email protected]>

---
 Documentation/kernel-parameters.txt |    2 ++
 kernel/sched.c                      |   13 +++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
Documentation/kernel-parameters.txt +2 -0
index 9107b38..f2a9507 100644
@@ -2182,6 +2182,8 @@ and is between 256 and 4096 characters. It is defined in the file
 
 	sbni=		[NET] Granch SBNI12 leased line adapter
 
+	sched_debug	[KNL] Enables verbose scheduler debug messages.
+
 	sc1200wdt=	[HW,WDT] SC1200 WDT (watchdog) driver
 			Format: <io>[,<timeout>[,<isapnp>]]
 
kernel/sched.c +13 -0
index a57c6ae..48ff66a 100644
@@ -7720,6 +7720,16 @@ early_initcall(migration_init);
 
 #ifdef CONFIG_SCHED_DEBUG
 
+static __read_mostly int sched_domain_debug_enabled;
+
+static int __init sched_domain_debug_setup(char *str)
+{
+	sched_domain_debug_enabled = 1;
+
+	return 0;
+}
+early_param("sched_debug", sched_domain_debug_setup);
+
 static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
 				  struct cpumask *groupmask)
 {
@@ -7806,6 +7816,9 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu)
 	cpumask_var_t groupmask;
 	int level = 0;
 
+	if (!sched_domain_debug_enabled)
+		return;
+
 	if (!sd) {
 		printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu);
 		return;
#11 lore raw

PATCH 5/5 x86: Limit number of per cpu TSC sync messages

In reply to Mike Travis

Limit the number of per cpu TSC sync messages by only printing to the console if an error occurs, otherwise print as a DEBUG message.

The info message "Skipping synchronization ..." is only printed after the last cpu has booted.

---
 arch/x86/kernel/tsc_sync.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
arch/x86/kernel/tsc_sync.c +7 -6
@@ -114,13 +114,12 @@
 		return;
 
 	if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) {
-		printk_once(KERN_INFO "Skipping synchronization checks as TSC is reliable.\n");
+		if (cpu == (nr_cpu_ids-1) || system_state != SYSTEM_BOOTING)
+			pr_info(
+			"Skipped synchronization checks as TSC is reliable.\n");
 		return;
 	}
 
-	pr_info("checking TSC synchronization [CPU#%d -> CPU#%d]:",
-		smp_processor_id(), cpu);
-
 	/*
 	 * Reset it - in case this is a second bootup:
 	 */
@@ -142,12 +141,14 @@
 		cpu_relax();
 
 	if (nr_warps) {
-		printk("\n");
+		pr_warning("TSC synchronization [CPU#%d -> CPU#%d]:\n",
+			smp_processor_id(), cpu);
 		pr_warning("Measured %Ld cycles TSC warp between CPUs, "
 			   "turning off TSC clock.\n", max_warp);
 		mark_tsc_unstable("check_tsc_sync_source failed");
 	} else {
-		printk(" passed.\n");
+		pr_debug("TSC synchronization [CPU#%d -> CPU#%d]: passed\n",
+			smp_processor_id(), cpu);
 	}
 
 	/*
#12 lore raw

[tip:x86/debug] x86: Limit number of per cpu TSC sync messages

Commit-ID:  9b3660a55a9052518c91cc7c62d89e22f3f6f490
Gitweb:     http://git.kernel.org/tip/9b3660a55a9052518c91cc7c62d89e22f3f6f490
Author:     Mike Travis <[email protected]>
AuthorDate: Tue, 17 Nov 2009 18:22:16 -0600
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 26 Nov 2009 10:17:45 +0100

x86: Limit number of per cpu TSC sync messages

Limit the number of per cpu TSC sync messages by only printing to the console if an error occurs, otherwise print as a DEBUG message.

The info message "Skipping synchronization ..." is only printed after the last cpu has booted.

Cc Heiko Carstens <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Yinghai Lu <[email protected]>
Cc David Rientjes <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Hidetoshi Seto <[email protected]>
Cc Jack Steiner <[email protected]>
Cc Frederic Weisbecker <[email protected]>

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/tsc_sync.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
arch/x86/kernel/tsc_sync.c +7 -6
index f379309..eed1568 100644
@@ -114,13 +114,12 @@ void __cpuinit check_tsc_sync_source(int cpu)
 		return;
 
 	if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) {
-		printk_once(KERN_INFO "Skipping synchronization checks as TSC is reliable.\n");
+		if (cpu == (nr_cpu_ids-1) || system_state != SYSTEM_BOOTING)
+			pr_info(
+			"Skipped synchronization checks as TSC is reliable.\n");
 		return;
 	}
 
-	pr_info("checking TSC synchronization [CPU#%d -> CPU#%d]:",
-		smp_processor_id(), cpu);
-
 	/*
 	 * Reset it - in case this is a second bootup:
 	 */
@@ -142,12 +141,14 @@ void __cpuinit check_tsc_sync_source(int cpu)
 		cpu_relax();
 
 	if (nr_warps) {
-		printk("\n");
+		pr_warning("TSC synchronization [CPU#%d -> CPU#%d]:\n",
+			smp_processor_id(), cpu);
 		pr_warning("Measured %Ld cycles TSC warp between CPUs, "
 			   "turning off TSC clock.\n", max_warp);
 		mark_tsc_unstable("check_tsc_sync_source failed");
 	} else {
-		printk(" passed.\n");
+		pr_debug("TSC synchronization [CPU#%d -> CPU#%d]: passed\n",
+			smp_processor_id(), cpu);
 	}
 
 	/*