@@ -200,9 +200,11 @@ OPTIONS
descendants of the individual ports that match the filter. By default
all descendant objects are listed.
-include::human-option.txt[]
+--debug::
+ If the cxl tool was built with debug enabled, turn on debug
+ messages.
-include::verbose-option.txt[]
+include::human-option.txt[]
include::../copyright.txt[]
@@ -387,6 +387,7 @@ int cxl_filter_walk(struct cxl_ctx *ctx, struct cxl_filter_params *p)
if (!jports)
goto err;
+ dbg(p, "walk memdevs\n");
cxl_memdev_foreach(ctx, memdev) {
struct json_object *jdev;
@@ -403,6 +404,7 @@ int cxl_filter_walk(struct cxl_ctx *ctx, struct cxl_filter_params *p)
}
}
+ dbg(p, "walk buses\n");
cxl_bus_foreach(ctx, bus) {
struct json_object *jbus = NULL;
struct json_object *jchildports = NULL;
@@ -431,6 +433,7 @@ int cxl_filter_walk(struct cxl_ctx *ctx, struct cxl_filter_params *p)
}
}
walk_children:
+ dbg(p, "walk ports\n");
walk_child_ports(port, p, pick_array(jchildports, jports),
flags);
cond_add_put_array_suffix(jbus, "ports", devname, jchildports);
@@ -13,6 +13,7 @@
#include "filter.h"
static struct cxl_filter_params param;
+static bool debug;
static const struct option options[] = {
OPT_STRING('m', "memdev", ¶m.memdev_filter, "memory device name(s)",
@@ -35,6 +36,9 @@ static const struct option options[] = {
"use human friendly number formats "),
OPT_BOOLEAN('H', "health", ¶m.health,
"include memory device health information "),
+#ifdef ENABLE_DEBUG
+ OPT_BOOLEAN(0, "debug", &debug, "debug list walk"),
+#endif
OPT_END(),
};
@@ -84,9 +88,14 @@ int cmd_list(int argc, const char **argv, struct cxl_ctx *ctx)
}
log_init(¶m.ctx, "cxl list", "CXL_LIST_LOG");
+ if (debug) {
+ cxl_set_log_priority(ctx, LOG_DEBUG);
+ param.ctx.log_priority = LOG_DEBUG;
+ }
if (cxl_filter_has(param.port_filter, "root") && param.ports)
param.buses = true;
+ dbg(¶m, "walk topology\n");
return cxl_filter_walk(ctx, ¶m);
}
Add an option to turn on libray and cxl_filter_walk() messages. Gate it based on the global ENABLE_DEBUG configuration setting. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- Documentation/cxl/cxl-list.txt | 6 ++++-- cxl/filter.c | 3 +++ cxl/list.c | 9 +++++++++ 3 files changed, 16 insertions(+), 2 deletions(-)