cxl/list: remove libtracefs build dependency for --media-errors
Alison Schofield
maintainerPATCH v3 1/1 cxl/list: remove libtracefs build dependency for --media-errors
When the --media-errors option was added to cxl list it inadvertently changed the optional libtracefs requirement into a mandatory one. Ndctl versions 80,81,82 no longer build without libtracefs.
Remove that dependency.
When libtracefs is disabled the user will see a this message logged to stderr:
$ cxl list -r region0 --media-errors --targets cxl list: --media-errors support disabled at build time
...followed by the region listing including the output for any other valid command line options, like --targets in the example above.
When libtracefs is disabled the cxl-poison.sh unit test is omitted.
The man page gets a note:
The media-error option is only available with -Dlibtracefs=enabled.
---
Changes in v3:
- Remove ifdef's from .c files (Dan)
Move ifdef chunk in json.c to a new conditionally compiled json_poison.c. Move ifdef notice message to !ENABLE_LIBTRACEFS stub in event_trace.h.
Changes in v2:
- Notify and continue when --media-error info is unavailable (Dan)
Documentation/cxl/cxl-list.txt | 2 + config.h.meson | 2 +- cxl/json.c | 180 -------------------------------- cxl/json_poison.c | 185 +++++++++++++++++++++++++++++++++ cxl/meson.build | 1 + test/meson.build | 9 +- util/event_trace.h | 14 +++ 7 files changed, 210 insertions(+), 183 deletions(-) create mode 100644 cxl/json_poison.c
Documentation/cxl/cxl-list.txt +2 -0
@@ -425,6 +425,8 @@ OPTIONS "source:" is one of: External, Internal, Injected, Vendor Specific, or Unknown, as defined in CXL Specification v3.1 Table 8-140. +The media-errors option is only available with '-Dlibtracefs=enabled'. + ---- # cxl list -m mem9 --media-errors -u {
config.h.meson +1 -1
@@ -19,7 +19,7 @@ /* ndctl test support */ #mesondefine ENABLE_TEST -/* cxl monitor support */ +/* cxl monitor and cxl list --media-errors support */ #mesondefine ENABLE_LIBTRACEFS /* Define to 1 if big-endian-arch */
cxl/json.c +0 -180
192 lines not on this page · raw message
cxl/json_poison.c new file +185 -0
185 lines not on this page · raw message
cxl/meson.build +1 -0
@@ -29,6 +29,7 @@ if get_option('libtracefs').enabled() cxl_src += [ '../util/event_trace.c', 'monitor.c', + 'json_poison.c', ] deps += [ traceevent,
test/meson.build +7 -2
@@ -167,7 +167,6 @@ cxl_events = find_program('cxl-events.sh') cxl_sanitize = find_program('cxl-sanitize.sh') cxl_destroy_region = find_program('cxl-destroy-region.sh') cxl_qos_class = find_program('cxl-qos-class.sh') -cxl_poison = find_program('cxl-poison.sh') tests = [ [ 'libndctl', libndctl, 'ndctl' ],
@@ -200,7 +199,6 @@ tests = [ [ 'cxl-sanitize.sh', cxl_sanitize, 'cxl' ], [ 'cxl-destroy-region.sh', cxl_destroy_region, 'cxl' ], [ 'cxl-qos-class.sh', cxl_qos_class, 'cxl' ], - [ 'cxl-poison.sh', cxl_poison, 'cxl' ], ] if get_option('destructive').enabled()
@@ -253,6 +251,13 @@ if get_option('fwctl').enabled() ] endif +if get_option('libtracefs').enabled() + cxl_poison = find_program('cxl-poison.sh') + tests += [ + [ 'cxl-poison.sh', cxl_poison, 'cxl' ], + ] +endif + test_env = [ 'LC_ALL=C', 'NDCTL=@0@'.format(ndctl_tool.full_path()),
util/event_trace.h +14 -0
@@ -7,6 +7,9 @@#include <ccan/list/list.h> #include <ccan/short_types/short_types.h> +#ifdef ENABLE_LIBTRACEFS +#include <tracefs.h> + struct jlist_node { struct json_object *jobj; struct list_node list;
@@ -39,4 +42,15 @@ u32 trace_get_field_u32(struct tep_event *event, struct tep_record *record, const char *name);u64 trace_get_field_u64 (struct tep_event *event,struct tep_record *record,const char *name); +struct json_object *util_cxl_poison_list_to_json (struct cxl_region *region, +struct cxl_memdev *memdev,unsigned long flags); +#else +struct json_object *util_cxl_poison_list_to_json (struct cxl_region *region, +struct cxl_memdev *memdev,unsigned long flags) +{ +fprintf (stderr,"cxl list --media-errors support disabled at build time\n" ); +return NULL ; +} +#endif /* ENABLE_LIBTRACEFS */ +#endif
Signature · 1 line
2.37.3
Quoted 26 lines · Alison Schofield
When the --media-errors option was added to cxl list it inadvertently changed the optional libtracefs requirement into a mandatory one. Ndctl versions 80,81,82 no longer build without libtracefs.
Remove that dependency.
When libtracefs is disabled the user will see a this message logged to stderr:
$ cxl list -r region0 --media-errors --targets cxl list: --media-errors support disabled at build time...followed by the region listing including the output for any other valid command line options, like --targets in the example above.
When libtracefs is disabled the
cxl-poison.shunit test is omitted.The man page gets a note:
The media-error option is only available with -Dlibtracefs=enabled.Reported-by Andreas Hasenack <[email protected]>Fixes d7532bb049e0 ("cxl/list: add --media-errors option to cxl list")Reviewed-by Vishal Verma <[email protected]>Reviewed-by Dave Jiang <[email protected]>Signed-off-by Alison Schofield <[email protected]>
Quoted 6 lines
---
Changes in v3:
- Remove ifdef's from .c files (Dan)
Move ifdef chunk injson.cto a new conditionally compiledjson_poison.c. Move ifdef notice message to !ENABLE_LIBTRACEFS stub inevent_trace.h.
Looks great, I appreciate the ifdef reorganization effort.
Alison Schofield
maintainerQuoted 29 lines · Dan Williams
Quoted 28 lines · Alison Schofield
When the --media-errors option was added to cxl list it inadvertently changed the optional libtracefs requirement into a mandatory one. Ndctl versions 80,81,82 no longer build without libtracefs.
Remove that dependency.
When libtracefs is disabled the user will see a this message logged to stderr:
$ cxl list -r region0 --media-errors --targets cxl list: --media-errors support disabled at build time...followed by the region listing including the output for any other valid command line options, like --targets in the example above.
When libtracefs is disabled the
cxl-poison.shunit test is omitted.The man page gets a note:
The media-error option is only available with -Dlibtracefs=enabled.Reported-by Andreas Hasenack <[email protected]>Fixes d7532bb049e0 ("cxl/list: add --media-errors option to cxl list")Reviewed-by Vishal Verma <[email protected]>Reviewed-by Dave Jiang <[email protected]>Signed-off-by Alison Schofield <[email protected]>---
Quoted 8 lines
Quoted 4 lines
Changes in v3:
- Remove ifdef's from .c files (Dan)
Move ifdef chunk injson.cto a new conditionally compiledjson_poison.c. Move ifdef notice message to !ENABLE_LIBTRACEFS stub inevent_trace.h.Looks great, I appreciate the ifdef reorganization effort.
Reviewed-by Dan Williams <[email protected]>
Thanks for the review!
Pending rebased with this v3 version:
https://github.com/pmem/ndctl/commit/b26e9ae