Skip to contentSkip to conversation

kernel/watchdog.c: Only output hw-PMU message once

PATCH In review Prarit Bhargava 2 participants 3 messages Nov 21, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/watchdog.c: Only output hw-PMU message once

When CONFIG_BOOTPARAM_HOTPLUG_CPU0 is enabled, the socket containing the boot cpu can be replaced. During the hot add event, the message

NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.

is output implying that the NMI was disabled at some point. This is not the case and the message has caused confusion for users of systems that support socket removal.

This patch modifies the message so that it only outputs a single time during runtime.

Cc Borislav Petkov <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Don Zickus <[email protected]>
Cc Hidehiro Kawai <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Joshua Hunt <[email protected]>
Cc Ingo Molnar <[email protected]>
---
 kernel/watchdog.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/watchdog.c +1 -1
index 9acb29f280ec..560414692c01 100644
@@ -615,7 +615,7 @@ static int watchdog_nmi_enable(unsigned int cpu)
 	if (!IS_ERR(event)) {
 		/* only print for cpu0 or different than cpu0 */
 		if (cpu == 0 || cpu0_err)
-			pr_info("enabled on all CPUs, permanently consumes one hw-PMU counter.\n");
+			pr_info_once("enabled on all CPUs, permanently consumes one hw-PMU counter.\n");
 		goto out_save;
 	}
 
Signature · 1 line
1.7.9.3
#1 lore raw
Quoted 11 lines · Prarit Bhargava

When CONFIG_BOOTPARAM_HOTPLUG_CPU0 is enabled, the socket containing the boot cpu can be replaced. During the hot add event, the message

NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.

is output implying that the NMI was disabled at some point. This is not the case and the message has caused confusion for users of systems that support socket removal.

This patch modifies the message so that it only outputs a single time during runtime.

Hmm, it occurred to me, with pr_info_once, what happens if you disable and re-enable, is this still printed?

echo 0 > /proc/sys/kernel/watchdog
echo 1 > /proc/sys/kernel/watchdog

Cheers,
Don

Quoted 30 lines
Cc Borislav Petkov <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Don Zickus <[email protected]>
Cc Hidehiro Kawai <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Joshua Hunt <[email protected]>
Cc Ingo Molnar <[email protected]>
---
 kernel/watchdog.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/watchdog.c +1 -1
index 9acb29f280ec..560414692c01 100644
@@ -615,7 +615,7 @@ static int watchdog_nmi_enable(unsigned int cpu)
 	if (!IS_ERR(event)) {
 		/* only print for cpu0 or different than cpu0 */
 		if (cpu == 0 || cpu0_err)
-			pr_info("enabled on all CPUs, permanently consumes one hw-PMU counter.\n");
+			pr_info_once("enabled on all CPUs, permanently consumes one hw-PMU counter.\n");
 		goto out_save;
 	}
 
Signature · 1 line
1.7.9.3
#2 lore raw
Quoted 10 lines · Don Zickus
Quoted 9 lines · Prarit Bhargava

When CONFIG_BOOTPARAM_HOTPLUG_CPU0 is enabled, the socket containing the boot cpu can be replaced. During the hot add event, the message

NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.

is output implying that the NMI was disabled at some point. This is not the case and the message has caused confusion for users of systems that support socket removal.

Quoted 8 lines
Quoted 2 lines

This patch modifies the message so that it only outputs a single time during runtime.

Hmm, it occurred to me, with pr_info_once, what happens if you disable and re-enable, is this still printed?

echo 0 > /proc/sys/kernel/watchdog
echo 1 > /proc/sys/kernel/watchdog

With my patch, the message is not printed using the above steps. I'll go back and see if I can figure something out.

P.

Quoted 34 lines

Cheers,
Don

Quoted 30 lines
Cc Borislav Petkov <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Don Zickus <[email protected]>
Cc Hidehiro Kawai <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Joshua Hunt <[email protected]>
Cc Ingo Molnar <[email protected]>
---
 kernel/watchdog.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/watchdog.c +1 -1
index 9acb29f280ec..560414692c01 100644
@@ -615,7 +615,7 @@ static int watchdog_nmi_enable(unsigned int cpu)
 	if (!IS_ERR(event)) {
 		/* only print for cpu0 or different than cpu0 */
 		if (cpu == 0 || cpu0_err)
-			pr_info("enabled on all CPUs, permanently consumes one hw-PMU counter.\n");
+			pr_info_once("enabled on all CPUs, permanently consumes one hw-PMU counter.\n");
 		goto out_save;
 	}
 
Signature · 1 line
1.7.9.3