[PATCH] APEI: GHES: Replace log_non_standard_event with direct tracepoint call

Shubhrajyoti Datta posted 1 patch 2 days ago
drivers/acpi/apei/ghes.c | 7 ++++---
drivers/ras/ras.c        | 7 -------
include/linux/ras.h      | 8 --------
3 files changed, 4 insertions(+), 18 deletions(-)
[PATCH] APEI: GHES: Replace log_non_standard_event with direct tracepoint call
Posted by Shubhrajyoti Datta 2 days ago
Simplify non-standard RAS event logging by replacing
log_non_standard_event() with a direct call to trace_non_standard_event()
in the GHES error handler. Remove the redundant wrapper from the RAS
subsystem to reduce indirection.

Suggested-by: Borislav Petkov  <bp@alien8.de>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---
discurssion link
https://lore.kernel.org/all/20250901151658.GBaLW46ibJuf4kGgnl@fat_crate.local/

 drivers/acpi/apei/ghes.c | 7 ++++---
 drivers/ras/ras.c        | 7 -------
 include/linux/ras.h      | 8 --------
 3 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index a0d54993edb3..43896a476fd7 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -921,9 +921,10 @@ static void ghes_do_proc(struct ghes *ghes,
 			void *err = acpi_hest_get_payload(gdata);
 
 			ghes_defer_non_standard_event(gdata, sev);
-			log_non_standard_event(sec_type, fru_id, fru_text,
-					       sec_sev, err,
-					       gdata->error_data_length);
+			if (IS_ENABLED(CONFIG_RAS))
+				trace_non_standard_event(sec_type, fru_id, fru_text,
+							 sec_sev, err,
+							 gdata->error_data_length);
 		}
 	}
 
diff --git a/drivers/ras/ras.c b/drivers/ras/ras.c
index a6e4792a1b2e..d51c546c2606 100644
--- a/drivers/ras/ras.c
+++ b/drivers/ras/ras.c
@@ -45,13 +45,6 @@ EXPORT_SYMBOL_GPL(amd_convert_umc_mca_addr_to_sys_addr);
 #define TRACE_INCLUDE_PATH ../../include/ras
 #include <ras/ras_event.h>
 
-void log_non_standard_event(const guid_t *sec_type, const guid_t *fru_id,
-			    const char *fru_text, const u8 sev, const u8 *err,
-			    const u32 len)
-{
-	trace_non_standard_event(sec_type, fru_id, fru_text, sev, err, len);
-}
-
 void log_arm_hw_error(struct cper_sec_proc_arm *err)
 {
 	trace_arm_event(err);
diff --git a/include/linux/ras.h b/include/linux/ras.h
index a64182bc72ad..4bd3ef7ca6d8 100644
--- a/include/linux/ras.h
+++ b/include/linux/ras.h
@@ -21,18 +21,10 @@ int __init parse_cec_param(char *str);
 #endif
 
 #ifdef CONFIG_RAS
-void log_non_standard_event(const guid_t *sec_type,
-			    const guid_t *fru_id, const char *fru_text,
-			    const u8 sev, const u8 *err, const u32 len);
 void log_arm_hw_error(struct cper_sec_proc_arm *err);
 
 #else
 static inline void
-log_non_standard_event(const guid_t *sec_type,
-		       const guid_t *fru_id, const char *fru_text,
-		       const u8 sev, const u8 *err, const u32 len)
-{ return; }
-static inline void
 log_arm_hw_error(struct cper_sec_proc_arm *err) { return; }
 #endif
 
-- 
2.17.1
Re: [PATCH] APEI: GHES: Replace log_non_standard_event with direct tracepoint call
Posted by Borislav Petkov 6 hours ago
On Sat, Sep 06, 2025 at 08:33:07PM +0530, Shubhrajyoti Datta wrote:
> Simplify non-standard RAS event logging by replacing
> log_non_standard_event() with a direct call to trace_non_standard_event()
> in the GHES error handler. Remove the redundant wrapper from the RAS
> subsystem to reduce indirection.

But if you remove the ifdeffery in ras.h you have to do if
(IS_ENABLED(CONFIG_RAS)) now. Instead of simply calling the function
unconditionally without silly conditionals.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette