From: alison.schofield@intel.com
To: Vishal Verma <vishal.l.verma@intel.com>
Cc: Alison Schofield <alison.schofield@intel.com>,
nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org,
Dave Jiang <dave.jiang@intel.com>
Subject: [ndctl PATCH v11 3/7] cxl/event_trace: support poison context in event parsing
Date: Wed, 13 Mar 2024 21:05:19 -0700 [thread overview]
Message-ID: <3ebea9e20c9d95095acec7469dd5d12216dcc444.1710386468.git.alison.schofield@intel.com> (raw)
In-Reply-To: <cover.1710386468.git.alison.schofield@intel.com>
From: Alison Schofield <alison.schofield@intel.com>
CXL event tracing provides helpers to iterate through a trace
buffer and extract events of interest. It offers two parsing
options: a default parser that adds every field of an event to
a json object, and a private parsing option where the caller can
parse each event as it wishes.
Although the private parser can do some conditional parsing based
on field values, it has no method to receive additional information
needed to make parsing decisions in the callback.
Provide additional information required by cxl_poison events by
adding a pointer to the poison_ctx directly the struct event_context.
Tidy-up the calling convention by passing the entire event_ctx to
it's own parse_event method rather than growing the param list.
This is in preparation for adding a private parser requiring the
additional context for cxl_poison events.
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
---
cxl/event_trace.c | 9 ++++-----
cxl/event_trace.h | 10 +++++++++-
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/cxl/event_trace.c b/cxl/event_trace.c
index 93a95f9729fd..640abdab67bf 100644
--- a/cxl/event_trace.c
+++ b/cxl/event_trace.c
@@ -60,7 +60,7 @@ static struct json_object *num_to_json(void *num, int elem_size, unsigned long f
}
static int cxl_event_to_json(struct tep_event *event, struct tep_record *record,
- struct list_head *jlist_head)
+ struct event_ctx *ctx)
{
struct json_object *jevent, *jobj, *jarray;
struct tep_format_field **fields;
@@ -190,7 +190,7 @@ static int cxl_event_to_json(struct tep_event *event, struct tep_record *record,
}
}
- list_add_tail(jlist_head, &jnode->list);
+ list_add_tail(&ctx->jlist_head, &jnode->list);
return 0;
err_jevent:
@@ -220,10 +220,9 @@ static int cxl_event_parse(struct tep_event *event, struct tep_record *record,
}
if (event_ctx->parse_event)
- return event_ctx->parse_event(event, record,
- &event_ctx->jlist_head);
+ return event_ctx->parse_event(event, record, event_ctx);
- return cxl_event_to_json(event, record, &event_ctx->jlist_head);
+ return cxl_event_to_json(event, record, event_ctx);
}
int cxl_parse_events(struct tracefs_instance *inst, struct event_ctx *ectx)
diff --git a/cxl/event_trace.h b/cxl/event_trace.h
index 7f7773b2201f..b77cafb410c4 100644
--- a/cxl/event_trace.h
+++ b/cxl/event_trace.h
@@ -11,13 +11,21 @@ struct jlist_node {
struct list_node list;
};
+struct poison_ctx {
+ struct json_object *jpoison;
+ struct cxl_region *region;
+ struct cxl_memdev *memdev;
+ unsigned long flags;
+};
+
struct event_ctx {
const char *system;
struct list_head jlist_head;
const char *event_name; /* optional */
int event_pid; /* optional */
+ struct poison_ctx *poison_ctx; /* optional */
int (*parse_event)(struct tep_event *event, struct tep_record *record,
- struct list_head *jlist_head); /* optional */
+ struct event_ctx *ctx);
};
int cxl_parse_events(struct tracefs_instance *inst, struct event_ctx *ectx);
--
2.37.3
next prev parent reply other threads:[~2024-03-14 4:05 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 4:05 [ndctl PATCH v11 0/7] Support poison list retrieval alison.schofield
2024-03-14 4:05 ` [ndctl PATCH v11 1/7] libcxl: add interfaces for GET_POISON_LIST mailbox commands alison.schofield
2024-03-18 17:51 ` fan
2024-03-18 20:11 ` Alison Schofield
2024-03-18 21:01 ` Dan Williams
2024-03-19 16:43 ` Alison Schofield
2024-03-14 4:05 ` [ndctl PATCH v11 2/7] cxl/event_trace: add an optional pid check to event parsing alison.schofield
2024-03-14 4:05 ` alison.schofield [this message]
2024-03-14 4:05 ` [ndctl PATCH v11 4/7] cxl/event_trace: add helpers to retrieve tep fields by type alison.schofield
2024-03-15 15:44 ` Dave Jiang
2024-03-15 17:39 ` Dan Williams
2024-03-18 17:28 ` Alison Schofield
2024-03-18 21:21 ` fan
2024-03-14 4:05 ` [ndctl PATCH v11 5/7] cxl/list: collect and parse media_error records alison.schofield
2024-03-15 16:16 ` Dave Jiang
2024-03-20 20:24 ` Alison Schofield
2024-03-14 4:05 ` [ndctl PATCH v11 6/7] cxl/list: add --media-errors option to cxl list alison.schofield
2024-03-15 1:09 ` Wonjae Lee
2024-03-15 2:36 ` Alison Schofield
2024-03-15 3:35 ` Dan Williams
2024-03-20 20:40 ` Alison Schofield
2024-03-27 19:48 ` Alison Schofield
2024-04-18 20:12 ` Alison Schofield
2024-03-15 16:41 ` Dave Jiang
2024-03-14 4:05 ` [ndctl PATCH v11 7/7] cxl/test: add cxl-poison.sh unit test alison.schofield
2024-03-15 17:03 ` Dave Jiang
2024-03-15 23:03 ` Wonjae Lee
2024-03-18 17:17 ` Alison Schofield
2024-03-20 20:42 ` [ndctl PATCH v11 0/7] Support poison list retrieval Alison Schofield
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ebea9e20c9d95095acec7469dd5d12216dcc444.1710386468.git.alison.schofield@intel.com \
--to=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox