* Re: [ndctl PATCH] cxl/monitor: Make libtracefs dependency optional
2023-02-23 20:29 ` [ndctl PATCH] cxl/monitor: Make libtracefs dependency optional Dan Williams
@ 2023-02-23 23:28 ` Adam Manzanares
2023-02-24 0:18 ` Verma, Vishal L
2023-02-24 8:04 ` Ira Weiny
2023-02-24 15:27 ` Dave Jiang
2 siblings, 1 reply; 5+ messages in thread
From: Adam Manzanares @ 2023-02-23 23:28 UTC (permalink / raw)
To: Dan Williams; +Cc: linux-cxl@vger.kernel.org, vishal.l.verma@intel.com
On Thu, Feb 23, 2023 at 12:29:02PM -0800, Dan Williams wrote:
> Build a stub version of 'cxl monitor' that reports that the facility was
> statically disabled at configure / build time. Provide the meson
> configuration line to correct the build.
>
> This is in response to the fact that some distros fail to ship
> libtracefs-devel even though they ship libtracefs (looking at you CentOS
> Stream 8).
>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> config.h.meson | 3 +++
> cxl/builtin.h | 9 +++++++++
> cxl/meson.build | 33 +++++++++++++++++++++------------
> meson.build | 7 +++++--
> meson_options.txt | 1 +
> ndctl.spec.in | 8 +++++---
> 6 files changed, 44 insertions(+), 17 deletions(-)
>
> diff --git a/config.h.meson b/config.h.meson
> index 2852f1e9cd8b..5441dff9fce7 100644
> --- a/config.h.meson
> +++ b/config.h.meson
> @@ -19,6 +19,9 @@
> /* ndctl test support */
> #mesondefine ENABLE_TEST
>
> +/* cxl monitor support */
> +#mesondefine ENABLE_LIBTRACEFS
> +
> /* Define to 1 if big-endian-arch */
> #mesondefine HAVE_BIG_ENDIAN
>
> diff --git a/cxl/builtin.h b/cxl/builtin.h
> index 34c5cfb49051..9baa43b8a2ac 100644
> --- a/cxl/builtin.h
> +++ b/cxl/builtin.h
> @@ -22,5 +22,14 @@ int cmd_create_region(int argc, const char **argv, struct cxl_ctx *ctx);
> int cmd_enable_region(int argc, const char **argv, struct cxl_ctx *ctx);
> int cmd_disable_region(int argc, const char **argv, struct cxl_ctx *ctx);
> int cmd_destroy_region(int argc, const char **argv, struct cxl_ctx *ctx);
> +#ifdef ENABLE_LIBTRACEFS
> int cmd_monitor(int argc, const char **argv, struct cxl_ctx *ctx);
> +#else
> +static inline int cmd_monitor(int argc, const char **argv, struct cxl_ctx *ctx)
> +{
> + fprintf(stderr,
> + "cxl monitor: unavailable, rebuild with '-Dlibtracefs=enabled'\n");
> + return EXIT_FAILURE;
> +}
> +#endif
> #endif /* _CXL_BUILTIN_H_ */
> diff --git a/cxl/meson.build b/cxl/meson.build
> index fc2e946707a8..391219be76d1 100644
> --- a/cxl/meson.build
> +++ b/cxl/meson.build
> @@ -7,27 +7,36 @@ cxl_src = [
> 'memdev.c',
> 'json.c',
> 'filter.c',
> - 'event_trace.c',
> - 'monitor.c',
> ]
>
> if get_option('systemd').enabled()
> install_data('cxl-monitor.service', install_dir : systemdunitdir)
> endif
>
> +deps = [
> + cxl_dep,
> + util_dep,
> + uuid,
> + kmod,
> + json,
> + versiondep,
> +]
> +
> +if get_option('libtracefs').enabled()
> + cxl_src += [
> + 'event_trace.c',
> + 'monitor.c',
> + ]
> + deps += [
> + traceevent,
> + tracefs,
> + ]
> +endif
> +
> cxl_tool = executable('cxl',
> cxl_src,
> include_directories : root_inc,
> - dependencies : [
> - cxl_dep,
> - util_dep,
> - uuid,
> - kmod,
> - json,
> - versiondep,
> - traceevent,
> - tracefs,
> - ],
> + dependencies : deps,
> install : true,
> install_dir : rootbindir,
> )
> diff --git a/meson.build b/meson.build
> index 6d2c6827fa88..b4f977f5b7ee 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -143,8 +143,10 @@ kmod = dependency('libkmod')
> libudev = dependency('libudev')
> uuid = dependency('uuid')
> json = dependency('json-c')
> -traceevent = dependency('libtraceevent')
> -tracefs = dependency('libtracefs')
> +if get_option('libtracefs').enabled()
> + traceevent = dependency('libtraceevent')
> + tracefs = dependency('libtracefs')
> +endif
>
> if get_option('docs').enabled()
> if get_option('asciidoctor').enabled()
> @@ -234,6 +236,7 @@ conf.set('ENABLE_TEST', get_option('test').enabled())
> conf.set('ENABLE_DESTRUCTIVE', get_option('destructive').enabled())
> conf.set('ENABLE_LOGGING', get_option('logging').enabled())
> conf.set('ENABLE_DEBUG', get_option('dbg').enabled())
> +conf.set('ENABLE_LIBTRACEFS', get_option('libtracefs').enabled())
>
> typeof_code = '''
> void func() {
> diff --git a/meson_options.txt b/meson_options.txt
> index 4ed519e1f36b..5c41b1abe1f1 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -2,6 +2,7 @@ option('version-tag', type : 'string',
> description : 'override the git version string')
> option('docs', type : 'feature', value : 'enabled')
> option('asciidoctor', type : 'feature', value : 'enabled')
> +option('libtracefs', type : 'feature', value : 'enabled')
> option('systemd', type : 'feature', value : 'enabled')
> option('keyutils', type : 'feature', value : 'enabled',
> description : 'enable nvdimm device passphrase management')
> diff --git a/ndctl.spec.in b/ndctl.spec.in
> index 0543c481da7f..7702f9552cd0 100644
> --- a/ndctl.spec.in
> +++ b/ndctl.spec.in
> @@ -13,9 +13,13 @@ BuildRequires: autoconf
> %if 0%{?rhel} < 9
> BuildRequires: asciidoc
> %define asciidoctor -Dasciidoctor=disabled
> +%define libtracefs -Dlibtracefs=disabled
> %else
> BuildRequires: rubygem-asciidoctor
> +BuildRequires: libtraceevent-devel
> +BuildRequires: libtracefs-devel
> %define asciidoctor -Dasciidoctor=enabled
> +%define libtracefs -Dlibtracefs=enabled
> %endif
> BuildRequires: xmlto
> BuildRequires: automake
> @@ -31,8 +35,6 @@ BuildRequires: keyutils-libs-devel
> BuildRequires: systemd-rpm-macros
> BuildRequires: iniparser-devel
> BuildRequires: meson
> -BuildRequires: libtraceevent-devel
> -BuildRequires: libtracefs-devel
>
> %description
> Utility library for managing the "libnvdimm" subsystem. The "libnvdimm"
> @@ -124,7 +126,7 @@ libcxl is a library for enumerating and communicating with CXL devices.
> %setup -q ndctl-%{version}
>
> %build
> -%meson %{?asciidoctor} -Dversion-tag=%{version}
> +%meson %{?asciidoctor} %{?libtracefs} -Dversion-tag=%{version}
> %meson_build
>
> %install
>
>
Heads up, I just built ndctl devel branch on tumbleweed and libtracefs-dev
puts include files in libtracefs/tracefs.h
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [ndctl PATCH] cxl/monitor: Make libtracefs dependency optional
2023-02-23 23:28 ` Adam Manzanares
@ 2023-02-24 0:18 ` Verma, Vishal L
0 siblings, 0 replies; 5+ messages in thread
From: Verma, Vishal L @ 2023-02-24 0:18 UTC (permalink / raw)
To: Williams, Dan J, a.manzanares@samsung.com; +Cc: linux-cxl@vger.kernel.org
On Thu, 2023-02-23 at 23:28 +0000, Adam Manzanares wrote:
> On Thu, Feb 23, 2023 at 12:29:02PM -0800, Dan Williams wrote:
> > Build a stub version of 'cxl monitor' that reports that the facility was
> > statically disabled at configure / build time. Provide the meson
> > configuration line to correct the build.
> >
> > This is in response to the fact that some distros fail to ship
> > libtracefs-devel even though they ship libtracefs (looking at you CentOS
> > Stream 8).
> >
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> > ---
> > config.h.meson | 3 +++
> > cxl/builtin.h | 9 +++++++++
> > cxl/meson.build | 33 +++++++++++++++++++++------------
> > meson.build | 7 +++++--
> > meson_options.txt | 1 +
> > ndctl.spec.in | 8 +++++---
> > 6 files changed, 44 insertions(+), 17 deletions(-)
>
<..>
> Heads up, I just built ndctl devel branch on tumbleweed and libtracefs-dev
> puts include files in libtracefs/tracefs.h
Yep this was reported earlier today:
https://github.com/pmem/ndctl/issues/234
I'll have a fix and a 76.1 release with these shortly!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ndctl PATCH] cxl/monitor: Make libtracefs dependency optional
2023-02-23 20:29 ` [ndctl PATCH] cxl/monitor: Make libtracefs dependency optional Dan Williams
2023-02-23 23:28 ` Adam Manzanares
@ 2023-02-24 8:04 ` Ira Weiny
2023-02-24 15:27 ` Dave Jiang
2 siblings, 0 replies; 5+ messages in thread
From: Ira Weiny @ 2023-02-24 8:04 UTC (permalink / raw)
To: Dan Williams, linux-cxl; +Cc: vishal.l.verma
Dan Williams wrote:
> Build a stub version of 'cxl monitor' that reports that the facility was
> statically disabled at configure / build time. Provide the meson
> configuration line to correct the build.
>
> This is in response to the fact that some distros fail to ship
> libtracefs-devel even though they ship libtracefs (looking at you CentOS
> Stream 8).
>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> config.h.meson | 3 +++
> cxl/builtin.h | 9 +++++++++
> cxl/meson.build | 33 +++++++++++++++++++++------------
> meson.build | 7 +++++--
> meson_options.txt | 1 +
> ndctl.spec.in | 8 +++++---
> 6 files changed, 44 insertions(+), 17 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ndctl PATCH] cxl/monitor: Make libtracefs dependency optional
2023-02-23 20:29 ` [ndctl PATCH] cxl/monitor: Make libtracefs dependency optional Dan Williams
2023-02-23 23:28 ` Adam Manzanares
2023-02-24 8:04 ` Ira Weiny
@ 2023-02-24 15:27 ` Dave Jiang
2 siblings, 0 replies; 5+ messages in thread
From: Dave Jiang @ 2023-02-24 15:27 UTC (permalink / raw)
To: Dan Williams, linux-cxl; +Cc: vishal.l.verma
On 2/23/23 1:29 PM, Dan Williams wrote:
> Build a stub version of 'cxl monitor' that reports that the facility was
> statically disabled at configure / build time. Provide the meson
> configuration line to correct the build.
>
> This is in response to the fact that some distros fail to ship
> libtracefs-devel even though they ship libtracefs (looking at you CentOS
> Stream 8).
>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> config.h.meson | 3 +++
> cxl/builtin.h | 9 +++++++++
> cxl/meson.build | 33 +++++++++++++++++++++------------
> meson.build | 7 +++++--
> meson_options.txt | 1 +
> ndctl.spec.in | 8 +++++---
> 6 files changed, 44 insertions(+), 17 deletions(-)
>
> diff --git a/config.h.meson b/config.h.meson
> index 2852f1e9cd8b..5441dff9fce7 100644
> --- a/config.h.meson
> +++ b/config.h.meson
> @@ -19,6 +19,9 @@
> /* ndctl test support */
> #mesondefine ENABLE_TEST
>
> +/* cxl monitor support */
> +#mesondefine ENABLE_LIBTRACEFS
> +
> /* Define to 1 if big-endian-arch */
> #mesondefine HAVE_BIG_ENDIAN
>
> diff --git a/cxl/builtin.h b/cxl/builtin.h
> index 34c5cfb49051..9baa43b8a2ac 100644
> --- a/cxl/builtin.h
> +++ b/cxl/builtin.h
> @@ -22,5 +22,14 @@ int cmd_create_region(int argc, const char **argv, struct cxl_ctx *ctx);
> int cmd_enable_region(int argc, const char **argv, struct cxl_ctx *ctx);
> int cmd_disable_region(int argc, const char **argv, struct cxl_ctx *ctx);
> int cmd_destroy_region(int argc, const char **argv, struct cxl_ctx *ctx);
> +#ifdef ENABLE_LIBTRACEFS
> int cmd_monitor(int argc, const char **argv, struct cxl_ctx *ctx);
> +#else
> +static inline int cmd_monitor(int argc, const char **argv, struct cxl_ctx *ctx)
> +{
> + fprintf(stderr,
> + "cxl monitor: unavailable, rebuild with '-Dlibtracefs=enabled'\n");
> + return EXIT_FAILURE;
> +}
> +#endif
> #endif /* _CXL_BUILTIN_H_ */
> diff --git a/cxl/meson.build b/cxl/meson.build
> index fc2e946707a8..391219be76d1 100644
> --- a/cxl/meson.build
> +++ b/cxl/meson.build
> @@ -7,27 +7,36 @@ cxl_src = [
> 'memdev.c',
> 'json.c',
> 'filter.c',
> - 'event_trace.c',
> - 'monitor.c',
> ]
>
> if get_option('systemd').enabled()
> install_data('cxl-monitor.service', install_dir : systemdunitdir)
> endif
>
> +deps = [
> + cxl_dep,
> + util_dep,
> + uuid,
> + kmod,
> + json,
> + versiondep,
> +]
> +
> +if get_option('libtracefs').enabled()
> + cxl_src += [
> + 'event_trace.c',
> + 'monitor.c',
> + ]
> + deps += [
> + traceevent,
> + tracefs,
> + ]
> +endif
> +
> cxl_tool = executable('cxl',
> cxl_src,
> include_directories : root_inc,
> - dependencies : [
> - cxl_dep,
> - util_dep,
> - uuid,
> - kmod,
> - json,
> - versiondep,
> - traceevent,
> - tracefs,
> - ],
> + dependencies : deps,
> install : true,
> install_dir : rootbindir,
> )
> diff --git a/meson.build b/meson.build
> index 6d2c6827fa88..b4f977f5b7ee 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -143,8 +143,10 @@ kmod = dependency('libkmod')
> libudev = dependency('libudev')
> uuid = dependency('uuid')
> json = dependency('json-c')
> -traceevent = dependency('libtraceevent')
> -tracefs = dependency('libtracefs')
> +if get_option('libtracefs').enabled()
> + traceevent = dependency('libtraceevent')
> + tracefs = dependency('libtracefs')
> +endif
>
> if get_option('docs').enabled()
> if get_option('asciidoctor').enabled()
> @@ -234,6 +236,7 @@ conf.set('ENABLE_TEST', get_option('test').enabled())
> conf.set('ENABLE_DESTRUCTIVE', get_option('destructive').enabled())
> conf.set('ENABLE_LOGGING', get_option('logging').enabled())
> conf.set('ENABLE_DEBUG', get_option('dbg').enabled())
> +conf.set('ENABLE_LIBTRACEFS', get_option('libtracefs').enabled())
>
> typeof_code = '''
> void func() {
> diff --git a/meson_options.txt b/meson_options.txt
> index 4ed519e1f36b..5c41b1abe1f1 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -2,6 +2,7 @@ option('version-tag', type : 'string',
> description : 'override the git version string')
> option('docs', type : 'feature', value : 'enabled')
> option('asciidoctor', type : 'feature', value : 'enabled')
> +option('libtracefs', type : 'feature', value : 'enabled')
> option('systemd', type : 'feature', value : 'enabled')
> option('keyutils', type : 'feature', value : 'enabled',
> description : 'enable nvdimm device passphrase management')
> diff --git a/ndctl.spec.in b/ndctl.spec.in
> index 0543c481da7f..7702f9552cd0 100644
> --- a/ndctl.spec.in
> +++ b/ndctl.spec.in
> @@ -13,9 +13,13 @@ BuildRequires: autoconf
> %if 0%{?rhel} < 9
> BuildRequires: asciidoc
> %define asciidoctor -Dasciidoctor=disabled
> +%define libtracefs -Dlibtracefs=disabled
> %else
> BuildRequires: rubygem-asciidoctor
> +BuildRequires: libtraceevent-devel
> +BuildRequires: libtracefs-devel
> %define asciidoctor -Dasciidoctor=enabled
> +%define libtracefs -Dlibtracefs=enabled
> %endif
> BuildRequires: xmlto
> BuildRequires: automake
> @@ -31,8 +35,6 @@ BuildRequires: keyutils-libs-devel
> BuildRequires: systemd-rpm-macros
> BuildRequires: iniparser-devel
> BuildRequires: meson
> -BuildRequires: libtraceevent-devel
> -BuildRequires: libtracefs-devel
>
> %description
> Utility library for managing the "libnvdimm" subsystem. The "libnvdimm"
> @@ -124,7 +126,7 @@ libcxl is a library for enumerating and communicating with CXL devices.
> %setup -q ndctl-%{version}
>
> %build
> -%meson %{?asciidoctor} -Dversion-tag=%{version}
> +%meson %{?asciidoctor} %{?libtracefs} -Dversion-tag=%{version}
> %meson_build
>
> %install
>
^ permalink raw reply [flat|nested] 5+ messages in thread