Linux CXL
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>,
	nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Subject: Re: [ndctl PATCH v5 3/5] cxl/list: collect and parse the poison list records
Date: Tue, 12 Dec 2023 18:13:42 -0800	[thread overview]
Message-ID: <ZXkTVgFroObfs4kW@aschofie-mobl2> (raw)
In-Reply-To: <65714c6b472ee_269bd29417@dwillia2-mobl3.amr.corp.intel.com.notmuch>

On Wed, Dec 06, 2023 at 08:39:07PM -0800, Dan Williams wrote:
> alison.schofield@ wrote:
> > From: Alison Schofield <alison.schofield@intel.com>
> > 

snip

> > +	struct json_object *jerrors, *jpoison, *jobj = NULL;
> > +	struct jlist_node *jnode, *next;
> > +	struct event_ctx ectx = {
> > +		.event_name = "cxl_poison",
> > +		.event_pid = getpid(),
> > +		.system = "cxl",
> > +	};
> > +	int rc, count = 0;
> > +
> > +	list_head_init(&ectx.jlist_head);
> > +	rc = cxl_parse_events(inst, &ectx);
> 
> This pattern really feels like it wants a cxl_for_each_event() -style
> helper rather than require the end caller to open code list usage.
> Basically cxl_parse_events() is a helper that should stay local to
> cxl/monitor.c. This new cxl_for_each_event() would become used
> internally by cxl_parse_events() and let
> util_cxl_poison_events_to_json() do its own per-event iteration.
> 

snip & concat'ing your next comment:

> So we're building a json_object internal to cxl_parse_events() only to
> turn around and extract details out of that object that tell us this
> event was not of interest, or to create yet another json object?
> 
> I think this implementation has a chance to be significantly less
> complicated if the event list can be iterated directly without this
> temporary json_object parsing.

DaveJ actually already implemented a method to include a 'private'
parsing function in the event_ctx structure. I didn't use it, but
but rather used the generic cxl_event_to_json helper, and then
parsed that all over again to refine for poison list output.

I think reorganizing w a private event_ctx->parse_event will
streamline as you suggest.

Alison

  reply	other threads:[~2023-12-13  2:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22  1:22 [ndctl PATCH v5 0/5] Support poison list retrieval alison.schofield
2023-11-22  1:22 ` [ndctl PATCH v5 1/5] libcxl: add interfaces for GET_POISON_LIST mailbox commands alison.schofield
2023-11-22  1:22 ` [ndctl PATCH v5 2/5] cxl: add an optional pid check to event parsing alison.schofield
2023-11-22  1:22 ` [ndctl PATCH v5 3/5] cxl/list: collect and parse the poison list records alison.schofield
2023-12-07  4:39   ` Dan Williams
2023-12-13  2:13     ` Alison Schofield [this message]
2023-11-22  1:22 ` [ndctl PATCH v5 4/5] cxl/list: add --poison option to cxl list alison.schofield
2023-12-07  4:23   ` Dan Williams
2023-12-13  0:34     ` Tsaur, Erwin
2023-12-13  2:02     ` Alison Schofield
2023-11-22  1:22 ` [ndctl PATCH v5 5/5] cxl/test: add cxl-poison.sh unit test 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=ZXkTVgFroObfs4kW@aschofie-mobl2 \
    --to=alison.schofield@intel.com \
    --cc=dan.j.williams@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