Skip to contentSkip to conversation

RAS/AMD/FMPM: Fix build when debugfs is not enabled

PATCH In review Borislav Petkov 3 participants 8 messages Mar 25, 2024 – Mar 26, 2024

Subsystems (2)
lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

PATCH 1/1 RAS/AMD/FMPM: Fix build when debugfs is not enabled

From: "Borislav Petkov (AMD)" <[email protected]>

Have the driver depend on DEBUG_FS as it is useless without it.

Fixes 6f15e617cc99 ("RAS: Introduce a FRU memory poison manager")
Cc Yazen Ghannam <[email protected]>
---
 drivers/ras/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ras/Kconfig +1 -1
index fc4f4bb94a4c..41697e326fa6 100644
@@ -37,7 +37,7 @@ source "drivers/ras/amd/atl/Kconfig"
 config RAS_FMPM
 	tristate "FRU Memory Poison Manager"
 	default m
-	depends on AMD_ATL && ACPI_APEI
+	depends on AMD_ATL && ACPI_APEI && DEBUG_FS
 	help
 	  Support saving and restoring memory error information across reboot
 	  using ACPI ERST as persistent storage. Error information is saved with
Signature · 1 line
2.43.0
#1 lore raw
Quoted 3 lines · Borislav Petkov

From: "Borislav Petkov (AMD)" <[email protected]>

Have the driver depend on DEBUG_FS as it is useless without it.

This isn't true which is why the module doesn't fail to load if debugfs is not available.

Quoted 15 lines
Fixes 6f15e617cc99 ("RAS: Introduce a FRU memory poison manager")
Cc Yazen Ghannam <[email protected]>
---
  drivers/ras/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ras/Kconfig +0 -0
index fc4f4bb94a4c..41697e326fa6 100644

drivers/ras/Kconfig source "drivers/ras/amd/atl/Kconfig" · line 40

Quoted 5 lines
drivers/ras/Kconfig +1 -1
@@ -37,7 +37,7 @@ source "drivers/ras/amd/atl/Kconfig"
  config RAS_FMPM
  	tristate "FRU Memory Poison Manager"
  	default m
-	depends on AMD_ATL && ACPI_APEI
+	depends on AMD_ATL && ACPI_APEI && DEBUG_FS

This was my first thought too. However, besides not true as stated above, this also leaves the issue open for others to hit.

I think the fix below (not tested) would be more appropriate.

What do you think?

Thanks,
Yazen

drivers/ras/debugfs.h +4 -0
index 4749ccdeeba1..ab95831e7710 100644
@@ -4,6 +4,10 @@
 
 #include <linux/debugfs.h>
 
+#if IS_ENABLED(DEBUG_FS)
 struct dentry *ras_get_debugfs_root(void);
+#else
+static inline struct dentry *ras_get_debugfs_root(void) { return NULL; }
+#endif /* DEBUG_FS */
 
 #endif /* __RAS_DEBUGFS_H__ */
author maintainer
#2 lore raw
Quoted 2 lines · Yazen Ghannam

This isn't true which is why the module doesn't fail to load if debugfs is not available.

How useful is this thing really without debugfs to dump records?

Quoted 2 lines

This was my first thought too. However, besides not true as stated above, this also leaves the issue open for others to hit.

The others to hit? I don't get that part.

Quoted 3 lines

I think the fix below (not tested) would be more appropriate.

What do you think?

Sure, remove my fix and send me a tested version of yours and I'll swap them if the driver is useful without debugfs...

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#3 lore raw
Quoted 6 lines · Borislav Petkov
Quoted 2 lines · Yazen Ghannam

This isn't true which is why the module doesn't fail to load if debugfs is not available.

How useful is this thing really without debugfs to dump records?

The goal of the module is to save and restore records across reboots.

The debugfs thing came later and the commit message states that it is optional.

7d19eea51757 ("RAS/AMD/FMPM: Add debugfs interface to print record entries")

Quoted 5 lines
Quoted 2 lines

This was my first thought too. However, besides not true as stated above, this also leaves the issue open for others to hit.

The others to hit? I don't get that part.

Sorry, I mean that if there's another user of ras_get_debugfs_root() that doesn't depend on CONFIG_DEBUG_FS.

Quoted 6 lines
Quoted 3 lines

I think the fix below (not tested) would be more appropriate.

What do you think?

Sure, remove my fix and send me a tested version of yours and I'll swap them if the driver is useful without debugfs...

