Re: [PATCH 4/4] ras/events: Trace CXL CPER events even without the CXL stack loaded

From: Dan Williams
Date: Fri Mar 01 2024 - 17:00:14 EST


Ira Weiny wrote:
> If CXL is solely managed by firmware (including HDM configuration and
> event processing via firmware first) it is possible to run the system
> without the CXL software loaded. In this case no CXL callback will be
> loaded and CXL CPER errors will not be processed at all.
>
> In this case memory device and region (HPA) information is missing but
> omitting the error completely is not friendly for such a user. Some
> device information is available in the generic event which could prove
> useful to a user.
>
> Utilize the local work item to trace a generic CXL CPER event.
>
> Duplicate the pattern of decoding the CXL event header to aid in adding
> future trace points if needed. This was an easy lift from the CXL trace
> points. But stop at header decoding only because this is an unlikely
> configuration for the system. Further decoding can be obtained with
> user space tools or added later if needed.
>
> Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>
> Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
> Cc: Tony Luck <tony.luck@xxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Suggested-by: Dan Williams <dan.j.williams@xxxxxxxxx>
> Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> ---
> drivers/acpi/apei/ghes.c | 5 ++-
> include/ras/ras_event.h | 90 ++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 94 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index f433f4eae888..9ac323cbf195 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -729,7 +729,10 @@ static void cxl_cper_local_fn(struct work_struct *work)
>
> while (kfifo_out_spinlocked(&cxl_cper_fifo, &wd, 1,
> &cxl_cper_read_lock)) {
> - /* drop msg */
> + struct cxl_cper_event_rec *rec = &wd.rec;
> + union cxl_event *evt = &rec->event;
> +
> + trace_cper_cxl_gen_event(rec, &evt->generic);

So it was confusing to read the empty stub function 2 patches back when this
change was coming, and basic reporting of CXL event does not need the
workqueue indirection. Note that EDAC triggers trace events directly in
the atomic notifier chain, so CXL could do the same.

> static DECLARE_WORK(cxl_local_work, cxl_cper_local_fn);
> diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h
> index cbd3ddd7c33d..319faf552b65 100644
> --- a/include/ras/ras_event.h
> +++ b/include/ras/ras_event.h

This is more heavywieght than I was expecting and defeats the purpose of
centralizing advanced decode in the CXL driver itself.

I would expect this to be just the tracing equivalent of the
ignore_section logic in cper_estatus_print_section().