alison.schofield@ wrote:
> From: Alison Schofield <[email protected]>
>
> Media_error records are logged as events in the kernel tracing
> subsystem. To prepare the media_error records for cxl list, enable
> tracing, trigger the poison list read, and parse the generated
> cxl_poison events into a json representation.
>
> Use the event_trace private parsing option to customize the json
> representation based on cxl-list calling options and event field
> settings.
>
> Signed-off-by: Alison Schofield <[email protected]>
> ---
> cxl/json.c | 257 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 257 insertions(+)
This look clean to me, just the comment on translating dpa and hpa to
offset depending on which object the list is being parsed against.
Also the note below about using container_of() in ->parse_event() to get
back to private context data.
>
> +static struct json_object *
> +util_cxl_poison_events_to_json(struct tracefs_instance *inst,
> + struct poison_ctx *p_ctx)
> +{
> + struct event_ctx ectx = {
> + .event_name = "cxl_poison",
> + .event_pid = getpid(),
> + .system = "cxl",
> + .private_ctx = p_ctx,
> + .parse_event = poison_event_to_json,
> + };
Looks like you could definitely embed an event_ctx in poison_ctx and
skip the need for private_ctx in event_ctx.