Okay, will do.

Thanks,
Yazen

author maintainer
#4 lore raw
Quoted 1 line · Yazen Ghannam

The goal of the module is to save and restore records across reboots.

I guess... although when you think about it, you'd want to dump records and see what got restored. But ok, strictly speaking, I guess debugfs is optional...

Quoted 2 lines

Sorry, I mean that if there's another user of ras_get_debugfs_root() that doesn't depend on CONFIG_DEBUG_FS.

That is true.

Quoted 1 line

Okay, will do.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#5 lore raw
In reply to Yazen Ghannam
Quoted 59 lines · Yazen Ghannam
Quoted 3 lines · Borislav Petkov

From: "Borislav Petkov (AMD)" [email protected]

Have the driver depend on DEBUG_FS as it is useless without it.

This isn't true which is why the module doesn't fail to load if debugfs is not available.

Quoted 14 lines
Fixes 6f15e617cc99 ("RAS: Introduce a FRU memory poison manager")
Cc Yazen Ghannam [email protected]

---
drivers/ras/Kconfig | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ras/Kconfig +0 -0
index fc4f4bb94a4c..41697e326fa6 100644
@@ -37,7 +37,7 @@ source "drivers/ras/amd/atl/Kconfig"
Quoted 5 lines

config RAS_FMPM
tristate "FRU Memory Poison Manager" default m
- depends on AMD_ATL && ACPI_APEI
+ depends on AMD_ATL && ACPI_APEI && DEBUG_FS

This was my first thought too. However, besides not true as stated above, this also leaves the issue open for others to hit.

I think the fix below (not tested) would be more appropriate.

What do you think?

Thanks,
Yazen

drivers/ras/debugfs.h +4 -0
index 4749ccdeeba1..ab95831e7710 100644
@@ -4,6 +4,10 @@
 
 #include <linux/debugfs.h>
 
 
+#if IS_ENABLED(DEBUG_FS)
 struct dentry *ras_get_debugfs_root(void);
+#else
+static inline struct dentry ras_get_debugfs_root(void) { return NULL; }
+#endif / DEBUG_FS /
 
Quoted 1 line

#endif / RAS_DEBUGFS_H */

this also works, just tested

this time round, make oldconfig asks if i want to build RAS_FMPM, i built it as module, compilation succeeds.

thanks

kind regards,
anthony s.k.

#6 lore raw

On 3/26/24 10:20, A wrote:
[...]

Quoted 16 lines
Quoted 16 lines
drivers/ras/debugfs.h +4 -0
index 4749ccdeeba1..ab95831e7710 100644
@@ -4,6 +4,10 @@
 
 #include <linux/debugfs.h>
 
 
+#if IS_ENABLED(DEBUG_FS)
 struct dentry *ras_get_debugfs_root(void);
+#else
+static inline struct dentry ras_get_debugfs_root(void) { return NULL; }
+#endif / DEBUG_FS /
 
Quoted 6 lines
Quoted 1 line

#endif / RAS_DEBUGFS_H */

this also works, just tested

this time round, make oldconfig asks if i want to build RAS_FMPM, i built it as module, compilation succeeds.

Thanks for testing!

Would you mind including your "Tested-by" tag? I can include this when I send a proper patch.

Thanks,
Yazen

#7 lore raw
Quoted 26 lines · Yazen Ghannam

On 3/26/24 10:20, A wrote:
[...]

Quoted 14 lines
Quoted 14 lines
drivers/ras/debugfs.h +4 -0
index 4749ccdeeba1..ab95831e7710 100644
@@ -4,6 +4,10 @@
 
 #include <linux/debugfs.h>
 
+#if IS_ENABLED(DEBUG_FS)
 struct dentry *ras_get_debugfs_root(void);
+#else
+static inline struct dentry ras_get_debugfs_root(void) { return NULL; }
+#endif / DEBUG_FS /
 
Quoted 5 lines

drivers/ras/debugfs.h line 13

Quoted 1 line
drivers/ras/debugfs.h +0 -0
 #endif / RAS_DEBUGFS_H */

this also works, just tested

this time round, make oldconfig asks if i want to build RAS_FMPM, i built it as module, compilation succeeds.

Quoted 7 lines

Thanks for testing!

Would you mind including your "Tested-by" tag? I can include this when I send a proper patch.

Thanks,
Yazen

sure, tested-by: anthony s. knowles <[email protected]>

kind regards,
a.s.k