From: Don Zickus <dzickus@redhat.com> Date: Thu, 19 Aug 2010 13:17:50 -0400 Subject: [kernel] nmi_watchdog: output count during check on boot Message-id: <1282223870-19466-1-git-send-email-dzickus@redhat.com> Patchwork-id: 27719 O-Subject: [RHEL5 PATCH v2] [x86] nmi_watchdog: output the count during check on bootup Bugzilla: 613667 RH-Acked-by: Danny Feng <dfeng@redhat.com> RH-Acked-by: Jiri Olsa <jolsa@redhat.com> https://bugzilla.redhat.com/show_bug.cgi?id=613667 The output of nmi_watchdog check, where it counts how many NMIs it received during a small window, is only displayed on a failure. I was asked to provide that data regardless of success/fail. The reason was the data was useful enough to debug certain problems, like cpu slowness problems in one particular example. The patch below just adds another printk to output that info, very trivial. Won't apply upstream as we are migrating towards another nmi_watchdog, which doesn't have a check. Though I might add something similar now. v2: - fix column issues - change to KERNEL_DEBUG Please ACK. Cheers, Don diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c index 02fe497..7a23f5d 100644 --- a/arch/i386/kernel/nmi.c +++ b/arch/i386/kernel/nmi.c @@ -109,8 +109,6 @@ static int __init check_nmi_watchdog(void) if (!prev_nmi_count) return -1; - printk(KERN_INFO "Testing NMI watchdog ... "); - if (nmi_watchdog == NMI_LOCAL_APIC) smp_call_function(nmi_cpu_busy, NULL, 0, 0); @@ -157,6 +155,11 @@ static int __init check_nmi_watchdog(void) apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED); kfree(prev_nmi_count); return -1; + } else { + printk(KERN_DEBUG "CPU#%d: NMI watchdog performance " + "counter calibration - %d->%d\n", + cpu, prev_nmi_count[cpu], + nmi_count(cpu)); } } if (!atomic_read(&nmi_watchdog_active)) { @@ -166,7 +169,7 @@ static int __init check_nmi_watchdog(void) } endflag = 1; - printk("OK.\n"); + printk("NMI watchdog testing PASSED.\n"); /* now that we know it works we can reduce NMI frequency to something more reasonable; makes a difference in some configs */ diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c index 6c854a6..2a4336e 100644 --- a/arch/x86_64/kernel/nmi.c +++ b/arch/x86_64/kernel/nmi.c @@ -119,8 +119,6 @@ int __init check_nmi_watchdog (void) if (!counts) return -1; - printk(KERN_INFO "testing NMI watchdog ... "); - #ifdef CONFIG_SMP if (nmi_watchdog == NMI_LOCAL_APIC) smp_call_function(nmi_cpu_busy, NULL, 0, 0); @@ -163,6 +161,11 @@ int __init check_nmi_watchdog (void) apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED); kfree(counts); return -1; + } else { + printk(KERN_DEBUG "CPU#%d: NMI watchdog performance " + "counter calibration - %d->%d\n", + cpu, counts[cpu], + cpu_pda(cpu)->__nmi_count); } } if (!atomic_read(&nmi_watchdog_active)) { @@ -172,7 +175,7 @@ int __init check_nmi_watchdog (void) } endflag = 1; - printk("OK.\n"); + printk("NMI watchdog testing PASSED.\n"); /* now that we know it works we can reduce NMI frequency to something more reasonable; makes a difference in some configs */