Re: [PATCH V16 09/11] ras: acpi / apei: generate trace event for unrecognized CPER section

2017-05-16 Thread Borislav Petkov
On Mon, May 15, 2017 at 03:27:58PM -0600, Tyler Baicar wrote:
> The UEFI spec includes non-standard section type support in the
> Common Platform Error Record. This is defined in section N.2.3 of
> UEFI version 2.5.
> 
> Currently if the CPER section's type (UUID) does not match any
> section type that the kernel knows how to parse, a trace event is
> not generated.
> 
> Generate a trace event which contains the raw error data for
> non-standard section type error records.
> 
> Signed-off-by: Tyler Baicar 
> CC: Jonathan (Zhixiong) Zhang 
> Tested-by: Shiju Jose 
> ---
>  drivers/acpi/apei/ghes.c  | 27 +++
>  drivers/ras/ras.c |  9 +
>  include/linux/ras.h   | 12 
>  include/ras/ras_event.h   | 45 +
>  include/uapi/linux/uuid.h |  6 --
>  5 files changed, 93 insertions(+), 6 deletions(-)

This patch doesn't apply cleanly against 4.12-rc1. Please rediff it.

> diff --git a/drivers/ras/ras.c b/drivers/ras/ras.c
> index b67dd36..57363be 100644
> --- a/drivers/ras/ras.c
> +++ b/drivers/ras/ras.c
> @@ -7,11 +7,19 @@
>  
>  #include 
>  #include 
> +#include 
>  
>  #define CREATE_TRACE_POINTS
>  #define TRACE_INCLUDE_PATH ../../include/ras
>  #include 
>  
> +void call_non_standard_trace_event(const uuid_le *sec_type,

You are not calling a non-standard trace event - you're logging it:

log_non_standard_event()

> +  const uuid_le *fru_id, const char *fru_text, const u8 sev,
> +  const u8 *err, const u32 len)

Align arguments at opening brace.

> +{
> + trace_non_standard_event(sec_type, fru_id, fru_text, sev, err, len);
> +}
> +
>  static int __init ras_init(void)
>  {
>   int rc = 0;

-- 
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
___
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm


[PATCH V16 09/11] ras: acpi / apei: generate trace event for unrecognized CPER section

2017-05-15 Thread Tyler Baicar
The UEFI spec includes non-standard section type support in the
Common Platform Error Record. This is defined in section N.2.3 of
UEFI version 2.5.

Currently if the CPER section's type (UUID) does not match any
section type that the kernel knows how to parse, a trace event is
not generated.

Generate a trace event which contains the raw error data for
non-standard section type error records.

Signed-off-by: Tyler Baicar 
CC: Jonathan (Zhixiong) Zhang 
Tested-by: Shiju Jose 
---
 drivers/acpi/apei/ghes.c  | 27 +++
 drivers/ras/ras.c |  9 +
 include/linux/ras.h   | 12 
 include/ras/ras_event.h   | 45 +
 include/uapi/linux/uuid.h |  6 --
 5 files changed, 93 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 1a9240b..1106722 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -45,11 +45,14 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include "apei-internal.h"
 
@@ -460,12 +463,22 @@ static void ghes_do_proc(struct ghes *ghes,
 {
int sev, sec_sev;
struct acpi_hest_generic_data *gdata;
+   uuid_le sec_type;
+   uuid_le *fru_id = _UUID_LE;
+   char *fru_text = "";
 
sev = ghes_severity(estatus->error_severity);
apei_estatus_for_each_section(estatus, gdata) {
sec_sev = ghes_severity(gdata->error_severity);
-   if (!uuid_le_cmp(*(uuid_le *)gdata->section_type,
-CPER_SEC_PLATFORM_MEM)) {
+   sec_type = *(uuid_le *)gdata->section_type;
+
+   if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID)
+   fru_id = (uuid_le *)gdata->fru_id;
+
+   if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT)
+   fru_text = gdata->fru_text;
+
+   if (!uuid_le_cmp(sec_type, CPER_SEC_PLATFORM_MEM)) {
struct cper_sec_mem_err *mem_err = 
acpi_hest_get_payload(gdata);
 
ghes_edac_report_mem_error(ghes, sev, mem_err);
@@ -474,8 +487,7 @@ static void ghes_do_proc(struct ghes *ghes,
ghes_handle_memory_failure(gdata, sev);
}
 #ifdef CONFIG_ACPI_APEI_PCIEAER
-   else if (!uuid_le_cmp(*(uuid_le *)gdata->section_type,
- CPER_SEC_PCIE)) {
+   else if (!uuid_le_cmp(sec_type, CPER_SEC_PCIE)) {
struct cper_sec_pcie *pcie_err = 
acpi_hest_get_payload(gdata);
 
if (sev == GHES_SEV_RECOVERABLE &&
@@ -506,6 +518,13 @@ static void ghes_do_proc(struct ghes *ghes,
 
}
 #endif
+   else {
+   void *err = acpi_hest_get_payload(gdata);
+
+   call_non_standard_trace_event(_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 b67dd36..57363be 100644
--- a/drivers/ras/ras.c
+++ b/drivers/ras/ras.c
@@ -7,11 +7,19 @@
 
 #include 
 #include 
+#include 
 
 #define CREATE_TRACE_POINTS
 #define TRACE_INCLUDE_PATH ../../include/ras
 #include 
 
+void call_non_standard_trace_event(const uuid_le *sec_type,
+const uuid_le *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);
+}
+
 static int __init ras_init(void)
 {
int rc = 0;
@@ -27,3 +35,4 @@ static int __init ras_init(void)
 EXPORT_TRACEPOINT_SYMBOL_GPL(extlog_mem_event);
 #endif
 EXPORT_TRACEPOINT_SYMBOL_GPL(mc_event);
+EXPORT_TRACEPOINT_SYMBOL_GPL(non_standard_event);
diff --git a/include/linux/ras.h b/include/linux/ras.h
index 2aceeaf..7d397a1 100644
--- a/include/linux/ras.h
+++ b/include/linux/ras.h
@@ -1,6 +1,8 @@
 #ifndef __RAS_H__
 #define __RAS_H__
 
+#include 
+
 #ifdef CONFIG_DEBUG_FS
 int ras_userspace_consumers(void);
 void ras_debugfs_init(void);
@@ -11,4 +13,14 @@
 static inline int ras_add_daemon_trace(void) { return 0; }
 #endif
 
+#ifdef CONFIG_RAS
+void call_non_standard_trace_event(const uuid_le *sec_type,
+const uuid_le *fru_id, const char *fru_text, const u8 sev,
+const u8 *err, const u32 len);
+#else
+static void call_non_standard_trace_event(const uuid_le *sec_type,
+const uuid_le *fru_id, const char *fru_text, const u8 sev,
+const u8 *err, const u32 len) { return; }
+#endif
+
 #endif
diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h
index 1791a12..4f79ba9 100644
--- a/include/ras/ras_event.h
+++