Skip to contentSkip to conversation

Constant output in syslog of EDAC message

PATCH New Raymond Bennett 3 participants 8 messages Oct 19, 2020 – Oct 26, 2020

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

Hi,

I am seeing the constant output of the following messages in syslog, wondering what I can do to resolve this:

Oct 19 13:19:30 hostname kernel: EDAC DEBUG: ie31200_check: MC0

It outputs about once every second.

uname -a
Linux hostname 5.9.0-991.native #1 SMP Mon Oct 12 08:10:54 PDT 2020 x86_64 GNU/Linux

/proc/cpuinfo
processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 158
model name : Intel(R) Xeon(R) CPU E3-1505M v6 @ 3.00GHz stepping : 9
microcode : 0xd6

maintainer
#1 lore raw
Quoted 6 lines · Raymond Bennett

Hi,

I am seeing the constant output of the following messages in syslog, wondering what I can do to resolve this:

Oct 19 13:19:30 hostname kernel: EDAC DEBUG: ie31200_check: MC0

Looks like a debugging leftover. I'll remove it soon unless Jason (CCed) screams.

Leaving in the rest for him.

Quoted 14 lines

It outputs about once every second.

uname -a
Linux hostname 5.9.0-991.native #1 SMP Mon Oct 12 08:10:54 PDT 2020 x86_64 GNU/Linux

/proc/cpuinfo
processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 158
model name : Intel(R) Xeon(R) CPU E3-1505M v6 @ 3.00GHz stepping : 9
microcode : 0xd6

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
maintainer
#2 lore raw
Quoted 11 lines · Borislav Petkov
Quoted 6 lines · Raymond Bennett

Hi,

I am seeing the constant output of the following messages in syslog, wondering what I can do to resolve this:

Oct 19 13:19:30 hostname kernel: EDAC DEBUG: ie31200_check: MC0

Looks like a debugging leftover. I'll remove it soon unless Jason (CCed) screams.

Leaving in the rest for him.

Hi,

Yes, I likely was just following what was in other edac drivers at

the time - for example, i3200_check() has a similar debug. I guess

it could have a higher level. But if we remove this one, we may

want to audit some of the other edac drivers as well.

Thanks,

-Jason

Quoted 15 lines
Quoted 15 lines

It outputs about once every second.

uname -a
Linux hostname 5.9.0-991.native #1 SMP Mon Oct 12 08:10:54 PDT 2020 x86_64 GNU/Linux

/proc/cpuinfo
processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 158
model name : Intel(R) Xeon(R) CPU E3-1505M v6 @ 3.00GHz stepping : 9
microcode : 0xd6

maintainer
#3 lore raw
Quoted 4 lines · Jason Baron

Yes, I likely was just following what was in other edac drivers at the time - for example, i3200_check() has a similar debug. I guess it could have a higher level. But if we remove this one, we may want to audit some of the other edac drivers as well.

Sounds good. So one patch removing them all would make sense. If you feel like doing it, be my guest. Otherwise, it'll land on my ever-growing todo. :-\

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
maintainer
#4 lore raw

PATCH 1/1 EDAC: Do not issue useless debug statements in the polling routine

From: Borislav Petkov <[email protected]>

They have been spreading around the subsystem by example so remove them all.

---
 drivers/edac/amd76x_edac.c     | 1 -
 drivers/edac/e752x_edac.c      | 1 -
 drivers/edac/e7xxx_edac.c      | 1 -
 drivers/edac/i3000_edac.c      | 1 -
 drivers/edac/i3200_edac.c      | 1 -
 drivers/edac/i5000_edac.c      | 2 +-
 drivers/edac/i5400_edac.c      | 2 +-
 drivers/edac/i82443bxgx_edac.c | 1 -
 drivers/edac/i82860_edac.c     | 1 -
 drivers/edac/i82875p_edac.c    | 1 -
 drivers/edac/i82975x_edac.c    | 1 -
 drivers/edac/ie31200_edac.c    | 1 -
 drivers/edac/r82600_edac.c     | 1 -
 drivers/edac/x38_edac.c        | 1 -
 14 files changed, 2 insertions(+), 14 deletions(-)
drivers/edac/amd76x_edac.c +0 -1
index 9c6e326b4c14..2a49f68a7cf9 100644
@@ -179,7 +179,6 @@ static int amd76x_process_error_info(struct mem_ctl_info *mci,
 static void amd76x_check(struct mem_ctl_info *mci)
 {
 	struct amd76x_error_info info;
-	edac_dbg(3, "\n");
 	amd76x_get_error_info(mci, &info);
 	amd76x_process_error_info(mci, &info, 1);
 }
drivers/edac/e752x_edac.c +0 -1
index 313d08018166..ac7c9b42d4c7 100644
@@ -980,7 +980,6 @@ static void e752x_check(struct mem_ctl_info *mci)
 {
 	struct e752x_error_info info;
 
-	edac_dbg(3, "\n");
 	e752x_get_error_info(mci, &info);
 	e752x_process_error_info(mci, &info, 1);
 }
drivers/edac/e7xxx_edac.c +0 -1
index 75d7ce62b3be..497e710fca3d 100644
@@ -333,7 +333,6 @@ static void e7xxx_check(struct mem_ctl_info *mci)
 {
 	struct e7xxx_error_info info;
 
-	edac_dbg(3, "\n");
 	e7xxx_get_error_info(mci, &info);
 	e7xxx_process_error_info(mci, &info, 1);
 }
drivers/edac/i3000_edac.c +0 -1
index 5c1eea96230c..9065bc4386ff 100644
@@ -273,7 +273,6 @@ static void i3000_check(struct mem_ctl_info *mci)
 {
 	struct i3000_error_info info;
 
-	edac_dbg(1, "MC%d\n", mci->mc_idx);
 	i3000_get_error_info(mci, &info);
 	i3000_process_error_info(mci, &info, 1);
 }
drivers/edac/i3200_edac.c +0 -1
index a8988db6d423..afccdebf5ac1 100644
@@ -253,7 +253,6 @@ static void i3200_check(struct mem_ctl_info *mci)
 {
 	struct i3200_error_info info;
 
-	edac_dbg(1, "MC%d\n", mci->mc_idx);
 	i3200_get_and_clear_error_info(mci, &info);
 	i3200_process_error_info(mci, &info);
 }
drivers/edac/i5000_edac.c +1 -1
index 1a6f69c859ab..ba46057d4220 100644
@@ -765,7 +765,7 @@ static void i5000_clear_error(struct mem_ctl_info *mci)
 static void i5000_check_error(struct mem_ctl_info *mci)
 {
 	struct i5000_error_info info;
-	edac_dbg(4, "MC%d\n", mci->mc_idx);
+
 	i5000_get_error_info(mci, &info);
 	i5000_process_error_info(mci, &info, 1);
 }
drivers/edac/i5400_edac.c +1 -1
index 92d63eb533ae..f76624ee82ef 100644
@@ -686,7 +686,7 @@ static void i5400_clear_error(struct mem_ctl_info *mci)
 static void i5400_check_error(struct mem_ctl_info *mci)
 {
 	struct i5400_error_info info;
-	edac_dbg(4, "MC%d\n", mci->mc_idx);
+
 	i5400_get_error_info(mci, &info);
 	i5400_process_error_info(mci, &info);
 }
drivers/edac/i82443bxgx_edac.c +0 -1
index a2ca929e2168..933dcf3cfdff 100644
@@ -176,7 +176,6 @@ static void i82443bxgx_edacmc_check(struct mem_ctl_info *mci)
 {
 	struct i82443bxgx_edacmc_error_info info;
 
-	edac_dbg(1, "MC%d\n", mci->mc_idx);
 	i82443bxgx_edacmc_get_error_info(mci, &info);
 	i82443bxgx_edacmc_process_error_info(mci, &info, 1);
 }
drivers/edac/i82860_edac.c +0 -1
index 3e3a80ffb322..fbec90d00f1e 100644
@@ -135,7 +135,6 @@ static void i82860_check(struct mem_ctl_info *mci)
 {
 	struct i82860_error_info info;
 
-	edac_dbg(1, "MC%d\n", mci->mc_idx);
 	i82860_get_error_info(mci, &info);
 	i82860_process_error_info(mci, &info, 1);
 }
drivers/edac/i82875p_edac.c +0 -1
index ceac925af38c..553880b9fc12 100644
@@ -262,7 +262,6 @@ static void i82875p_check(struct mem_ctl_info *mci)
 {
 	struct i82875p_error_info info;
 
-	edac_dbg(1, "MC%d\n", mci->mc_idx);
 	i82875p_get_error_info(mci, &info);
 	i82875p_process_error_info(mci, &info, 1);
 }
drivers/edac/i82975x_edac.c +0 -1
index 6be99e0d850d..d99f005832cf 100644
@@ -330,7 +330,6 @@ static void i82975x_check(struct mem_ctl_info *mci)
 {
 	struct i82975x_error_info info;
 
-	edac_dbg(1, "MC%d\n", mci->mc_idx);
 	i82975x_get_error_info(mci, &info);
 	i82975x_process_error_info(mci, &info, 1);
 }
drivers/edac/ie31200_edac.c +0 -1
index c47963240b65..9a9ff5ad611a 100644
@@ -333,7 +333,6 @@ static void ie31200_check(struct mem_ctl_info *mci)
 {
 	struct ie31200_error_info info;
 
-	edac_dbg(1, "MC%d\n", mci->mc_idx);
 	ie31200_get_and_clear_error_info(mci, &info);
 	ie31200_process_error_info(mci, &info);
 }
drivers/edac/r82600_edac.c +0 -1
index 851e53e122aa..d0aef83dca2a 100644
@@ -204,7 +204,6 @@ static void r82600_check(struct mem_ctl_info *mci)
 {
 	struct r82600_error_info info;
 
-	edac_dbg(1, "MC%d\n", mci->mc_idx);
 	r82600_get_error_info(mci, &info);
 	r82600_process_error_info(mci, &info, 1);
 }
drivers/edac/x38_edac.c +0 -1
index a65e2f78a402..49ab5721aab2 100644
@@ -238,7 +238,6 @@ static void x38_check(struct mem_ctl_info *mci)
 {
 	struct x38_error_info info;
 
-	edac_dbg(1, "MC%d\n", mci->mc_idx);
 	x38_get_and_clear_error_info(mci, &info);
 	x38_process_error_info(mci, &info);
 }
Signature · 8 lines
2.21.0


-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
maintainer
#5 lore raw
In reply to Borislav Petkov
Quoted 6 lines · Borislav Petkov
Quoted 4 lines · Jason Baron

Yes, I likely was just following what was in other edac drivers at the time - for example, i3200_check() has a similar debug. I guess it could have a higher level. But if we remove this one, we may want to audit some of the other edac drivers as well.

Quoted 6 lines

Sounds good. So one patch removing them all would make sense. If you feel like doing it, be my guest. Otherwise, it'll land on my ever-growing todo. :-\

Thx.

Hi Boris,

I thought a bit about this - and was wondering if it made sense to hook the edac debug messages up to 'dynamic debug'. The idea is that different users may want different debug messages enabled, and this way they can control each message as desired. Jim (added to 'cc) recently exported 'ddebug_exec_queries()' to make that easier to do:
https://lore.kernel.org/lkml/[email protected]/

So, we would still continue to support edac_debug_level=N but the user would have additional control. I tried it out (below) and doesn't look too bad (at least to me).

Thanks,

-Jason

drivers/edac/Kconfig +1 -0
index 7a47680d6f07..0c1c97e42a63 100644
@@ -34,6 +34,7 @@ config EDAC_LEGACY_SYSFS
 config EDAC_DEBUG
 	bool "Debugging"
 	select DEBUG_FS
+	select DYNAMIC_DEBUG_CORE
 	help
 	  This turns on debugging information for the entire EDAC subsystem.
 	  You do so by inserting edac_module with "edac_debug_level=x." Valid
drivers/edac/Makefile +4 -0
index 3a849168780d..21ad452f1193 100644
@@ -8,6 +8,10 @@
 
 obj-$(CONFIG_EDAC)			:= edac_core.o
 
+ifdef CONFIG_EDAC_DEBUG
+ccflags-y += -DDYNAMIC_DEBUG_MODULE
+endif
+
 edac_core-y	:= edac_mc.o edac_device.o edac_mc_sysfs.o
 edac_core-y	+= edac_module.o edac_device_sysfs.o wq.o
 
drivers/edac/edac_mc.h +6 -5
index 881b00eadf7a..75dd4357d430 100644
@@ -48,6 +48,9 @@
 #define edac_printk(level, prefix, fmt, arg...) \
 	printk(level "EDAC " prefix ": " fmt, ##arg)
 
+#define edac_dbg_printk(level, prefix, fmt, arg...) \
+	pr_debug("EDAC " prefix #level ": " fmt, ##arg)
+
 #define edac_mc_printk(mci, level, fmt, arg...) \
 	printk(level "EDAC MC%d: " fmt, mci->mc_idx, ##arg)
 
@@ -70,11 +73,9 @@ extern const char * const edac_mem_types[];
 #ifdef CONFIG_EDAC_DEBUG
 extern int edac_debug_level;
 
-#define edac_dbg(level, fmt, ...)					\
-do {									\
-	if (level <= edac_debug_level)					\
-		edac_printk(KERN_DEBUG, EDAC_DEBUG,			\
-			    "%s: " fmt, __func__, ##__VA_ARGS__);	\
+#define edac_dbg(level, fmt, ...)					    \
+do {									    \
+	edac_dbg_printk(level, EDAC_DEBUG, "%s: " fmt, __func__, ##__VA_ARGS__);\
 } while (0)
 
 #else				/* !CONFIG_EDAC_DEBUG */
drivers/edac/edac_module.c +28 -4
index 32a931d0cb71..6109589858c0 100644
@@ -11,6 +11,7 @@
  *
  */
 #include <linux/edac.h>
+#include <linux/dynamic_debug.h>
 
 #include "edac_mc.h"
 #include "edac_module.h"
@@ -19,6 +20,29 @@
 
 #ifdef CONFIG_EDAC_DEBUG
 
+static int edac_debug_level_initialized;
+/* Values of 0 to 4 will generate output */
+int edac_debug_level = 2;
+EXPORT_SYMBOL_GPL(edac_debug_level);
+
+static void edac_set_dynamic_debug_level(int level)
+{
+	char buf[32];
+	int i;
+
+	edac_debug_level_initialized = 1;
+	for (i = 0; i <= 4; i++) {
+		snprintf(buf, 32, "format '^EDAC DEBUG%d' %cp", i, i <= level ? '+' : '-');
+		dynamic_debug_exec_queries(buf, NULL);
+	}
+}
+
+static void edac_set_debug_level_init(void)
+{
+	if (!edac_debug_level_initialized)
+		edac_set_dynamic_debug_level(edac_debug_level);
+}
+
 static int edac_set_debug_level(const char *buf,
 				const struct kernel_param *kp)
 {
@@ -32,13 +56,11 @@ static int edac_set_debug_level(const char *buf,
 	if (val > 4)
 		return -EINVAL;
 
+	edac_set_dynamic_debug_level(val);
+
 	return param_set_int(buf, kp);
 }
 
-/* Values of 0 to 4 will generate output */
-int edac_debug_level = 2;
-EXPORT_SYMBOL_GPL(edac_debug_level);
-
 module_param_call(edac_debug_level, edac_set_debug_level, param_get_int,
 		  &edac_debug_level, 0644);
 MODULE_PARM_DESC(edac_debug_level, "EDAC debug level: [0-4], default: 2");
@@ -130,6 +152,8 @@ static int __init edac_init(void)
 		goto err_wq;
 	}
 
+	edac_set_debug_level_init();
+
 	return 0;
 
 err_wq:
drivers/edac/edac_module.h +1 -0
index aa1f91688eb8..7f16428a266a 100644
@@ -99,6 +99,7 @@ static inline void edac_debugfs_create_x16(const char *name, umode_t mode,
 					   struct dentry *parent, u16 *value)	{ }
 static inline void edac_debugfs_create_x32(const char *name, umode_t mode,
 		       struct dentry *parent, u32 *value)			{ }
+static inline void edac_set_debug_level_init(void)				{ }
 #endif
 
 /*
maintainer
#6 lore raw

Hi,

Quoted 2 lines · Jason Baron

So, we would still continue to support edac_debug_level=N but the user would have additional control.

Do you have any actual users needing this? If yes, what are their use cases?

Because I have this aversion towards adding functionality just because and that it potentially might be useful and "users may want". Either they do and they want to use it for X or we don't do anything... yet.

In this particular example, those debug printks are just useless noise so off they go.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
maintainer
#7 lore raw
Quoted 9 lines · Borislav Petkov

Hi,

Quoted 2 lines · Jason Baron

So, we would still continue to support edac_debug_level=N but the user would have additional control.

Do you have any actual users needing this? If yes, what are their use cases?

Quoted 9 lines

Because I have this aversion towards adding functionality just because and that it potentially might be useful and "users may want". Either they do and they want to use it for X or we don't do anything... yet.

In this particular example, those debug printks are just useless noise so off they go.

Thx.

Hi Boris,

So I was motivated by this example, where if we had this facility, we could easily say just go turn off that specific print instead of wait for a new kernel. More generally, I think as you crank up the verbosity there may be more of a need to customize the debug information, but I don't have any specific use case in mind beyond that.

I was also curious if various subsystems would find this facility useful.

Thanks,

-Jason