Skip to contentSkip to conversation

x86/cpu: Reduce boot-time logspam

PATCH In review Andrew Cooper 3 participants 3 messages Jan 16, 2014 – Jan 18, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cpu: Reduce boot-time logspam

These messages are printed per-cpu with no cpu identifying information. There is no reason to print them for each cpu, so restrict them to cpu 0 only. Futhermore, "MCE support disabled by bootparam" really doesn't warrent having a file:line reference.

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
CC Ian Campbell <[email protected]>

---

Discovered when testing Xen-4.4-rc2 on an Haswell SDP platform with some MCE and Cstate quirks. We have still not debugged whether it is the SDP or Xen which is at fault, but Xen 4.3 and 4.4 needs "max_cstate=1 mce=off" to successfully boot on it.

I am on the fence as to whether this should be proposed for inclusion into 4.4. Boot-time logspam is not a massive problem, but on the other hand, it contributes against "#2 An awesome release" and the fixes are quite obvious with a very low risk of hidden further bugs.

---
 xen/arch/x86/cpu/mcheck/mce.c |    4 ++--
 xen/arch/x86/cpu/mwait-idle.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
xen/arch/x86/cpu/mcheck/mce.c +2 -2
index b375ef7..6726ec2 100644
@@ -729,8 +729,8 @@ void mcheck_init(struct cpuinfo_x86 *c, bool_t bsp)
 {
     enum mcheck_type inited = mcheck_none;
 
-    if (mce_disabled == 1) {
-        dprintk(XENLOG_INFO, "MCE support disabled by bootparam\n");
+    if (bsp && mce_disabled == 1) {
+        printk(XENLOG_INFO "MCE support disabled by bootparam\n");
         return;
     }
 
xen/arch/x86/cpu/mwait-idle.c +2 -2
index 85179f2..a145289 100644
@@ -540,7 +540,7 @@ static int mwait_idle_cpu_init(struct notifier_block *nfb,
 		state = MWAIT_HINT2CSTATE(hint) + 1;
 		substate = MWAIT_HINT2SUBSTATE(hint);
 
-		if (state > max_cstate) {
+		if (cpu == 0 && state > max_cstate) {
 			printk(PREFIX "max C-state %u reached\n", max_cstate);
 			break;
 		}
@@ -552,7 +552,7 @@ static int mwait_idle_cpu_init(struct notifier_block *nfb,
 		if (substate >= num_substates)
 			continue;
 
-		if (dev->count >= ACPI_PROCESSOR_MAX_POWER) {
+		if (cpu == 0 && dev->count >= ACPI_PROCESSOR_MAX_POWER) {
 			printk(PREFIX "max C-state count of %u reached\n",
 			       ACPI_PROCESSOR_MAX_POWER);
 			break;
Signature · 1 line
1.7.10.4
#1 lore raw

xen/arch/x86/cpu/mcheck/mce.c void mcheck_init(struct cpuinfo_x86 *c, bool_t bsp) · line 733

Quoted 11 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
xen/arch/x86/cpu/mcheck/mce.c +2 -2
@@ -729,8 +729,8 @@ void mcheck_init(struct cpuinfo_x86 *c, bool_t bsp)
 {
     enum mcheck_type inited = mcheck_none;
 
-    if (mce_disabled == 1) {
-        dprintk(XENLOG_INFO, "MCE support disabled by bootparam\n");
+    if (bsp && mce_disabled == 1) {
+        printk(XENLOG_INFO "MCE support disabled by bootparam\n");

While I'm fine with this, ...

Quoted 12 lines
xen/arch/x86/cpu/mwait-idle.c +1 -1
@@ -540,7 +540,7 @@ static int mwait_idle_cpu_init(struct notifier_block *nfb,
 		state = MWAIT_HINT2CSTATE(hint) + 1;
 		substate = MWAIT_HINT2SUBSTATE(hint);
 
-		if (state > max_cstate) {
+		if (cpu == 0 && state > max_cstate) {
 			printk(PREFIX "max C-state %u reached\n", max_cstate);
 			break;
 		}

xen/arch/x86/cpu/mwait-idle.c static int mwait_idle_cpu_init(struct notifier_block *nfb, · line 558

Quoted 8 lines
xen/arch/x86/cpu/mwait-idle.c +1 -1
@@ -552,7 +552,7 @@ static int mwait_idle_cpu_init(struct notifier_block *nfb,
 		if (substate >= num_substates)
 			continue;
 
-		if (dev->count >= ACPI_PROCESSOR_MAX_POWER) {
+		if (cpu == 0 && dev->count >= ACPI_PROCESSOR_MAX_POWER) {
 			printk(PREFIX "max C-state count of %u reached\n",
 			       ACPI_PROCESSOR_MAX_POWER);
 			break;

... I object to both of these: There's no reason why the C-state count could differ between CPUs. Hence I'd accept these being guarded so they each get printed just once, but tying this to CPU0 is wrong. And then, adding the CPU number would be a natural thing to do.

Also, with this being a clone of Linux code (with which I sync from time to time), I'd really expect such changes to go through there. Of course, if you see the messages with Xen but not with a suitable Linux equivalent, then we'd have to look into why you see them...

Jan

#2 lore raw
Quoted 40 lines · Jan Beulich

xen/arch/x86/cpu/mcheck/mce.c void mcheck_init(struct cpuinfo_x86 *c, bool_t · line 732

Quoted 11 lines
Quoted 2 lines
Quoted 2 lines

On 16.01.14 at 12:44, Andrew Cooper <[email protected]> wrote:

xen/arch/x86/cpu/mcheck/mce.c +2 -2
@@ -729,8 +729,8 @@ void mcheck_init(struct cpuinfo_x86 *c, bool_t
     bsp)  { enum mcheck_type inited = mcheck_none;
 
-    if (mce_disabled == 1) {
-        dprintk(XENLOG_INFO, "MCE support disabled by bootparam\n");
+    if (bsp && mce_disabled == 1) {
+        printk(XENLOG_INFO "MCE support disabled by bootparam\n");

While I'm fine with this, ...

Quoted 11 lines
xen/arch/x86/cpu/mwait-idle.c +1 -1
@@ -540,7 +540,7 @@ static int mwait_idle_cpu_init(struct
 		notifier_block *nfb, state = MWAIT_HINT2CSTATE(hint) + 1;
 		substate = MWAIT_HINT2SUBSTATE(hint);
 
-		if (state > max_cstate) {
+		if (cpu == 0 && state > max_cstate) {
 			printk(PREFIX "max C-state %u reached\n", max_cstate);  			break;
 		}

xen/arch/x86/cpu/mwait-idle.c static int mwait_idle_cpu_init(struct · line 558

Quoted 8 lines
xen/arch/x86/cpu/mwait-idle.c +1 -1
@@ -552,7 +552,7 @@ static int mwait_idle_cpu_init(struct
 		notifier_block *nfb, if (substate >= num_substates)
 			continue;
 
-		if (dev->count >= ACPI_PROCESSOR_MAX_POWER) {
+		if (cpu == 0 && dev->count >= ACPI_PROCESSOR_MAX_POWER) {
 			printk(PREFIX "max C-state count of %u reached\n",
 			       ACPI_PROCESSOR_MAX_POWER);
 			break;

... I object to both of these: There's no reason why the C-state count could differ between CPUs. Hence I'd accept these being guarded so they each get printed just once, but tying this to CPU0 is wrong. And then, adding the CPU number would be a natural thing to do.

Quoted 5 lines

Also, with this being a clone of Linux code (with which I sync from time to time), I'd really expect such changes to go through there. Of course, if you see the messages with Xen but not with a suitable Linux equivalent, then we'd have to look into why you see them...

Agree, and, root cause 'Discovered when testing Xen-4.4-rc2 on an Haswell SDP platform with some MCE and Cstate quirks' is real point.

Thanks,
Jinsong