|
|
26ccd9 |
From 2a43dce3913b392a13a5ee918c8ee831a25d720e Mon Sep 17 00:00:00 2001
|
|
|
26ccd9 |
From: Dan Williams <dan.j.williams@intel.com>
|
|
|
26ccd9 |
Date: Sun, 23 Jan 2022 16:53:24 -0800
|
|
|
26ccd9 |
Subject: [PATCH 104/217] cxl/list: Add --debug option
|
|
|
26ccd9 |
|
|
|
26ccd9 |
Add an option to turn on libray and cxl_filter_walk() messages. Gate it
|
|
|
26ccd9 |
based on the global ENABLE_DEBUG configuration setting.
|
|
|
26ccd9 |
|
|
|
26ccd9 |
Link: https://lore.kernel.org/r/164298560409.3021641.11040422738199381922.stgit@dwillia2-desk3.amr.corp.intel.com
|
|
|
26ccd9 |
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
|
|
|
26ccd9 |
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
|
|
26ccd9 |
---
|
|
|
26ccd9 |
Documentation/cxl/cxl-list.txt | 6 ++++--
|
|
|
26ccd9 |
cxl/filter.c | 3 +++
|
|
|
26ccd9 |
cxl/list.c | 9 +++++++++
|
|
|
26ccd9 |
3 files changed, 16 insertions(+), 2 deletions(-)
|
|
|
26ccd9 |
|
|
|
26ccd9 |
diff --git a/Documentation/cxl/cxl-list.txt b/Documentation/cxl/cxl-list.txt
|
|
|
26ccd9 |
index 3076deb..42b6de6 100644
|
|
|
26ccd9 |
--- a/Documentation/cxl/cxl-list.txt
|
|
|
26ccd9 |
+++ b/Documentation/cxl/cxl-list.txt
|
|
|
26ccd9 |
@@ -200,9 +200,11 @@ OPTIONS
|
|
|
26ccd9 |
descendants of the individual ports that match the filter. By default
|
|
|
26ccd9 |
all descendant objects are listed.
|
|
|
26ccd9 |
|
|
|
26ccd9 |
-include::human-option.txt[]
|
|
|
26ccd9 |
+--debug::
|
|
|
26ccd9 |
+ If the cxl tool was built with debug enabled, turn on debug
|
|
|
26ccd9 |
+ messages.
|
|
|
26ccd9 |
|
|
|
26ccd9 |
-include::verbose-option.txt[]
|
|
|
26ccd9 |
+include::human-option.txt[]
|
|
|
26ccd9 |
|
|
|
26ccd9 |
include::../copyright.txt[]
|
|
|
26ccd9 |
|
|
|
26ccd9 |
diff --git a/cxl/filter.c b/cxl/filter.c
|
|
|
26ccd9 |
index 8b79db3..32171a4 100644
|
|
|
26ccd9 |
--- a/cxl/filter.c
|
|
|
26ccd9 |
+++ b/cxl/filter.c
|
|
|
26ccd9 |
@@ -387,6 +387,7 @@ int cxl_filter_walk(struct cxl_ctx *ctx, struct cxl_filter_params *p)
|
|
|
26ccd9 |
if (!jports)
|
|
|
26ccd9 |
goto err;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
+ dbg(p, "walk memdevs\n");
|
|
|
26ccd9 |
cxl_memdev_foreach(ctx, memdev) {
|
|
|
26ccd9 |
struct json_object *jdev;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
@@ -403,6 +404,7 @@ int cxl_filter_walk(struct cxl_ctx *ctx, struct cxl_filter_params *p)
|
|
|
26ccd9 |
}
|
|
|
26ccd9 |
}
|
|
|
26ccd9 |
|
|
|
26ccd9 |
+ dbg(p, "walk buses\n");
|
|
|
26ccd9 |
cxl_bus_foreach(ctx, bus) {
|
|
|
26ccd9 |
struct json_object *jbus = NULL;
|
|
|
26ccd9 |
struct json_object *jchildports = NULL;
|
|
|
26ccd9 |
@@ -431,6 +433,7 @@ int cxl_filter_walk(struct cxl_ctx *ctx, struct cxl_filter_params *p)
|
|
|
26ccd9 |
}
|
|
|
26ccd9 |
}
|
|
|
26ccd9 |
walk_children:
|
|
|
26ccd9 |
+ dbg(p, "walk ports\n");
|
|
|
26ccd9 |
walk_child_ports(port, p, pick_array(jchildports, jports),
|
|
|
26ccd9 |
flags);
|
|
|
26ccd9 |
cond_add_put_array_suffix(jbus, "ports", devname, jchildports);
|
|
|
26ccd9 |
diff --git a/cxl/list.c b/cxl/list.c
|
|
|
26ccd9 |
index 1ef91b4..01ab19b 100644
|
|
|
26ccd9 |
--- a/cxl/list.c
|
|
|
26ccd9 |
+++ b/cxl/list.c
|
|
|
26ccd9 |
@@ -13,6 +13,7 @@
|
|
|
26ccd9 |
#include "filter.h"
|
|
|
26ccd9 |
|
|
|
26ccd9 |
static struct cxl_filter_params param;
|
|
|
26ccd9 |
+static bool debug;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
static const struct option options[] = {
|
|
|
26ccd9 |
OPT_STRING('m', "memdev", ¶m.memdev_filter, "memory device name(s)",
|
|
|
26ccd9 |
@@ -35,6 +36,9 @@ static const struct option options[] = {
|
|
|
26ccd9 |
"use human friendly number formats "),
|
|
|
26ccd9 |
OPT_BOOLEAN('H', "health", ¶m.health,
|
|
|
26ccd9 |
"include memory device health information "),
|
|
|
26ccd9 |
+#ifdef ENABLE_DEBUG
|
|
|
26ccd9 |
+ OPT_BOOLEAN(0, "debug", &debug, "debug list walk"),
|
|
|
26ccd9 |
+#endif
|
|
|
26ccd9 |
OPT_END(),
|
|
|
26ccd9 |
};
|
|
|
26ccd9 |
|
|
|
26ccd9 |
@@ -84,9 +88,14 @@ int cmd_list(int argc, const char **argv, struct cxl_ctx *ctx)
|
|
|
26ccd9 |
}
|
|
|
26ccd9 |
|
|
|
26ccd9 |
log_init(¶m.ctx, "cxl list", "CXL_LIST_LOG");
|
|
|
26ccd9 |
+ if (debug) {
|
|
|
26ccd9 |
+ cxl_set_log_priority(ctx, LOG_DEBUG);
|
|
|
26ccd9 |
+ param.ctx.log_priority = LOG_DEBUG;
|
|
|
26ccd9 |
+ }
|
|
|
26ccd9 |
|
|
|
26ccd9 |
if (cxl_filter_has(param.port_filter, "root") && param.ports)
|
|
|
26ccd9 |
param.buses = true;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
+ dbg(¶m, "walk topology\n");
|
|
|
26ccd9 |
return cxl_filter_walk(ctx, ¶m;;
|
|
|
26ccd9 |
}
|
|
|
26ccd9 |
--
|
|
|
26ccd9 |
2.27.0
|
|
|
26ccd9 |
|